Add optimize call and property access support for ARM JIT.
https://bugs.webkit.org/show_bug.cgi?id=24986
Patch by Gabor Loki <loki@inf.u-szeged.hu> on 2009-08-12
Reviewed by Gavin Barraclough.
For tightly coupled sequences the BEGIN_UNINTERRUPTED_SEQUENCE and
END_UNINTERRUPTED_SEQUENCE macros have been introduced which ensure
space for instructions and constants of the named sequence. This
method is vital for those architecture which are using constant pool.
The 'latePatch' method - which was linked to JmpSrc - is replaced with
a port specific solution (each calls are marked to place their address
on the constant pool).
* assembler/ARMAssembler.cpp:
(JSC::ARMAssembler::linkBranch):
(JSC::ARMAssembler::executableCopy): Add extra align for constant pool.
* assembler/ARMAssembler.h:
(JSC::ARMAssembler::JmpSrc::JmpSrc):
(JSC::ARMAssembler::sizeOfConstantPool):
(JSC::ARMAssembler::jmp):
(JSC::ARMAssembler::linkCall):
* assembler/ARMv7Assembler.h:
* assembler/AbstractMacroAssembler.h:
* assembler/AssemblerBufferWithConstantPool.h:
(JSC::AssemblerBufferWithConstantPool::flushIfNoSpaceFor): Fix the
computation of the remaining space.
* assembler/MacroAssemblerARM.h:
(JSC::MacroAssemblerARM::branch32):
(JSC::MacroAssemblerARM::nearCall):
(JSC::MacroAssemblerARM::call):
(JSC::MacroAssemblerARM::branchPtrWithPatch):
(JSC::MacroAssemblerARM::ensureSpace):
(JSC::MacroAssemblerARM::sizeOfConstantPool):
(JSC::MacroAssemblerARM::prepareCall):
* assembler/X86Assembler.h:
* jit/JIT.h:
* jit/JITCall.cpp:
(JSC::JIT::compileOpCall):
* jit/JITInlineMethods.h:
(JSC::JIT::beginUninterruptedSequence):
(JSC::JIT::endUninterruptedSequence):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emit_op_method_check):
(JSC::JIT::compileGetByIdHotPath):
(JSC::JIT::compileGetByIdSlowCase):
(JSC::JIT::emit_op_put_by_id):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47186 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/jit/JIT.h b/JavaScriptCore/jit/JIT.h
index 93f47d9..7638372 100644
--- a/JavaScriptCore/jit/JIT.h
+++ b/JavaScriptCore/jit/JIT.h
@@ -595,9 +595,62 @@
static const int patchOffsetMethodCheckProtoObj = 18;
static const int patchOffsetMethodCheckProtoStruct = 28;
static const int patchOffsetMethodCheckPutFunction = 46;
+#elif PLATFORM(ARM)
+ // These architecture specific value are used to enable patching - see comment on op_put_by_id.
+ static const int patchOffsetPutByIdStructure = 4;
+ static const int patchOffsetPutByIdExternalLoad = 16;
+ static const int patchLengthPutByIdExternalLoad = 4;
+ static const int patchOffsetPutByIdPropertyMapOffset = 20;
+ // These architecture specific value are used to enable patching - see comment on op_get_by_id.
+ static const int patchOffsetGetByIdStructure = 4;
+ static const int patchOffsetGetByIdBranchToSlowCase = 16;
+ static const int patchOffsetGetByIdExternalLoad = 16;
+ static const int patchLengthGetByIdExternalLoad = 4;
+ static const int patchOffsetGetByIdPropertyMapOffset = 20;
+ static const int patchOffsetGetByIdPutResult = 28;
+#if ENABLE(OPCODE_SAMPLING)
+ #error "OPCODE_SAMPLING is not yet supported"
+#else
+ static const int patchOffsetGetByIdSlowCaseCall = 36;
+#endif
+ static const int patchOffsetOpCallCompareToJump = 12;
+
+ static const int patchOffsetMethodCheckProtoObj = 12;
+ static const int patchOffsetMethodCheckProtoStruct = 20;
+ static const int patchOffsetMethodCheckPutFunction = 32;
#endif
#endif // USE(JSVALUE32_64)
+#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)
+ // sequenceOpCall
+ static const int sequenceOpCallInstructionSpace = 12;
+ static const int sequenceOpCallConstantSpace = 2;
+ // sequenceMethodCheck
+ static const int sequenceMethodCheckInstructionSpace = 40;
+ static const int sequenceMethodCheckConstantSpace = 6;
+ // sequenceGetByIdHotPath
+ static const int sequenceGetByIdHotPathInstructionSpace = 28;
+ static const int sequenceGetByIdHotPathConstantSpace = 3;
+ // sequenceGetByIdSlowCase
+ static const int sequenceGetByIdSlowCaseInstructionSpace = 40;
+ static const int sequenceGetByIdSlowCaseConstantSpace = 2;
+ // sequencePutById
+ static const int sequencePutByIdInstructionSpace = 28;
+ static const int sequencePutByIdConstantSpace = 3;
+#endif
+
+#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
+#define BEGIN_UNINTERRUPTED_SEQUENCE(name) beginUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace)
+#define END_UNINTERRUPTED_SEQUENCE(name) endUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace)
+
+ void beginUninterruptedSequence(int, int);
+ void endUninterruptedSequence(int, int);
+
+#else
+#define BEGIN_UNINTERRUPTED_SEQUENCE(name)
+#define END_UNINTERRUPTED_SEQUENCE(name)
+#endif
+
void emit_op_add(Instruction*);
void emit_op_bitand(Instruction*);
void emit_op_bitnot(Instruction*);
@@ -835,6 +888,13 @@
int m_lastResultBytecodeRegister;
unsigned m_jumpTargetsPosition;
#endif
+
+#ifndef NDEBUG
+#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL
+ Label m_uninterruptedInstructionSequenceBegin;
+ int m_uninterruptedConstantSequenceBegin;
+#endif
+#endif
} JIT_CLASS_ALIGNMENT;
} // namespace JSC