2008-10-07 Gavin Barraclough <barraclough@apple.com>
Reviewed by Oliver Hunt.
Move callframe initialization into JIT code, again.
As a part of the restructuring the second result from functions is now
returned in edx, allowing the new value of 'r' to be returned via a
register, and stored to the stack from JIT code, too.
4.5% progression on v8-tests. (3% in their harness)
* VM/CTI.cpp:
(JSC::):
(JSC::CTI::emitCall):
(JSC::CTI::compileOpCall):
(JSC::CTI::privateCompileMainPass):
(JSC::CTI::privateCompileSlowCases):
(JSC::CTI::privateCompile):
* VM/CTI.h:
(JSC::CallRecord::CallRecord):
* VM/Machine.cpp:
(JSC::Machine::cti_op_call_JSFunction):
(JSC::Machine::cti_op_construct_JSConstruct):
(JSC::Machine::cti_op_resolve_func):
(JSC::Machine::cti_op_post_inc):
(JSC::Machine::cti_op_resolve_with_base):
(JSC::Machine::cti_op_post_dec):
* VM/Machine.h:
* kjs/JSFunction.h:
* kjs/ScopeChain.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37386 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/VM/CTI.h b/JavaScriptCore/VM/CTI.h
index a44da1d..b79e5ec 100644
--- a/JavaScriptCore/VM/CTI.h
+++ b/JavaScriptCore/VM/CTI.h
@@ -45,8 +45,6 @@
#define ARGS (&args)
#endif
-#define CTI_ARGS_2ndResult 0x08
-
#define CTI_ARGS_code 0x0C
#define CTI_ARGS_registerFile 0x0D
#define CTI_ARGS_r 0x0E
@@ -62,7 +60,6 @@
#define ARG_exec CallFrame::create(ARG_r)
#define ARG_setR(newR) (*(Register**)&(ARGS)[CTI_ARGS_r] = newR)
-#define ARG_set2ndResult(new2ndResult) (*(JSValue**)&(ARGS)[CTI_ARGS_2ndResult] = new2ndResult)
#define ARG_src1 ((JSValue*)((ARGS)[1]))
#define ARG_src2 ((JSValue*)((ARGS)[2]))
@@ -108,11 +105,14 @@
struct Instruction;
struct OperandTypes;
+ struct VoidPtrPair { void* first; void* second; };
+
typedef JSValue* (*CTIHelper_j)(CTI_ARGS);
typedef JSPropertyNameIterator* (*CTIHelper_p)(CTI_ARGS);
typedef void (*CTIHelper_v)(CTI_ARGS);
typedef void* (*CTIHelper_s)(CTI_ARGS);
typedef int (*CTIHelper_b)(CTI_ARGS);
+ typedef VoidPtrPair (*CTIHelper_2)(CTI_ARGS);
struct CallRecord {
X86Assembler::JmpSrc from;
@@ -158,6 +158,13 @@
{
}
+ CallRecord(X86Assembler::JmpSrc f, CTIHelper_2 t, unsigned i)
+ : from(f)
+ , to((void*)t)
+ , opcodeIndex(i)
+ {
+ }
+
CallRecord(X86Assembler::JmpSrc f, unsigned i)
: from(f)
, to(0)
@@ -350,6 +357,7 @@
enum CompileOpCallType { OpCallNormal, OpCallEval, OpConstruct };
void compileOpCall(Instruction* instruction, unsigned i, CompileOpCallType type = OpCallNormal);
+ void compileOpCallInitializeCallFrame(unsigned callee, unsigned argCount);
enum CompileOpStrictEqType { OpStrictEq, OpNStrictEq };
void compileOpStrictEq(Instruction* instruction, unsigned i, CompileOpStrictEqType type);
void putDoubleResultToJSNumberCellOrJSImmediate(X86::XMMRegisterID xmmSource, X86::RegisterID jsNumberCell, unsigned dst, X86Assembler::JmpSrc* wroteJSNumberCell, X86::XMMRegisterID tempXmm, X86::RegisterID tempReg1, X86::RegisterID tempReg2);
@@ -392,10 +400,11 @@
X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, X86::RegisterID);
X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_j);
X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_p);
- X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_b);
X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_v);
X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_s);
-
+ X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_b);
+ X86Assembler::JmpSrc emitCall(unsigned opcodeIndex, CTIHelper_2);
+
void emitGetVariableObjectRegister(X86Assembler::RegisterID variableObject, int index, X86Assembler::RegisterID dst);
void emitPutVariableObjectRegister(X86Assembler::RegisterID src, X86Assembler::RegisterID variableObject, int index);