summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/jit
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/jit
parent3977e3d2f72f7fe2c887c1ec0e0c342e1d169f42 (diff)
downloadqtwebkit-4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26.tar.gz
Imported WebKit commit 953baa67aa07087b6ecd4199351ec554c724e27d (http://svn.webkit.org/repository/webkit/trunk@122676)
Diffstat (limited to 'Source/JavaScriptCore/jit')
-rw-r--r--Source/JavaScriptCore/jit/JIT.cpp6
-rw-r--r--Source/JavaScriptCore/jit/JITStubs.cpp26
-rw-r--r--Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp56
-rw-r--r--Source/JavaScriptCore/jit/JumpReplacementWatchpoint.h73
4 files changed, 147 insertions, 14 deletions
diff --git a/Source/JavaScriptCore/jit/JIT.cpp b/Source/JavaScriptCore/jit/JIT.cpp
index 285355f1b..52a7158e6 100644
--- a/Source/JavaScriptCore/jit/JIT.cpp
+++ b/Source/JavaScriptCore/jit/JIT.cpp
@@ -739,7 +739,7 @@ JITCode JIT::privateCompile(CodePtr* functionEntryArityCheck, JITCompilationEffo
CallLinkInfo& info = m_codeBlock->callLinkInfo(i);
info.callType = m_callStructureStubCompilationInfo[i].callType;
info.bytecodeIndex = m_callStructureStubCompilationInfo[i].bytecodeIndex;
- info.callReturnLocation = CodeLocationLabel(patchBuffer.locationOfNearCall(m_callStructureStubCompilationInfo[i].callReturnLocation));
+ info.callReturnLocation = patchBuffer.locationOfNearCall(m_callStructureStubCompilationInfo[i].callReturnLocation);
info.hotPathBegin = patchBuffer.locationOf(m_callStructureStubCompilationInfo[i].hotPathBegin);
info.hotPathOther = patchBuffer.locationOfNearCall(m_callStructureStubCompilationInfo[i].hotPathOther);
}
@@ -802,12 +802,12 @@ void JIT::linkFor(JSFunction* callee, CodeBlock* callerCodeBlock, CodeBlock* cal
// Patch the slow patch so we do not continue to try to link.
if (kind == CodeForCall) {
- repatchBuffer.relink(CodeLocationNearCall(callLinkInfo->callReturnLocation), globalData->jitStubs->ctiVirtualCall());
+ repatchBuffer.relink(callLinkInfo->callReturnLocation, globalData->jitStubs->ctiVirtualCall());
return;
}
ASSERT(kind == CodeForConstruct);
- repatchBuffer.relink(CodeLocationNearCall(callLinkInfo->callReturnLocation), globalData->jitStubs->ctiVirtualConstruct());
+ repatchBuffer.relink(callLinkInfo->callReturnLocation, globalData->jitStubs->ctiVirtualConstruct());
}
} // namespace JSC
diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp
index 2273f0f38..bfc4709bc 100644
--- a/Source/JavaScriptCore/jit/JITStubs.cpp
+++ b/Source/JavaScriptCore/jit/JITStubs.cpp
@@ -740,17 +740,20 @@ __asm EncodedJSValue ctiTrampoline(void*, RegisterFile*, CallFrame*, void* /*unu
{
ARM
stmdb sp!, {r1-r3}
- stmdb sp!, {r4-r8, lr}
+ stmdb sp!, {r4-r6, r8-r11, lr}
sub sp, sp, # PRESERVEDR4_OFFSET
- mov r4, r2
- mov r5, #512
+ mov r5, r2
+ mov r6, #512
mov lr, pc
bx r0
add sp, sp, # PRESERVEDR4_OFFSET
- ldmia sp!, {r4-r8, lr}
+ ldmia sp!, {r4-r6, r8-r11, lr}
add sp, sp, #12
bx lr
}
+__asm void ctiTrampolineEnd()
+{
+}
__asm void ctiVMThrowTrampoline()
{
@@ -759,7 +762,7 @@ __asm void ctiVMThrowTrampoline()
mov r0, sp
bl cti_vm_throw
add sp, sp, # PRESERVEDR4_OFFSET
- ldmia sp!, {r4-r8, lr}
+ ldmia sp!, {r4-r6, r8-r11, lr}
add sp, sp, #12
bx lr
}
@@ -1212,31 +1215,32 @@ RVCT()
MSVC_BEGIN( AREA Trampoline, CODE)
MSVC_BEGIN()
MSVC_BEGIN( EXPORT ctiTrampoline)
+MSVC_BEGIN( EXPORT ctiTrampolineEnd)
MSVC_BEGIN( EXPORT ctiVMThrowTrampoline)
MSVC_BEGIN( EXPORT ctiOpThrowNotCaught)
MSVC_BEGIN()
MSVC_BEGIN(ctiTrampoline PROC)
MSVC_BEGIN( stmdb sp!, {r1-r3})
-MSVC_BEGIN( stmdb sp!, {r4-r8, lr})
+MSVC_BEGIN( stmdb sp!, {r4-r6, r8-r11, lr})
MSVC_BEGIN( sub sp, sp, #68 ; sync with PRESERVEDR4_OFFSET)
-MSVC_BEGIN( mov r4, r2)
-MSVC_BEGIN( mov r5, #512)
+MSVC_BEGIN( mov r5, r2)
+MSVC_BEGIN( mov r6, #512)
MSVC_BEGIN( ; r0 contains the code)
MSVC_BEGIN( mov lr, pc)
MSVC_BEGIN( bx r0)
MSVC_BEGIN( add sp, sp, #68 ; sync with PRESERVEDR4_OFFSET)
-MSVC_BEGIN( ldmia sp!, {r4-r8, lr})
+MSVC_BEGIN( ldmia sp!, {r4-r6, r8-r11, lr})
MSVC_BEGIN( add sp, sp, #12)
MSVC_BEGIN( bx lr)
+MSVC_BEGIN(ctiTrampolineEnd)
MSVC_BEGIN(ctiTrampoline ENDP)
MSVC_BEGIN()
MSVC_BEGIN(ctiVMThrowTrampoline PROC)
MSVC_BEGIN( mov r0, sp)
-MSVC_BEGIN( mov lr, pc)
MSVC_BEGIN( bl cti_vm_throw)
MSVC_BEGIN(ctiOpThrowNotCaught)
MSVC_BEGIN( add sp, sp, #68 ; sync with PRESERVEDR4_OFFSET)
-MSVC_BEGIN( ldmia sp!, {r4-r8, lr})
+MSVC_BEGIN( ldmia sp!, {r4-r6, r8-r11, lr})
MSVC_BEGIN( add sp, sp, #12)
MSVC_BEGIN( bx lr)
MSVC_BEGIN(ctiVMThrowTrampoline ENDP)
diff --git a/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp b/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp
new file mode 100644
index 000000000..725108dd5
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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 "JumpReplacementWatchpoint.h"
+
+#if ENABLE(JIT)
+
+#include "LinkBuffer.h"
+
+namespace JSC {
+
+void JumpReplacementWatchpoint::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());
+}
+
+void JumpReplacementWatchpoint::fireInternal()
+{
+ MacroAssembler::replaceWithJump(
+ CodeLocationLabel(bitwise_cast<void*>(m_source)),
+ CodeLocationLabel(bitwise_cast<void*>(m_destination)));
+ if (isOnList())
+ remove();
+}
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
+
diff --git a/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.h b/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.h
new file mode 100644
index 000000000..b4f35c724
--- /dev/null
+++ b/Source/JavaScriptCore/jit/JumpReplacementWatchpoint.h
@@ -0,0 +1,73 @@
+/*
+ * 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 JumpReplacementWatchpoint_h
+#define JumpReplacementWatchpoint_h
+
+#include "Watchpoint.h"
+#include <wtf/Platform.h>
+
+#if ENABLE(JIT)
+
+#include "CodeLocation.h"
+#include "MacroAssembler.h"
+
+namespace JSC {
+
+class JumpReplacementWatchpoint : public Watchpoint {
+public:
+ JumpReplacementWatchpoint()
+ : m_source(std::numeric_limits<uintptr_t>::max())
+ , m_destination(std::numeric_limits<uintptr_t>::max())
+ {
+ }
+
+ JumpReplacementWatchpoint(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&);
+
+protected:
+ void fireInternal();
+
+private:
+ uintptr_t m_source;
+ uintptr_t m_destination;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(JIT)
+
+#endif // JumpReplacementWatchpoint_h
+