Commit cd1c2e74 authored by oliver@apple.com's avatar oliver@apple.com

fourthTier: Refactor JITStubs.cpp to move CPU specific parts out into their own files.

https://bugs.webkit.org/show_bug.cgi?id=116135.

Reviewed by Michael Saboff.

This mod only moves the CPU specific parts out. There is no code change.
Tested on debug builds of X86, X86_64, ARM and ARMv7. The SH4 and MIPS
ports are untested. Windows port also not tested.

* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* jit/JITStubs.cpp:
(JSC::performPlatformSpecificJITAssertions):
* jit/JITStubsARM.h: Added.
(JSC::ctiTrampoline):
(JSC::ctiTrampolineEnd):
(JSC::ctiVMThrowTrampoline):
(JSC::ctiOpThrowNotCaught):
(JSC::performARMJITAssertions):
* jit/JITStubsARMv7.h: Added.
(JSC::ctiTrampoline):
(JSC::ctiVMThrowTrampoline):
(JSC::ctiOpThrowNotCaught):
(JSC::performARMv7JITAssertions):
* jit/JITStubsMIPS.h: Added.
(JSC::performMIPSJITAssertions):
* jit/JITStubsSH4.h: Added.
* jit/JITStubsX86.h: Added.
* jit/JITStubsX86_64.h: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 118f1300
2013-05-14 Mark Lam <mark.lam@apple.com>
Refactor JITStubs.cpp to move CPU specific parts out into their own files.
https://bugs.webkit.org/show_bug.cgi?id=116135.
Reviewed by Michael Saboff.
This mod only moves the CPU specific parts out. There is no code change.
Tested on debug builds of X86, X86_64, ARM and ARMv7. The SH4 and MIPS
ports are untested. Windows port also not tested.
* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* jit/JITStubs.cpp:
(JSC::performPlatformSpecificJITAssertions):
* jit/JITStubsARM.h: Added.
(JSC::ctiTrampoline):
(JSC::ctiTrampolineEnd):
(JSC::ctiVMThrowTrampoline):
(JSC::ctiOpThrowNotCaught):
(JSC::performARMJITAssertions):
* jit/JITStubsARMv7.h: Added.
(JSC::ctiTrampoline):
(JSC::ctiVMThrowTrampoline):
(JSC::ctiOpThrowNotCaught):
(JSC::performARMv7JITAssertions):
* jit/JITStubsMIPS.h: Added.
(JSC::performMIPSJITAssertions):
* jit/JITStubsSH4.h: Added.
* jit/JITStubsX86.h: Added.
* jit/JITStubsX86_64.h: Added.
2013-05-14 Mark Hahnenberg <mhahnenberg@apple.com>
fourthTier: Segfault in jsc with simple test program when running with profile dumping enabled
......
......@@ -477,6 +477,12 @@ javascriptcore_sources += \
Source/JavaScriptCore/jit/JITStubRoutine.h \
Source/JavaScriptCore/jit/JITStubs.cpp \
Source/JavaScriptCore/jit/JITStubs.h \
Source/JavaScriptCore/jit/JITStubsARM.h \
Source/JavaScriptCore/jit/JITStubsARMv7.h \
Source/JavaScriptCore/jit/JITStubsMIPS.h \
Source/JavaScriptCore/jit/JITStubsSH4.h \
Source/JavaScriptCore/jit/JITStubsX86.h \
Source/JavaScriptCore/jit/JITStubsX86_64.h \
Source/JavaScriptCore/jit/JITThunks.cpp \
Source/JavaScriptCore/jit/JITThunks.h \
Source/JavaScriptCore/jit/JITWriteBarrier.h \
......
......@@ -705,6 +705,8 @@
<ClInclude Include="..\jit\JITStubCall.h" />
<ClInclude Include="..\jit\JITStubRoutine.h" />
<ClInclude Include="..\jit\JITStubs.h" />
<ClInclude Include="..\jit\JITStubsX86.h" />
<ClInclude Include="..\jit\JITStubsX86_64.h" />
<ClInclude Include="..\jit\JITThunks.h" />
<ClInclude Include="..\jit\JITWriteBarrier.h" />
<ClInclude Include="..\jit\JSInterfaceJIT.h" />
......
......@@ -949,6 +949,10 @@
FED94F2E171E3E2300BE77A4 /* Watchdog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FED94F2B171E3E2300BE77A4 /* Watchdog.cpp */; };
FED94F2F171E3E2300BE77A4 /* Watchdog.h in Headers */ = {isa = PBXBuildFile; fileRef = FED94F2C171E3E2300BE77A4 /* Watchdog.h */; settings = {ATTRIBUTES = (Private, ); }; };
FED94F30171E3E2300BE77A4 /* WatchdogMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FED94F2D171E3E2300BE77A4 /* WatchdogMac.cpp */; };
FEF6835E174343CC00A32E25 /* JITStubsARM.h in Headers */ = {isa = PBXBuildFile; fileRef = FEF6835A174343CC00A32E25 /* JITStubsARM.h */; settings = {ATTRIBUTES = (Private, ); }; };
FEF6835F174343CC00A32E25 /* JITStubsARMv7.h in Headers */ = {isa = PBXBuildFile; fileRef = FEF6835B174343CC00A32E25 /* JITStubsARMv7.h */; settings = {ATTRIBUTES = (Private, ); }; };
FEF68360174343CC00A32E25 /* JITStubsX86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = FEF6835C174343CC00A32E25 /* JITStubsX86_64.h */; settings = {ATTRIBUTES = (Private, ); }; };
FEF68361174343CC00A32E25 /* JITStubsX86.h in Headers */ = {isa = PBXBuildFile; fileRef = FEF6835D174343CC00A32E25 /* JITStubsX86.h */; settings = {ATTRIBUTES = (Private, ); }; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -1969,6 +1973,10 @@
FED94F2B171E3E2300BE77A4 /* Watchdog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Watchdog.cpp; sourceTree = "<group>"; };
FED94F2C171E3E2300BE77A4 /* Watchdog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Watchdog.h; sourceTree = "<group>"; };
FED94F2D171E3E2300BE77A4 /* WatchdogMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WatchdogMac.cpp; sourceTree = "<group>"; };
FEF6835A174343CC00A32E25 /* JITStubsARM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubsARM.h; sourceTree = "<group>"; };
FEF6835B174343CC00A32E25 /* JITStubsARMv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubsARMv7.h; sourceTree = "<group>"; };
FEF6835C174343CC00A32E25 /* JITStubsX86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubsX86_64.h; sourceTree = "<group>"; };
FEF6835D174343CC00A32E25 /* JITStubsX86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITStubsX86.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -2290,6 +2298,10 @@
0F766D1C15A5028D008F363E /* JITStubRoutine.h */,
14A23D6C0F4E19CE0023CDAD /* JITStubs.cpp */,
14A6581A0F4E36F4000150FD /* JITStubs.h */,
FEF6835A174343CC00A32E25 /* JITStubsARM.h */,
FEF6835B174343CC00A32E25 /* JITStubsARMv7.h */,
FEF6835C174343CC00A32E25 /* JITStubsX86_64.h */,
FEF6835D174343CC00A32E25 /* JITStubsX86.h */,
0F5EF91B16878F78003E5C25 /* JITThunks.cpp */,
0F5EF91C16878F78003E5C25 /* JITThunks.h */,
A76F54A213B28AAB00EF2BCE /* JITWriteBarrier.h */,
......@@ -3223,6 +3235,11 @@
0FB7F39515ED8E4600F167B2 /* ArrayConventions.h in Headers */,
0F63945515D07057006A597C /* ArrayProfile.h in Headers */,
BC18C3E70E16F5CD00B34460 /* ArrayPrototype.h in Headers */,
FEF6835F174343CC00A32E25 /* JITStubsARMv7.h in Headers */,
FEF68360174343CC00A32E25 /* JITStubsX86_64.h in Headers */,
FEF6835E174343CC00A32E25 /* JITStubsARM.h in Headers */,
FEF68361174343CC00A32E25 /* JITStubsX86.h in Headers */,
86E3C61D167BABEE006D760A /* JSVirtualMachineInternal.h in Headers */,
BC18C5240E16FC8A00B34460 /* ArrayPrototype.lut.h in Headers */,
0FB7F39615ED8E4600F167B2 /* ArrayStorage.h in Headers */,
9688CB150ED12B4E001D649F /* AssemblerBuffer.h in Headers */,
......
This diff is collapsed.
/*
* Copyright (C) 2008, 2009, 2013 Apple Inc. All rights reserved.
* Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
* Copyright (C) Research In Motion Limited 2010, 2011. 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.
* 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.
*/
#ifndef JITStubsARM_h
#define JITStubsARM_h
#if !CPU(ARM_TRADITIONAL)
#error "JITStubsARM.h should only be #included if CPU(ARM_TRADITIONAL)"
#endif
#if !USE(JSVALUE32_64)
#error "JITStubsARM.h only implements USE(JSVALUE32_64)"
#endif
namespace JSC {
// Also update the MSVC section (defined at DEFINE_STUB_FUNCTION)
// when changing one of the following values.
#define THUNK_RETURN_ADDRESS_OFFSET 64
#define PRESERVEDR4_OFFSET 68
#if COMPILER(GCC)
asm (
".text" "\n"
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
HIDE_SYMBOL(ctiTrampoline) "\n"
INLINE_ARM_FUNCTION(ctiTrampoline)
SYMBOL_STRING(ctiTrampoline) ":" "\n"
"stmdb sp!, {r1-r3}" "\n"
"stmdb sp!, {r4-r6, r8-r11, lr}" "\n"
"sub sp, sp, #" STRINGIZE_VALUE_OF(PRESERVEDR4_OFFSET) "\n"
"mov r5, r2" "\n"
"mov r6, #512" "\n"
// r0 contains the code
"blx r0" "\n"
"add sp, sp, #" STRINGIZE_VALUE_OF(PRESERVEDR4_OFFSET) "\n"
"ldmia sp!, {r4-r6, r8-r11, lr}" "\n"
"add sp, sp, #12" "\n"
"bx lr" "\n"
".globl " SYMBOL_STRING(ctiTrampolineEnd) "\n"
HIDE_SYMBOL(ctiTrampolineEnd) "\n"
SYMBOL_STRING(ctiTrampolineEnd) ":" "\n"
);
asm (
".text" "\n"
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
INLINE_ARM_FUNCTION(ctiVMThrowTrampoline)
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"mov r0, sp" "\n"
"bl " SYMBOL_STRING(cti_vm_throw) "\n"
// Both has the same return sequence
".text" "\n"
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
INLINE_ARM_FUNCTION(ctiOpThrowNotCaught)
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"add sp, sp, #" STRINGIZE_VALUE_OF(PRESERVEDR4_OFFSET) "\n"
"ldmia sp!, {r4-r6, r8-r11, lr}" "\n"
"add sp, sp, #12" "\n"
"bx lr" "\n"
);
#define DEFINE_STUB_FUNCTION(rtype, op) \
extern "C" { \
rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \
}; \
asm ( \
".globl " SYMBOL_STRING(cti_##op) "\n" \
INLINE_ARM_FUNCTION(cti_##op) \
SYMBOL_STRING(cti_##op) ":" "\n" \
"str lr, [sp, #" STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "]" "\n" \
"bl " SYMBOL_STRING(JITStubThunked_##op) "\n" \
"ldr lr, [sp, #" STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "]" "\n" \
"bx lr" "\n" \
); \
rtype JITStubThunked_##op(STUB_ARGS_DECLARATION)
#endif // COMPILER(GCC)
#if COMPILER(RVCT)
__asm EncodedJSValue ctiTrampoline(void*, JSStack*, CallFrame*, void* /*unused1*/, void* /*unused2*/, VM*)
{
ARM
stmdb sp!, {r1-r3}
stmdb sp!, {r4-r6, r8-r11, lr}
sub sp, sp, # PRESERVEDR4_OFFSET
mov r5, r2
mov r6, #512
mov lr, pc
bx r0
add sp, sp, # PRESERVEDR4_OFFSET
ldmia sp!, {r4-r6, r8-r11, lr}
add sp, sp, #12
bx lr
}
__asm void ctiTrampolineEnd()
{
}
__asm void ctiVMThrowTrampoline()
{
ARM
PRESERVE8
mov r0, sp
bl cti_vm_throw
add sp, sp, # PRESERVEDR4_OFFSET
ldmia sp!, {r4-r6, r8-r11, lr}
add sp, sp, #12
bx lr
}
__asm void ctiOpThrowNotCaught()
{
ARM
add sp, sp, # PRESERVEDR4_OFFSET
ldmia sp!, {r4-r8, lr}
add sp, sp, #12
bx lr
}
#define DEFINE_STUB_FUNCTION(rtype, op) rtype JITStubThunked_##op(STUB_ARGS_DECLARATION)
/* The following is a workaround for RVCT toolchain; precompiler macros are not expanded before the code is passed to the assembler */
/* The following section is a template to generate code for GeneratedJITStubs_RVCT.h */
/* The pattern "#xxx#" will be replaced with "xxx" */
/*
RVCT(extern "C" #rtype# JITStubThunked_#op#(STUB_ARGS_DECLARATION);)
RVCT(__asm #rtype# cti_#op#(STUB_ARGS_DECLARATION))
RVCT({)
RVCT( PRESERVE8)
RVCT( IMPORT JITStubThunked_#op#)
RVCT( str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET])
RVCT( bl JITStubThunked_#op#)
RVCT( ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET])
RVCT( bx lr)
RVCT(})
RVCT()
*/
/* Include the generated file */
#include "GeneratedJITStubs_RVCT.h"
#endif // COMPILER(RVCT)
#if COMPILER(MSVC)
#define DEFINE_STUB_FUNCTION(rtype, op) extern "C" rtype JITStubThunked_##op(STUB_ARGS_DECLARATION)
/* The following is a workaround for MSVC toolchain; inline assembler is not supported */
/* The following section is a template to generate code for GeneratedJITStubs_MSVC.asm */
/* The pattern "#xxx#" will be replaced with "xxx" */
/*
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-r6, r8-r11, lr})
MSVC_BEGIN( sub sp, sp, #68 ; sync with PRESERVEDR4_OFFSET)
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-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( bl cti_vm_throw)
MSVC_BEGIN(ctiOpThrowNotCaught)
MSVC_BEGIN( add sp, sp, #68 ; sync with PRESERVEDR4_OFFSET)
MSVC_BEGIN( ldmia sp!, {r4-r6, r8-r11, lr})
MSVC_BEGIN( add sp, sp, #12)
MSVC_BEGIN( bx lr)
MSVC_BEGIN(ctiVMThrowTrampoline ENDP)
MSVC_BEGIN()
MSVC( EXPORT cti_#op#)
MSVC( IMPORT JITStubThunked_#op#)
MSVC(cti_#op# PROC)
MSVC( str lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET)
MSVC( bl JITStubThunked_#op#)
MSVC( ldr lr, [sp, #64] ; sync with THUNK_RETURN_ADDRESS_OFFSET)
MSVC( bx lr)
MSVC(cti_#op# ENDP)
MSVC()
MSVC_END( END)
*/
#endif // COMPILER(MSVC)
static void performARMJITAssertions()
{
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, thunkReturnAddress) == THUNK_RETURN_ADDRESS_OFFSET);
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedR4) == PRESERVEDR4_OFFSET);
}
} // namespace JSC
#endif // JITStubsARM_h
/*
* Copyright (C) 2008, 2009, 2013 Apple Inc. All rights reserved.
* Copyright (C) 2008 Cameron Zwarich <cwzwarich@uwaterloo.ca>
* Copyright (C) Research In Motion Limited 2010, 2011. 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.
* 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.
*/
#ifndef JITStubsARMv7_h
#define JITStubsARMv7_h
#if !CPU(ARM_THUMB2)
#error "JITStubsARMv7.h should only be #included if CPU(ARM_THUMB2)"
#endif
#if !USE(JSVALUE32_64)
#error "JITStubsARMv7.h only implements USE(JSVALUE32_64)"
#endif
namespace JSC {
#define THUNK_RETURN_ADDRESS_OFFSET 0x38
#define PRESERVED_RETURN_ADDRESS_OFFSET 0x3C
#define PRESERVED_R4_OFFSET 0x40
#define PRESERVED_R5_OFFSET 0x44
#define PRESERVED_R6_OFFSET 0x48
#define PRESERVED_R7_OFFSET 0x4C
#define PRESERVED_R8_OFFSET 0x50
#define PRESERVED_R9_OFFSET 0x54
#define PRESERVED_R10_OFFSET 0x58
#define PRESERVED_R11_OFFSET 0x5C
#define REGISTER_FILE_OFFSET 0x60
#define FIRST_STACK_ARGUMENT 0x68
#if COMPILER(GCC)
asm (
".text" "\n"
".align 2" "\n"
".globl " SYMBOL_STRING(ctiTrampoline) "\n"
HIDE_SYMBOL(ctiTrampoline) "\n"
".thumb" "\n"
".thumb_func " THUMB_FUNC_PARAM(ctiTrampoline) "\n"
SYMBOL_STRING(ctiTrampoline) ":" "\n"
"sub sp, sp, #" STRINGIZE_VALUE_OF(FIRST_STACK_ARGUMENT) "\n"
"str lr, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_RETURN_ADDRESS_OFFSET) "]" "\n"
"str r4, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R4_OFFSET) "]" "\n"
"str r5, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R5_OFFSET) "]" "\n"
"str r6, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R6_OFFSET) "]" "\n"
"str r7, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R7_OFFSET) "]" "\n"
"str r8, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R8_OFFSET) "]" "\n"
"str r9, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R9_OFFSET) "]" "\n"
"str r10, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R10_OFFSET) "]" "\n"
"str r11, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R11_OFFSET) "]" "\n"
"str r1, [sp, #" STRINGIZE_VALUE_OF(REGISTER_FILE_OFFSET) "]" "\n"
"mov r5, r2" "\n"
"mov r6, #512" "\n"
"blx r0" "\n"
"ldr r11, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R11_OFFSET) "]" "\n"
"ldr r10, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R10_OFFSET) "]" "\n"
"ldr r9, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R9_OFFSET) "]" "\n"
"ldr r8, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R8_OFFSET) "]" "\n"
"ldr r7, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R7_OFFSET) "]" "\n"
"ldr r6, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R6_OFFSET) "]" "\n"
"ldr r5, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R5_OFFSET) "]" "\n"
"ldr r4, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R4_OFFSET) "]" "\n"
"ldr lr, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_RETURN_ADDRESS_OFFSET) "]" "\n"
"add sp, sp, #" STRINGIZE_VALUE_OF(FIRST_STACK_ARGUMENT) "\n"
"bx lr" "\n"
".align 2" "\n"
".globl " SYMBOL_STRING(ctiTrampolineEnd) "\n"
HIDE_SYMBOL(ctiTrampolineEnd) "\n"
".thumb" "\n"
".thumb_func " THUMB_FUNC_PARAM(ctiTrampolineEnd) "\n"
SYMBOL_STRING(ctiTrampolineEnd) ":" "\n"
);
asm (
".text" "\n"
".align 2" "\n"
".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
HIDE_SYMBOL(ctiVMThrowTrampoline) "\n"
".thumb" "\n"
".thumb_func " THUMB_FUNC_PARAM(ctiVMThrowTrampoline) "\n"
SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
"mov r0, sp" "\n"
"bl " LOCAL_REFERENCE(cti_vm_throw) "\n"
"ldr r11, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R11_OFFSET) "]" "\n"
"ldr r10, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R10_OFFSET) "]" "\n"
"ldr r9, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R9_OFFSET) "]" "\n"
"ldr r8, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R8_OFFSET) "]" "\n"
"ldr r7, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R7_OFFSET) "]" "\n"
"ldr r6, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R6_OFFSET) "]" "\n"
"ldr r5, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R5_OFFSET) "]" "\n"
"ldr r4, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R4_OFFSET) "]" "\n"
"ldr lr, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_RETURN_ADDRESS_OFFSET) "]" "\n"
"add sp, sp, #" STRINGIZE_VALUE_OF(FIRST_STACK_ARGUMENT) "\n"
"bx lr" "\n"
);
asm (
".text" "\n"
".align 2" "\n"
".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
".thumb" "\n"
".thumb_func " THUMB_FUNC_PARAM(ctiOpThrowNotCaught) "\n"
SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
"ldr r11, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R11_OFFSET) "]" "\n"
"ldr r10, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R10_OFFSET) "]" "\n"
"ldr r9, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R9_OFFSET) "]" "\n"
"ldr r8, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R8_OFFSET) "]" "\n"
"ldr r7, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R7_OFFSET) "]" "\n"
"ldr r6, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R6_OFFSET) "]" "\n"
"ldr r5, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R5_OFFSET) "]" "\n"
"ldr r4, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_R4_OFFSET) "]" "\n"
"ldr lr, [sp, #" STRINGIZE_VALUE_OF(PRESERVED_RETURN_ADDRESS_OFFSET) "]" "\n"
"add sp, sp, #" STRINGIZE_VALUE_OF(FIRST_STACK_ARGUMENT) "\n"
"bx lr" "\n"
);
#define DEFINE_STUB_FUNCTION(rtype, op) \
extern "C" { \
rtype JITStubThunked_##op(STUB_ARGS_DECLARATION); \
}; \
asm ( \
".text" "\n" \
".align 2" "\n" \
".globl " SYMBOL_STRING(cti_##op) "\n" \
HIDE_SYMBOL(cti_##op) "\n" \
".thumb" "\n" \
".thumb_func " THUMB_FUNC_PARAM(cti_##op) "\n" \
SYMBOL_STRING(cti_##op) ":" "\n" \
"str lr, [sp, #" STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "]" "\n" \
"bl " SYMBOL_STRING(JITStubThunked_##op) "\n" \
"ldr lr, [sp, #" STRINGIZE_VALUE_OF(THUNK_RETURN_ADDRESS_OFFSET) "]" "\n" \
"bx lr" "\n" \
); \
rtype JITStubThunked_##op(STUB_ARGS_DECLARATION) \
#endif // COMPILER(GCC)
#if COMPILER(RVCT)
__asm EncodedJSValue ctiTrampoline(void*, JSStack*, CallFrame*, void* /*unused1*/, void* /*unused2*/, VM*)
{
PRESERVE8
sub sp, sp, # FIRST_STACK_ARGUMENT
str lr, [sp, # PRESERVED_RETURN_ADDRESS_OFFSET ]
str r4, [sp, # PRESERVED_R4_OFFSET ]
str r5, [sp, # PRESERVED_R5_OFFSET ]
str r6, [sp, # PRESERVED_R6_OFFSET ]
str r7, [sp, # PRESERVED_R7_OFFSET ]
str r8, [sp, # PRESERVED_R8_OFFSET ]
str r9, [sp, # PRESERVED_R9_OFFSET ]
str r10, [sp, # PRESERVED_R10_OFFSET ]
str r11, [sp, # PRESERVED_R11_OFFSET ]
str r1, [sp, # REGISTER_FILE_OFFSET ]
mov r5, r2
mov r6, #512
blx r0
ldr r11, [sp, # PRESERVED_R11_OFFSET ]
ldr r10, [sp, # PRESERVED_R10_OFFSET ]
ldr r9, [sp, # PRESERVED_R9_OFFSET ]
ldr r8, [sp, # PRESERVED_R8_OFFSET ]
ldr r7, [sp, # PRESERVED_R7_OFFSET ]
ldr r6, [sp, # PRESERVED_R6_OFFSET ]
ldr r5, [sp, # PRESERVED_R5_OFFSET ]
ldr r4, [sp, # PRESERVED_R4_OFFSET ]
ldr lr, [sp, # PRESERVED_RETURN_ADDRESS_OFFSET ]
add sp, sp, # FIRST_STACK_ARGUMENT
bx lr
}
__asm void ctiVMThrowTrampoline()
{
PRESERVE8
mov r0, sp
bl cti_vm_throw
ldr r11, [sp, # PRESERVED_R11_OFFSET ]
ldr r10, [sp, # PRESERVED_R10_OFFSET ]
ldr r9, [sp, # PRESERVED_R9_OFFSET ]
ldr r8, [sp, # PRESERVED_R8_OFFSET ]
ldr r7, [sp, # PRESERVED_R7_OFFSET ]
ldr r6, [sp, # PRESERVED_R6_OFFSET ]
ldr r6, [sp, # PRESERVED_R6_OFFSET ]
ldr r5, [sp, # PRESERVED_R5_OFFSET ]
ldr r4, [sp, # PRESERVED_R4_OFFSET ]
ldr lr, [sp, # PRESERVED_RETURN_ADDRESS_OFFSET ]
add sp, sp, # FIRST_STACK_ARGUMENT
bx lr
}
__asm void ctiOpThrowNotCaught()
{
PRESERVE8
ldr r11, [sp, # PRESERVED_R11_OFFSET ]
ldr r10, [sp, # PRESERVED_R10_OFFSET ]
ldr r9, [sp, # PRESERVED_R9_OFFSET ]
ldr r8, [sp, # PRESERVED_R8_OFFSET ]
ldr r7, [sp, # PRESERVED_R7_OFFSET ]
ldr r6, [sp, # PRESERVED_R6_OFFSET ]
ldr r6, [sp, # PRESERVED_R6_OFFSET ]
ldr r5, [sp, # PRESERVED_R5_OFFSET ]
ldr r4, [sp, # PRESERVED_R4_OFFSET ]
ldr lr, [sp, # PRESERVED_RETURN_ADDRESS_OFFSET ]
add sp, sp, # FIRST_STACK_ARGUMENT
bx lr
}
#define DEFINE_STUB_FUNCTION(rtype, op) rtype JITStubThunked_##op(STUB_ARGS_DECLARATION)
/* The following is a workaround for RVCT toolchain; precompiler macros are not expanded before the code is passed to the assembler */
/* The following section is a template to generate code for GeneratedJITStubs_RVCT.h */
/* The pattern "#xxx#" will be replaced with "xxx" */
/*
RVCT(extern "C" #rtype# JITStubThunked_#op#(STUB_ARGS_DECLARATION);)
RVCT(__asm #rtype# cti_#op#(STUB_ARGS_DECLARATION))
RVCT({)
RVCT( PRESERVE8)
RVCT( IMPORT JITStubThunked_#op#)
RVCT( str lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET])
RVCT( bl JITStubThunked_#op#)
RVCT( ldr lr, [sp, # THUNK_RETURN_ADDRESS_OFFSET])
RVCT( bx lr)
RVCT(})
RVCT()
*/
/* Include the generated file */
#include "GeneratedJITStubs_RVCT.h"
#endif // COMPILER(RVCT)
static void performARMv7JITAssertions()
{
// Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it contains non POD types),
// and the OBJECT_OFFSETOF macro does not appear constantish enough for it to be happy with its use in COMPILE_ASSERT
// macros.
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedReturnAddress) == PRESERVED_RETURN_ADDRESS_OFFSET);
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame, preservedR4) == PRESERVED_R4_OFFSET);
ASSERT(OBJECT_OFFSETOF(struct JITStackFrame