summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/bytecode
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-07-16 14:51:15 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-07-16 14:51:15 +0200
commit4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26 (patch)
tree7bb9ad7e31c24d1cf1707e03e6f1a80f6d033951 /Source/JavaScriptCore/bytecode
parent3977e3d2f72f7fe2c887c1ec0e0c342e1d169f42 (diff)
downloadqtwebkit-4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26.tar.gz
Imported WebKit commit 953baa67aa07087b6ecd4199351ec554c724e27d (http://svn.webkit.org/repository/webkit/trunk@122676)
Diffstat (limited to 'Source/JavaScriptCore/bytecode')
-rw-r--r--Source/JavaScriptCore/bytecode/CallLinkInfo.cpp5
-rw-r--r--Source/JavaScriptCore/bytecode/CallLinkInfo.h2
-rw-r--r--Source/JavaScriptCore/bytecode/CodeBlock.cpp62
-rw-r--r--Source/JavaScriptCore/bytecode/CodeBlock.h14
-rw-r--r--Source/JavaScriptCore/bytecode/CodeOrigin.h8
-rw-r--r--Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.cpp80
-rw-r--r--Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h109
-rw-r--r--Source/JavaScriptCore/bytecode/StructureStubInfo.h10
-rw-r--r--Source/JavaScriptCore/bytecode/Watchpoint.cpp59
-rw-r--r--Source/JavaScriptCore/bytecode/Watchpoint.h65
10 files changed, 295 insertions, 119 deletions
diff --git a/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp b/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp
index 4c108ecf1..4933a494c 100644
--- a/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp
+++ b/Source/JavaScriptCore/bytecode/CallLinkInfo.cpp
@@ -27,6 +27,7 @@
#include "CallLinkInfo.h"
#include "DFGOperations.h"
+#include "DFGThunks.h"
#include "RepatchBuffer.h"
#if ENABLE(JIT)
@@ -38,12 +39,12 @@ void CallLinkInfo::unlink(JSGlobalData& globalData, RepatchBuffer& repatchBuffer
if (isDFG) {
#if ENABLE(DFG_JIT)
- repatchBuffer.relink(CodeLocationCall(callReturnLocation), callType == Construct ? DFG::operationLinkConstruct : DFG::operationLinkCall);
+ repatchBuffer.relink(callReturnLocation, (callType == Construct ? globalData.getCTIStub(DFG::linkConstructThunkGenerator) : globalData.getCTIStub(DFG::linkCallThunkGenerator)).code());
#else
ASSERT_NOT_REACHED();
#endif
} else
- repatchBuffer.relink(CodeLocationNearCall(callReturnLocation), callType == Construct ? globalData.jitStubs->ctiVirtualConstructLink() : globalData.jitStubs->ctiVirtualCallLink());
+ repatchBuffer.relink(callReturnLocation, callType == Construct ? globalData.jitStubs->ctiVirtualConstructLink() : globalData.jitStubs->ctiVirtualCallLink());
hasSeenShouldRepatch = false;
callee.clear();
diff --git a/Source/JavaScriptCore/bytecode/CallLinkInfo.h b/Source/JavaScriptCore/bytecode/CallLinkInfo.h
index 44d50a971..4a78e5d02 100644
--- a/Source/JavaScriptCore/bytecode/CallLinkInfo.h
+++ b/Source/JavaScriptCore/bytecode/CallLinkInfo.h
@@ -65,7 +65,7 @@ struct CallLinkInfo : public BasicRawSentinelNode<CallLinkInfo> {
remove();
}
- CodeLocationLabel callReturnLocation; // it's a near call in the old JIT, or a normal call in DFG
+ CodeLocationNearCall callReturnLocation;
CodeLocationDataLabelPtr hotPathBegin;
CodeLocationNearCall hotPathOther;
JITWriteBarrier<JSFunction> callee;
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
index 48d0fe728..d417a5fbd 100644
--- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -2026,16 +2026,16 @@ void CodeBlock::visitWeakReferences(SlotVisitor& visitor)
performTracingFixpointIteration(visitor);
}
-void CodeBlock::finalizeUnconditionally()
-{
#if ENABLE(JIT)
#if ENABLE(JIT_VERBOSE_OSR)
- static const bool verboseUnlinking = true;
+static const bool verboseUnlinking = true;
#else
- static const bool verboseUnlinking = false;
+static const bool verboseUnlinking = false;
#endif
#endif // ENABLE(JIT)
+void CodeBlock::finalizeUnconditionally()
+{
#if ENABLE(LLINT)
Interpreter* interpreter = m_globalData->interpreter;
// interpreter->classicEnabled() returns true if the old C++ interpreter is enabled. If that's enabled
@@ -2141,28 +2141,10 @@ void CodeBlock::finalizeUnconditionally()
for (size_t size = m_structureStubInfos.size(), i = 0; i < size; ++i) {
StructureStubInfo& stubInfo = m_structureStubInfos[i];
- AccessType accessType = static_cast<AccessType>(stubInfo.accessType);
-
if (stubInfo.visitWeakReferences())
continue;
- if (verboseUnlinking)
- dataLog("Clearing structure cache (kind %d) in %p.\n", stubInfo.accessType, this);
-
- if (isGetByIdAccess(accessType)) {
- if (getJITCode().jitType() == JITCode::DFGJIT)
- DFG::dfgResetGetByID(repatchBuffer, stubInfo);
- else
- JIT::resetPatchGetById(repatchBuffer, &stubInfo);
- } else {
- ASSERT(isPutByIdAccess(accessType));
- if (getJITCode().jitType() == JITCode::DFGJIT)
- DFG::dfgResetPutByID(repatchBuffer, stubInfo);
- else
- JIT::resetPatchPutById(repatchBuffer, &stubInfo);
- }
-
- stubInfo.reset();
+ resetStubInternal(repatchBuffer, stubInfo);
}
for (size_t size = m_methodCallLinkInfos.size(), i = 0; i < size; ++i) {
@@ -2198,6 +2180,40 @@ void CodeBlock::finalizeUnconditionally()
#endif
}
+#if ENABLE(JIT)
+void CodeBlock::resetStub(StructureStubInfo& stubInfo)
+{
+ if (stubInfo.accessType == access_unset)
+ return;
+
+ RepatchBuffer repatchBuffer(this);
+ resetStubInternal(repatchBuffer, stubInfo);
+}
+
+void CodeBlock::resetStubInternal(RepatchBuffer& repatchBuffer, StructureStubInfo& stubInfo)
+{
+ AccessType accessType = static_cast<AccessType>(stubInfo.accessType);
+
+ if (verboseUnlinking)
+ dataLog("Clearing structure cache (kind %d) in %p.\n", stubInfo.accessType, this);
+
+ if (isGetByIdAccess(accessType)) {
+ if (getJITCode().jitType() == JITCode::DFGJIT)
+ DFG::dfgResetGetByID(repatchBuffer, stubInfo);
+ else
+ JIT::resetPatchGetById(repatchBuffer, &stubInfo);
+ } else {
+ ASSERT(isPutByIdAccess(accessType));
+ if (getJITCode().jitType() == JITCode::DFGJIT)
+ DFG::dfgResetPutByID(repatchBuffer, stubInfo);
+ else
+ JIT::resetPatchPutById(repatchBuffer, &stubInfo);
+ }
+
+ stubInfo.reset();
+}
+#endif
+
void CodeBlock::stronglyVisitStrongReferences(SlotVisitor& visitor)
{
visitor.append(&m_globalObject);
diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h
index ed072f832..56ede595a 100644
--- a/Source/JavaScriptCore/bytecode/CodeBlock.h
+++ b/Source/JavaScriptCore/bytecode/CodeBlock.h
@@ -55,6 +55,7 @@
#include "JITCode.h"
#include "JITWriteBarrier.h"
#include "JSGlobalObject.h"
+#include "JumpReplacementWatchpoint.h"
#include "JumpTable.h"
#include "LLIntCallLinkInfo.h"
#include "LazyOperandValueProfile.h"
@@ -103,6 +104,7 @@ namespace JSC {
class DFGCodeBlocks;
class ExecState;
class LLIntOffsetsExtractor;
+ class RepatchBuffer;
inline int unmodifiedArgumentsRegister(int argumentsRegister) { return argumentsRegister - 1; }
@@ -204,6 +206,8 @@ namespace JSC {
{
return *(binarySearch<StructureStubInfo, unsigned, getStructureStubInfoBytecodeIndex>(m_structureStubInfos.begin(), m_structureStubInfos.size(), bytecodeIndex));
}
+
+ void resetStub(StructureStubInfo&);
CallLinkInfo& getCallLinkInfo(ReturnAddressPtr returnAddress)
{
@@ -328,7 +332,7 @@ namespace JSC {
return result;
}
- unsigned appendWatchpoint(const Watchpoint& watchpoint)
+ unsigned appendWatchpoint(const JumpReplacementWatchpoint& watchpoint)
{
createDFGDataIfNecessary();
unsigned result = m_dfgData->watchpoints.size();
@@ -367,7 +371,7 @@ namespace JSC {
return m_dfgData->speculationRecovery[index];
}
- Watchpoint& watchpoint(unsigned index)
+ JumpReplacementWatchpoint& watchpoint(unsigned index)
{
return m_dfgData->watchpoints[index];
}
@@ -1232,6 +1236,10 @@ namespace JSC {
if (!m_rareData)
m_rareData = adoptPtr(new RareData);
}
+
+#if ENABLE(JIT)
+ void resetStubInternal(RepatchBuffer&, StructureStubInfo&);
+#endif
int m_numParameters;
@@ -1299,7 +1307,7 @@ namespace JSC {
Vector<DFG::OSREntryData> osrEntry;
SegmentedVector<DFG::OSRExit, 8> osrExit;
Vector<DFG::SpeculationRecovery> speculationRecovery;
- SegmentedVector<Watchpoint, 1, 0> watchpoints;
+ SegmentedVector<JumpReplacementWatchpoint, 1, 0> watchpoints;
Vector<WeakReferenceTransition> transitions;
Vector<WriteBarrier<JSCell> > weakReferences;
DFG::VariableEventStream variableEventStream;
diff --git a/Source/JavaScriptCore/bytecode/CodeOrigin.h b/Source/JavaScriptCore/bytecode/CodeOrigin.h
index 034e48f3f..c9c0f7005 100644
--- a/Source/JavaScriptCore/bytecode/CodeOrigin.h
+++ b/Source/JavaScriptCore/bytecode/CodeOrigin.h
@@ -39,6 +39,8 @@ class ExecutableBase;
class JSFunction;
struct CodeOrigin {
+ static const unsigned maximumBytecodeIndex = (1u << 29) - 1;
+
// Bytecode offset that you'd use to re-execute this instruction.
unsigned bytecodeIndex : 29;
// Bytecode offset corresponding to the opcode that gives the result (needed to handle
@@ -48,7 +50,7 @@ struct CodeOrigin {
InlineCallFrame* inlineCallFrame;
CodeOrigin()
- : bytecodeIndex(std::numeric_limits<uint32_t>::max())
+ : bytecodeIndex(maximumBytecodeIndex)
, valueProfileOffset(0)
, inlineCallFrame(0)
{
@@ -59,11 +61,11 @@ struct CodeOrigin {
, valueProfileOffset(valueProfileOffset)
, inlineCallFrame(inlineCallFrame)
{
- ASSERT(bytecodeIndex < (1u << 29));
+ ASSERT(bytecodeIndex <= maximumBytecodeIndex);
ASSERT(valueProfileOffset < (1u << 3));
}
- bool isSet() const { return bytecodeIndex != std::numeric_limits<uint32_t>::max(); }
+ bool isSet() const { return bytecodeIndex != maximumBytecodeIndex; }
unsigned bytecodeIndexForValueProfile() const
{
diff --git a/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.cpp b/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.cpp
new file mode 100644
index 000000000..5cfb3d1e8
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "StructureStubClearingWatchpoint.h"
+
+#if ENABLE(JIT)
+
+#include "CodeBlock.h"
+#include "StructureStubInfo.h"
+
+namespace JSC {
+
+StructureStubClearingWatchpoint::~StructureStubClearingWatchpoint() { }
+
+StructureStubClearingWatchpoint* StructureStubClearingWatchpoint::push(
+ WatchpointsOnStructureStubInfo& holder,
+ OwnPtr<StructureStubClearingWatchpoint>& head)
+{
+ head = adoptPtr(new StructureStubClearingWatchpoint(holder, head.release()));
+ return head.get();
+}
+
+void StructureStubClearingWatchpoint::fireInternal()
+{
+ // This will implicitly cause my own demise: stub reset removes all watchpoints.
+ // That works, because deleting a watchpoint removes it from the set's list, and
+ // the set's list traversal for firing is robust against the set changing.
+ m_holder.codeBlock()->resetStub(*m_holder.stubInfo());
+}
+
+WatchpointsOnStructureStubInfo::~WatchpointsOnStructureStubInfo()
+{
+}
+
+StructureStubClearingWatchpoint* WatchpointsOnStructureStubInfo::addWatchpoint()
+{
+ return StructureStubClearingWatchpoint::push(*this, m_head);
+}
+
+StructureStubClearingWatchpoint* WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint(
+ RefPtr<WatchpointsOnStructureStubInfo>& holderRef, CodeBlock* codeBlock,
+ StructureStubInfo* stubInfo)
+{
+ if (!holderRef)
+ holderRef = adoptRef(new WatchpointsOnStructureStubInfo(codeBlock, stubInfo));
+ else {
+ ASSERT(holderRef->m_codeBlock == codeBlock);
+ ASSERT(holderRef->m_stubInfo == stubInfo);
+ }
+
+ return holderRef->addWatchpoint();
+}
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
+
diff --git a/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h b/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h
new file mode 100644
index 000000000..827e816ee
--- /dev/null
+++ b/Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StructureStubClearingWatchpoint_h
+#define StructureStubClearingWatchpoint_h
+
+#include "Watchpoint.h"
+#include <wtf/Platform.h>
+
+#if ENABLE(JIT)
+
+#include <wtf/FastAllocBase.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace JSC {
+
+class CodeBlock;
+class WatchpointsOnStructureStubInfo;
+struct StructureStubInfo;
+
+class StructureStubClearingWatchpoint : public Watchpoint {
+ WTF_MAKE_NONCOPYABLE(StructureStubClearingWatchpoint);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ StructureStubClearingWatchpoint(
+ WatchpointsOnStructureStubInfo& holder)
+ : m_holder(holder)
+ {
+ }
+
+ StructureStubClearingWatchpoint(
+ WatchpointsOnStructureStubInfo& holder,
+ PassOwnPtr<StructureStubClearingWatchpoint> next)
+ : m_holder(holder)
+ , m_next(next)
+ {
+ }
+
+ virtual ~StructureStubClearingWatchpoint();
+
+ static StructureStubClearingWatchpoint* push(
+ WatchpointsOnStructureStubInfo& holder,
+ OwnPtr<StructureStubClearingWatchpoint>& head);
+
+protected:
+ void fireInternal();
+
+private:
+ WatchpointsOnStructureStubInfo& m_holder;
+ OwnPtr<StructureStubClearingWatchpoint> m_next;
+};
+
+class WatchpointsOnStructureStubInfo : public RefCounted<WatchpointsOnStructureStubInfo> {
+public:
+ WatchpointsOnStructureStubInfo(CodeBlock* codeBlock, StructureStubInfo* stubInfo)
+ : m_codeBlock(codeBlock)
+ , m_stubInfo(stubInfo)
+ {
+ }
+
+ ~WatchpointsOnStructureStubInfo();
+
+ StructureStubClearingWatchpoint* addWatchpoint();
+
+ static StructureStubClearingWatchpoint* ensureReferenceAndAddWatchpoint(
+ RefPtr<WatchpointsOnStructureStubInfo>& holderRef,
+ CodeBlock*, StructureStubInfo*);
+
+ CodeBlock* codeBlock() const { return m_codeBlock; }
+ StructureStubInfo* stubInfo() const { return m_stubInfo; }
+
+private:
+ CodeBlock* m_codeBlock;
+ StructureStubInfo* m_stubInfo;
+ OwnPtr<StructureStubClearingWatchpoint> m_head;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
+
+#endif // StructureStubClearingWatchpoint_h
+
diff --git a/Source/JavaScriptCore/bytecode/StructureStubInfo.h b/Source/JavaScriptCore/bytecode/StructureStubInfo.h
index 807966cf3..737ea88c2 100644
--- a/Source/JavaScriptCore/bytecode/StructureStubInfo.h
+++ b/Source/JavaScriptCore/bytecode/StructureStubInfo.h
@@ -36,6 +36,8 @@
#include "MacroAssembler.h"
#include "Opcode.h"
#include "Structure.h"
+#include "StructureStubClearingWatchpoint.h"
+#include <wtf/OwnPtr.h>
namespace JSC {
@@ -170,6 +172,7 @@ namespace JSC {
deref();
accessType = access_unset;
stubRoutine.clear();
+ watchpoints.clear();
}
void deref();
@@ -186,6 +189,12 @@ namespace JSC {
seen = true;
}
+ StructureStubClearingWatchpoint* addWatchpoint(CodeBlock* codeBlock)
+ {
+ return WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint(
+ watchpoints, codeBlock, this);
+ }
+
unsigned bytecodeIndex;
int8_t accessType;
@@ -290,6 +299,7 @@ namespace JSC {
RefPtr<JITStubRoutine> stubRoutine;
CodeLocationCall callReturnLocation;
CodeLocationLabel hotPathBegin;
+ RefPtr<WatchpointsOnStructureStubInfo> watchpoints;
};
inline void* getStructureStubInfoReturnLocation(StructureStubInfo* structureStubInfo)
diff --git a/Source/JavaScriptCore/bytecode/Watchpoint.cpp b/Source/JavaScriptCore/bytecode/Watchpoint.cpp
index 1dd633f52..6f80dfa5e 100644
--- a/Source/JavaScriptCore/bytecode/Watchpoint.cpp
+++ b/Source/JavaScriptCore/bytecode/Watchpoint.cpp
@@ -4,26 +4,23 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
@@ -39,30 +36,6 @@ Watchpoint::~Watchpoint()
remove();
}
-#if ENABLE(JIT)
-void Watchpoint::correctLabels(LinkBuffer& linkBuffer)
-{
- MacroAssembler::Label label;
- label.m_label.m_offset = m_source;
- m_source = bitwise_cast<uintptr_t>(linkBuffer.locationOf(label).dataLocation());
- label.m_label.m_offset = m_destination;
- m_destination = bitwise_cast<uintptr_t>(linkBuffer.locationOf(label).dataLocation());
-}
-#endif
-
-void Watchpoint::fire()
-{
-#if ENABLE(JIT)
- MacroAssembler::replaceWithJump(
- CodeLocationLabel(bitwise_cast<void*>(m_source)),
- CodeLocationLabel(bitwise_cast<void*>(m_destination)));
- if (isOnList())
- remove();
-#else
- UNREACHABLE_FOR_PLATFORM();
-#endif
-}
-
WatchpointSet::WatchpointSet(InitialWatchpointSetMode mode)
: m_isWatched(mode == InitializedWatching)
, m_isInvalidated(false)
diff --git a/Source/JavaScriptCore/bytecode/Watchpoint.h b/Source/JavaScriptCore/bytecode/Watchpoint.h
index 0055bf607..8e0526c0f 100644
--- a/Source/JavaScriptCore/bytecode/Watchpoint.h
+++ b/Source/JavaScriptCore/bytecode/Watchpoint.h
@@ -4,33 +4,28 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef Watchpoint_h
#define Watchpoint_h
-#include "CodeLocation.h"
-#include "MacroAssembler.h"
#include <wtf/RefCounted.h>
#include <wtf/SentinelLinkedList.h>
@@ -39,33 +34,15 @@ namespace JSC {
class Watchpoint : public BasicRawSentinelNode<Watchpoint> {
public:
Watchpoint()
- : m_source(std::numeric_limits<uintptr_t>::max())
- , m_destination(std::numeric_limits<uintptr_t>::max())
- {
- }
-
-#if ENABLE(JIT)
- Watchpoint(MacroAssembler::Label source)
- : m_source(source.m_label.m_offset)
- , m_destination(std::numeric_limits<uintptr_t>::max())
{
}
- void setDestination(MacroAssembler::Label destination)
- {
- m_destination = destination.m_label.m_offset;
- }
-
- void correctLabels(LinkBuffer&);
-#endif
-
- ~Watchpoint();
-
- void fire();
+ virtual ~Watchpoint();
+
+ void fire() { fireInternal(); }
-private:
- uintptr_t m_source;
- uintptr_t m_destination;
+protected:
+ virtual void fireInternal() = 0;
};
enum InitialWatchpointSetMode { InitializedWatching, InitializedBlind };