JavaScriptCore:
2008-09-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by Cameron Zwarich.
Store the callee ScopeChain, not the caller ScopeChain, in the call frame
header. Nix the "scopeChain" local variable and ExecState::m_scopeChain, and
access the callee ScopeChain through the call frame header instead.
Profit: call + return are simpler, because they don't have to update the
"scopeChain" local variable, or ExecState::m_scopeChain.
Because CTI keeps "r" in a register, reading the callee ScopeChain relative
to "r" can be very fast, in any cases we care to optimize.
0% speedup on empty function call benchmark. (5.5% speedup in bytecode.)
0% speedup on SunSpider. (7.5% speedup on controlflow-recursive.)
2% speedup on SunSpider --v8.
2% speedup on v8 benchmark.
* VM/CTI.cpp: Changed scope chain access to read the scope chain from
the call frame header. Sped up op_ret by changing it not to fuss with
the "scopeChain" local variable or ExecState::m_scopeChain.
* VM/CTI.h: Updated CTI trampolines not to take a ScopeChainNode*
argument, since that's stored in the call frame header now.
* VM/Machine.cpp: Access "scopeChain" and "codeBlock" through new helper
functions that read from the call frame header. Updated functions operating
on ExecState::m_callFrame to account for / take advantage of the fact that
Exec:m_callFrame is now never NULL.
Fixed a bug in op_construct, where it would use the caller's default
object prototype, rather than the callee's, when constructing a new object.
* VM/Machine.h: Made some helper functions available. Removed
ScopeChainNode* arguments to a lot of functions, since the ScopeChainNode*
is now stored in the call frame header.
* VM/RegisterFile.h: Renamed "CallerScopeChain" to "ScopeChain", since
that's what it is now.
* kjs/DebuggerCallFrame.cpp: Updated for change to ExecState signature.
* kjs/ExecState.cpp:
* kjs/ExecState.h: Nixed ExecState::m_callFrame, along with the unused
isGlobalObject function.
* kjs/JSGlobalObject.cpp:
* kjs/JSGlobalObject.h: Gave the global object a fake call frame in
which to store the global scope chain, since our code now assumes that
it can always read the scope chain out of the ExecState's call frame.
JavaScriptGlue:
2008-09-29 Geoffrey Garen <ggaren@apple.com>
Not reviewed.
Forwarding headers to fix the build.
* ForwardingHeaders/kjs/CTI.h: Copied from ForwardingHeaders/kjs/ExecState.h.
* ForwardingHeaders/kjs/ustring.h: Copied from ForwardingHeaders/kjs/ExecState.h.
* ForwardingHeaders/masm: Added.
* ForwardingHeaders/masm/X86Assembler.h: Added.
* ForwardingHeaders/profiler: Added.
* ForwardingHeaders/profiler/Profiler.h: Added.
LayoutTests:
2008-09-29 Geoffrey Garen <ggaren@apple.com>
Reviewed by Cameron Zwarich.
Test case for which prototype is used when calling "new" across windows.
* fast/js/construct-global-object-expected.txt: Added.
* fast/js/construct-global-object.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/VM/CTI.h b/JavaScriptCore/VM/CTI.h
index ac8473b..b2b76c7 100644
--- a/JavaScriptCore/VM/CTI.h
+++ b/JavaScriptCore/VM/CTI.h
@@ -55,17 +55,14 @@
#define CTI_ARGS_exec 0x0D
#define CTI_ARGS_registerFile 0x0E
#define CTI_ARGS_r 0x0F
-#define CTI_ARGS_scopeChain 0x10
-#define CTI_ARGS_exception 0x11
-#define CTI_ARGS_profilerReference 0x12
+#define CTI_ARGS_exception 0x10
+#define CTI_ARGS_profilerReference 0x11
#define ARG_exec ((ExecState*)(ARGS)[CTI_ARGS_exec])
#define ARG_registerFile ((RegisterFile*)(ARGS)[CTI_ARGS_registerFile])
#define ARG_r ((Register*)(ARGS)[CTI_ARGS_r])
-#define ARG_scopeChain ((ScopeChainNode*)(ARGS)[CTI_ARGS_scopeChain])
#define ARG_exception ((JSValue**)(ARGS)[CTI_ARGS_exception])
#define ARG_profilerReference ((Profiler**)(ARGS)[CTI_ARGS_profilerReference])
-#define ARG_setScopeChain(newScopeChain) (*(volatile ScopeChainNode**)&(ARGS)[CTI_ARGS_scopeChain] = newScopeChain)
#define ARG_setR(newR) (*(volatile Register**)&(ARGS)[CTI_ARGS_r] = newR)
#define ARG_set2ndResult(new2ndResult) (*(volatile JSValue**)&(ARGS)[CTI_ARGS_2ndResult] = new2ndResult)
@@ -235,7 +232,7 @@
};
extern "C" {
- JSValue* ctiTrampoline(void* code, ExecState* exec, RegisterFile* registerFile, Register* r, ScopeChainNode* scopeChain, JSValue** exception, Profiler**);
+ JSValue* ctiTrampoline(void* code, ExecState* exec, RegisterFile* registerFile, Register* r, JSValue** exception, Profiler**);
void ctiVMThrowTrampoline();
};
@@ -319,9 +316,9 @@
return cti.privateCompilePatchGetArrayLength(returnAddress);
}
- inline static JSValue* execute(void* code, ExecState* exec, RegisterFile* registerFile, Register* r, ScopeChainNode* scopeChain, JSValue** exception)
+ inline static JSValue* execute(void* code, ExecState* exec, RegisterFile* registerFile, Register* r, JSValue** exception)
{
- JSValue* value = ctiTrampoline(code, exec, registerFile, r, scopeChain, exception, Profiler::enabledProfilerReference());
+ JSValue* value = ctiTrampoline(code, exec, registerFile, r, exception, Profiler::enabledProfilerReference());
#if ENABLE(SAMPLING_TOOL)
currentOpcodeID = static_cast<OpcodeID>(-1);
#endif
@@ -356,7 +353,7 @@
void compileBinaryArithOp(OpcodeID, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi, unsigned i);
void compileBinaryArithOpSlowCase(OpcodeID, Vector<SlowCaseEntry>::iterator& iter, unsigned dst, unsigned src1, unsigned src2, OperandTypes opi, unsigned i);
- void emitGetArg(unsigned src, X86Assembler::RegisterID dst);
+ void emitGetArg(int src, X86Assembler::RegisterID dst);
void emitGetPutArg(unsigned src, unsigned offset, X86Assembler::RegisterID scratch);
void emitPutArg(X86Assembler::RegisterID src, unsigned offset);
void emitPutArgConstant(unsigned value, unsigned offset);