Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (153231 => 153232)
--- trunk/Source/_javascript_Core/ChangeLog 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-07-25 04:03:10 UTC (rev 153232)
@@ -1,5 +1,45 @@
2013-06-19 Michael Saboff <[email protected]>
+ fourthTier: Arity fixup should be done while on same stack
+ https://bugs.webkit.org/show_bug.cgi?id=117102
+
+ Reviewed by Oliver Hunt.
+
+ Removed the fixup part of op_call_arityCheck() and op_construct_arityCheck() and moved it to
+ a thunk for the JITs and as assembly for the llint. This patch provides the plumbing needed to
+ move to the C stack for JS execution. The fixup thunk and llint code would need to be change to
+ work with a stack that grows down when we do move to the C stack.
+
+ Due to an issue with the offline assembler, I moved the const at the top of LowLevelInterpreter64.asm
+ and LowLevelInterpreter32_64.asm to LowLevelInterpreter.asm. The problem is that a const defined in
+ one file that are used in a macro doesn't resolve the const if the macro is used in another file. This
+ seemed like the quickest path.
+
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::compileFunction):
+ (JSC::DFG::JITCompiler::linkFunction):
+ * dfg/DFGJITCompiler.h:
+ (JITCompiler):
+ * ftl/FTLLink.cpp:
+ (JSC::FTL::link):
+ * jit/JIT.cpp:
+ (JSC::JIT::privateCompile):
+ * jit/JITStubs.cpp:
+ (JSC::DEFINE_STUB_FUNCTION):
+ * jit/JITStubs.h:
+ * jit/ThunkGenerators.cpp:
+ (JSC::arityFixup):
+ * jit/ThunkGenerators.h:
+ * llint/LowLevelInterpreter.asm:
+ * llint/LowLevelInterpreter32_64.asm:
+ * llint/LowLevelInterpreter64.asm:
+ * runtime/CommonSlowPaths.cpp:
+ (JSC::SLOW_PATH_DECL):
+ * runtime/CommonSlowPaths.h:
+ (JSC::CommonSlowPaths::arityCheckFor):
+
+2013-06-19 Michael Saboff <[email protected]>
+
FTL: arm build is broken in ToT
https://bugs.webkit.org/show_bug.cgi?id=117800
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp (153231 => 153232)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2013-07-25 04:03:10 UTC (rev 153232)
@@ -387,7 +387,10 @@
beginCall(CodeOrigin(0), token);
m_callArityCheck = call();
notifyCall(m_callArityCheck, CodeOrigin(0), token);
- move(GPRInfo::regT0, GPRInfo::callFrameRegister);
+ branchTest32(Zero, GPRInfo::regT0).linkTo(fromArityCheck, this);
+ beginCall(CodeOrigin(0), token);
+ m_callArityFixup = call();
+ notifyCall(m_callArityFixup, CodeOrigin(0), token);
jump(fromArityCheck);
// Generate slow path code.
@@ -418,6 +421,7 @@
// FIXME: switch the stack check & arity check over to DFGOpertaion style calls, not JIT stubs.
linkBuffer->link(m_callStackCheck, cti_stack_check);
linkBuffer->link(m_callArityCheck, m_codeBlock->m_isConstructor ? cti_op_construct_arityCheck : cti_op_call_arityCheck);
+ linkBuffer->link(m_callArityFixup, FunctionPtr((m_vm->getCTIStub(arityFixup)).code().executableAddress()));
disassemble(*linkBuffer);
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h (153231 => 153232)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h 2013-07-25 04:03:10 UTC (rev 153232)
@@ -520,6 +520,7 @@
Call m_callStackCheck;
Call m_callArityCheck;
+ Call m_callArityFixup;
Label m_arityCheck;
OwnPtr<SpeculativeJIT> m_speculative;
};
Modified: trunk/Source/_javascript_Core/ftl/FTLLink.cpp (153231 => 153232)
--- trunk/Source/_javascript_Core/ftl/FTLLink.cpp 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/ftl/FTLLink.cpp 2013-07-25 04:03:10 UTC (rev 153232)
@@ -120,12 +120,14 @@
// FIXME: need to make this call register with exception handling somehow. This is
// part of a bigger problem: FTL should be able to handle exceptions.
// https://bugs.webkit.org/show_bug.cgi?id=113622
- jit.move(GPRInfo::regT0, GPRInfo::callFrameRegister);
+ jit.branchTest32(CCallHelpers::Zero, GPRInfo::regT0).linkTo(fromArityCheck, &jit);
+ CCallHelpers::Call callArityFixup = jit.call();
jit.jump(fromArityCheck);
OwnPtr<LinkBuffer> linkBuffer = adoptPtr(new LinkBuffer(state.graph.m_vm, &jit, codeBlock, JITCompilationMustSucceed));
linkBuffer->link(callStackCheck, cti_stack_check);
linkBuffer->link(callArityCheck, codeBlock->m_isConstructor ? cti_op_construct_arityCheck : cti_op_call_arityCheck);
+ linkBuffer->link(callArityFixup, FunctionPtr((state.graph.m_vm.getCTIStub(arityFixup)).code().executableAddress()));
state.finalizer->initializeEntrypointLinkBuffer(linkBuffer.release());
state.finalizer->initializeFunction(state.generatedFunction);
Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (153231 => 153232)
--- trunk/Source/_javascript_Core/jit/JIT.cpp 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp 2013-07-25 04:03:10 UTC (rev 153232)
@@ -649,7 +649,11 @@
branch32(AboveOrEqual, regT1, TrustedImm32(m_codeBlock->m_numParameters)).linkTo(beginLabel, this);
m_bytecodeOffset = 0;
- JITStubCall(this, m_codeBlock->m_isConstructor ? cti_op_construct_arityCheck : cti_op_call_arityCheck).call(callFrameRegister);
+
+ JITStubCall(this, m_codeBlock->m_isConstructor ? cti_op_construct_arityCheck : cti_op_call_arityCheck).call(regT0);
+ branchTest32(Zero, regT0).linkTo(beginLabel, this);
+ emitNakedCall(m_vm->getCTIStub(arityFixup).code());
+
#if !ASSERT_DISABLED
m_bytecodeOffset = (unsigned)-1; // Reset this, in order to guard its use with ASSERTs.
#endif
Modified: trunk/Source/_javascript_Core/jit/JITStubs.cpp (153231 => 153232)
--- trunk/Source/_javascript_Core/jit/JITStubs.cpp 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/jit/JITStubs.cpp 2013-07-25 04:03:10 UTC (rev 153232)
@@ -1222,32 +1222,32 @@
return result;
}
-DEFINE_STUB_FUNCTION(void*, op_call_arityCheck)
+DEFINE_STUB_FUNCTION(int, op_call_arityCheck)
{
STUB_INIT_STACK_FRAME(stackFrame);
CallFrame* callFrame = stackFrame.callFrame;
- CallFrame* newCallFrame = CommonSlowPaths::arityCheckFor(callFrame, stackFrame.stack, CodeForCall);
- if (!newCallFrame) {
+ int missingArgCount = CommonSlowPaths::arityCheckFor(callFrame, stackFrame.stack, CodeForCall);
+ if (missingArgCount < 0) {
ErrorWithExecFunctor functor = ErrorWithExecFunctor(createStackOverflowError);
- return throwExceptionFromOpCall<void*>(stackFrame, callFrame, STUB_RETURN_ADDRESS, functor);
+ return throwExceptionFromOpCall<int>(stackFrame, callFrame, STUB_RETURN_ADDRESS, functor);
}
- return newCallFrame;
+ return missingArgCount;
}
-DEFINE_STUB_FUNCTION(void*, op_construct_arityCheck)
+DEFINE_STUB_FUNCTION(int, op_construct_arityCheck)
{
STUB_INIT_STACK_FRAME(stackFrame);
CallFrame* callFrame = stackFrame.callFrame;
- CallFrame* newCallFrame = CommonSlowPaths::arityCheckFor(callFrame, stackFrame.stack, CodeForConstruct);
- if (!newCallFrame) {
+ int missingArgCount = CommonSlowPaths::arityCheckFor(callFrame, stackFrame.stack, CodeForConstruct);
+ if (missingArgCount < 0) {
ErrorWithExecFunctor functor = ErrorWithExecFunctor(createStackOverflowError);
- return throwExceptionFromOpCall<void*>(stackFrame, callFrame, STUB_RETURN_ADDRESS, functor);
+ return throwExceptionFromOpCall<int>(stackFrame, callFrame, STUB_RETURN_ADDRESS, functor);
}
- return newCallFrame;
+ return missingArgCount;
}
inline void* lazyLinkFor(CallFrame* callFrame, CodeSpecializationKind kind)
Modified: trunk/Source/_javascript_Core/jit/JITStubs.h (153231 => 153232)
--- trunk/Source/_javascript_Core/jit/JITStubs.h 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/jit/JITStubs.h 2013-07-25 04:03:10 UTC (rev 153232)
@@ -398,8 +398,8 @@
#if ENABLE(DFG_JIT)
void JIT_STUB cti_optimize(STUB_ARGS_DECLARATION) WTF_INTERNAL;
#endif
-void* JIT_STUB cti_op_call_arityCheck(STUB_ARGS_DECLARATION) WTF_INTERNAL;
-void* JIT_STUB cti_op_construct_arityCheck(STUB_ARGS_DECLARATION) WTF_INTERNAL;
+int JIT_STUB cti_op_call_arityCheck(STUB_ARGS_DECLARATION) WTF_INTERNAL;
+int JIT_STUB cti_op_construct_arityCheck(STUB_ARGS_DECLARATION) WTF_INTERNAL;
void* JIT_STUB cti_op_call_jitCompile(STUB_ARGS_DECLARATION) WTF_INTERNAL;
void* JIT_STUB cti_op_construct_jitCompile(STUB_ARGS_DECLARATION) WTF_INTERNAL;
void* JIT_STUB cti_op_switch_char(STUB_ARGS_DECLARATION) WTF_INTERNAL;
Modified: trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp (153231 => 153232)
--- trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp 2013-07-25 04:03:10 UTC (rev 153232)
@@ -27,6 +27,7 @@
#include "ThunkGenerators.h"
#include "CodeBlock.h"
+#include "JSStack.h"
#include "Operations.h"
#include "SpecializedThunkJIT.h"
#include <wtf/InlineASM.h>
@@ -418,6 +419,84 @@
return nativeForGenerator(vm, CodeForConstruct);
}
+MacroAssemblerCodeRef arityFixup(VM* vm)
+{
+ JSInterfaceJIT jit;
+
+ // We enter with fixup count in regT0
+#if USE(JSVALUE64)
+# if CPU(X86_64)
+ jit.pop(JSInterfaceJIT::regT4);
+# endif
+ jit.addPtr(JSInterfaceJIT::TrustedImm32(-8), JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::regT3);
+ jit.load32(JSInterfaceJIT::Address(JSInterfaceJIT::callFrameRegister, JSStack::ArgumentCount * 8), JSInterfaceJIT::regT2);
+ jit.add32(JSInterfaceJIT::TrustedImm32(JSStack::CallFrameHeaderSize), JSInterfaceJIT::regT2);
+
+ // Move current frame regT0 number of slots
+ JSInterfaceJIT::Label copyLoop(jit.label());
+ jit.load64(JSInterfaceJIT::regT3, JSInterfaceJIT::regT1);
+ jit.store64(JSInterfaceJIT::regT1, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::regT0, JSInterfaceJIT::TimesEight));
+ jit.subPtr(JSInterfaceJIT::TrustedImm32(8), JSInterfaceJIT::regT3);
+ jit.branchSub32(MacroAssembler::NonZero, JSInterfaceJIT::TrustedImm32(1), JSInterfaceJIT::regT2).linkTo(copyLoop, &jit);
+
+ // Fill in regT0 missing arg slots with undefined
+ jit.move(JSInterfaceJIT::regT0, JSInterfaceJIT::regT2);
+ jit.move(JSInterfaceJIT::TrustedImm64(ValueUndefined), JSInterfaceJIT::regT1);
+ JSInterfaceJIT::Label fillUndefinedLoop(jit.label());
+ jit.store64(JSInterfaceJIT::regT1, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::regT0, JSInterfaceJIT::TimesEight));
+ jit.subPtr(JSInterfaceJIT::TrustedImm32(8), JSInterfaceJIT::regT3);
+ jit.branchSub32(MacroAssembler::NonZero, JSInterfaceJIT::TrustedImm32(1), JSInterfaceJIT::regT2).linkTo(fillUndefinedLoop, &jit);
+
+ // Adjust call frame register to account for missing args
+ jit.lshift32(JSInterfaceJIT::TrustedImm32(3), JSInterfaceJIT::regT0);
+ jit.addPtr(JSInterfaceJIT::regT0, JSInterfaceJIT::callFrameRegister);
+
+# if CPU(X86_64)
+ jit.push(JSInterfaceJIT::regT4);
+# endif
+ jit.ret();
+#else
+# if CPU(X86)
+ jit.pop(JSInterfaceJIT::regT4);
+# endif
+ jit.addPtr(JSInterfaceJIT::TrustedImm32(-8), JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::regT3);
+ jit.load32(JSInterfaceJIT::Address(JSInterfaceJIT::callFrameRegister, JSStack::ArgumentCount * 8), JSInterfaceJIT::regT2);
+ jit.add32(JSInterfaceJIT::TrustedImm32(JSStack::CallFrameHeaderSize), JSInterfaceJIT::regT2);
+
+ // Move current frame regT0 number of slots
+ JSInterfaceJIT::Label copyLoop(jit.label());
+ jit.load32(JSInterfaceJIT::regT3, JSInterfaceJIT::regT1);
+ jit.store32(JSInterfaceJIT::regT1, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::regT0, JSInterfaceJIT::TimesEight));
+ jit.load32(MacroAssembler::Address(JSInterfaceJIT::regT3, 4), JSInterfaceJIT::regT1);
+ jit.store32(JSInterfaceJIT::regT1, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::regT0, JSInterfaceJIT::TimesEight, 4));
+ jit.subPtr(JSInterfaceJIT::TrustedImm32(8), JSInterfaceJIT::regT3);
+ jit.branchSub32(MacroAssembler::NonZero, JSInterfaceJIT::TrustedImm32(1), JSInterfaceJIT::regT2).linkTo(copyLoop, &jit);
+
+ // Fill in regT0 missing arg slots with undefined
+ jit.move(JSInterfaceJIT::regT0, JSInterfaceJIT::regT2);
+ JSInterfaceJIT::Label fillUndefinedLoop(jit.label());
+ jit.move(JSInterfaceJIT::TrustedImm32(0), JSInterfaceJIT::regT1);
+ jit.store32(JSInterfaceJIT::regT1, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::regT0, JSInterfaceJIT::TimesEight));
+ jit.move(JSInterfaceJIT::TrustedImm32(JSValue::UndefinedTag), JSInterfaceJIT::regT1);
+ jit.store32(JSInterfaceJIT::regT1, MacroAssembler::BaseIndex(JSInterfaceJIT::regT3, JSInterfaceJIT::regT0, JSInterfaceJIT::TimesEight, 4));
+
+ jit.subPtr(JSInterfaceJIT::TrustedImm32(8), JSInterfaceJIT::regT3);
+ jit.branchSub32(MacroAssembler::NonZero, JSInterfaceJIT::TrustedImm32(1), JSInterfaceJIT::regT2).linkTo(fillUndefinedLoop, &jit);
+
+ // Adjust call frame register to account for missing args
+ jit.lshift32(JSInterfaceJIT::TrustedImm32(3), JSInterfaceJIT::regT0);
+ jit.addPtr(JSInterfaceJIT::regT0, JSInterfaceJIT::callFrameRegister);
+
+# if CPU(X86)
+ jit.push(JSInterfaceJIT::regT4);
+# endif
+ jit.ret();
+#endif
+
+ LinkBuffer patchBuffer(*vm, &jit, GLOBAL_THUNK_ID);
+ return FINALIZE_CODE(patchBuffer, ("fixup arity"));
+}
+
static void stringCharLoad(SpecializedThunkJIT& jit, VM* vm)
{
// load string
Modified: trunk/Source/_javascript_Core/jit/ThunkGenerators.h (153231 => 153232)
--- trunk/Source/_javascript_Core/jit/ThunkGenerators.h 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/jit/ThunkGenerators.h 2013-07-25 04:03:10 UTC (rev 153232)
@@ -39,6 +39,7 @@
MacroAssemblerCodeRef stringLengthTrampolineGenerator(VM*);
MacroAssemblerCodeRef nativeCallGenerator(VM*);
MacroAssemblerCodeRef nativeConstructGenerator(VM*);
+MacroAssemblerCodeRef arityFixup(VM*);
MacroAssemblerCodeRef charCodeAtThunkGenerator(VM*);
MacroAssemblerCodeRef charAtThunkGenerator(VM*);
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (153231 => 153232)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2013-07-25 04:03:10 UTC (rev 153232)
@@ -32,6 +32,7 @@
# These declarations must match interpreter/JSStack.h.
const CallFrameHeaderSize = 48
+const CallFrameHeaderSlots = 6
const ArgumentCount = -48
const CallerFrame = -40
const Callee = -32
@@ -41,6 +42,27 @@
const ThisArgumentOffset = -CallFrameHeaderSize - 8
+# Some value representation constants.
+if JSVALUE64
+const TagBitTypeOther = 0x2
+const TagBitBool = 0x4
+const TagBitUndefined = 0x8
+const ValueEmpty = 0x0
+const ValueFalse = TagBitTypeOther | TagBitBool
+const ValueTrue = TagBitTypeOther | TagBitBool | 1
+const ValueUndefined = TagBitTypeOther | TagBitUndefined
+const ValueNull = TagBitTypeOther
+else
+const Int32Tag = -1
+const BooleanTag = -2
+const NullTag = -3
+const UndefinedTag = -4
+const CellTag = -5
+const EmptyValueTag = -6
+const DeletedValueTag = -7
+const LowestTag = DeletedValueTag
+end
+
# Some register conventions.
if JSVALUE64
# - Use a pair of registers to represent the PC: one register for the
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (153231 => 153232)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm 2013-07-25 04:03:10 UTC (rev 153232)
@@ -70,18 +70,6 @@
# Below we have a bunch of constant declarations. Each constant must have
# a corresponding ASSERT() in LLIntData.cpp.
-
-# Value representation constants.
-const Int32Tag = -1
-const BooleanTag = -2
-const NullTag = -3
-const UndefinedTag = -4
-const CellTag = -5
-const EmptyValueTag = -6
-const DeletedValueTag = -7
-const LowestTag = DeletedValueTag
-
-
# Utilities
macro dispatch(advance)
addp advance * 4, PC
@@ -320,11 +308,38 @@
loadi PayloadOffset + ArgumentCount[cfr], t0
biaeq t0, CodeBlock::m_numParameters[t1], doneLabel
cCall2(slow_path, cfr, PC) # This slow_path has a simple protocol: t0 = 0 => no error, t0 != 0 => error
- move t1, cfr
- btiz t0, .continue
+ btiz t0, .isArityFixupNeeded
loadp JITStackFrame::vm[sp], t1
loadp VM::callFrameForThrow[t1], t0
jmp VM::targetMachinePCForThrow[t1]
+.isArityFixupNeeded:
+ btiz t1, .continue
+
+ // Move frame down "t1" slots
+ move cfr, t3
+ subp 8, t3
+ loadi PayloadOffset + ArgumentCount[cfr], t2
+ addi CallFrameHeaderSlots, t2
+.copyLoop:
+ loadi PayloadOffset[t3], t0
+ storei t0, PayloadOffset[t3, t1, 8]
+ loadi TagOffset[t3], t0
+ storei t0, TagOffset[t3, t1, 8]
+ subp 8, t3
+ bsubinz 1, t2, .copyLoop
+
+ // Fill new slots with JSUndefined
+ move t1, t2
+.fillLoop:
+ move 0, t0
+ storei t0, PayloadOffset[t3, t1, 8]
+ move UndefinedTag, t0
+ storei t0, TagOffset[t3, t1, 8]
+ subp 8, t3
+ bsubinz 1, t2, .fillLoop
+
+ lshiftp 3, t1
+ addp t1, cfr
.continue:
# Reload CodeBlock and PC, since the slow_path clobbered it.
loadp CodeBlock[cfr], t1
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (153231 => 153232)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm 2013-07-25 04:03:10 UTC (rev 153232)
@@ -22,16 +22,6 @@
# THE POSSIBILITY OF SUCH DAMAGE.
-# Some value representation constants.
-const TagBitTypeOther = 0x2
-const TagBitBool = 0x4
-const TagBitUndefined = 0x8
-const ValueEmpty = 0x0
-const ValueFalse = TagBitTypeOther | TagBitBool
-const ValueTrue = TagBitTypeOther | TagBitBool | 1
-const ValueUndefined = TagBitTypeOther | TagBitUndefined
-const ValueNull = TagBitTypeOther
-
# Utilities.
macro jumpToInstruction()
jmp [PB, PC, 8]
@@ -205,11 +195,35 @@
biaeq t0, CodeBlock::m_numParameters[t1], doneLabel
prepareStateForCCall()
cCall2(slow_path, cfr, PC) # This slow_path has a simple protocol: t0 = 0 => no error, t0 != 0 => error
- move t1, cfr
- btiz t0, .continue
+ btiz t0, .isArityFixupNeeded
loadp JITStackFrame::vm[sp], t1
loadp VM::callFrameForThrow[t1], t0
jmp VM::targetMachinePCForThrow[t1]
+.isArityFixupNeeded:
+ btiz t1, .continue
+
+ // Move frame down "t1" slots
+ move cfr, t3
+ subp 8, t3
+ loadi PayloadOffset + ArgumentCount[cfr], t2
+ addi CallFrameHeaderSlots, t2
+.copyLoop:
+ loadq [t3], t0
+ storeq t0, [t3, t1, 8]
+ subp 8, t3
+ bsubinz 1, t2, .copyLoop
+
+ // Fill new slots with JSUndefined
+ move t1, t2
+ move ValueUndefined, t0
+.fillLoop:
+ storeq t0, [t3, t1, 8]
+ subp 8, t3
+ bsubinz 1, t2, .fillLoop
+
+ lshiftp 3, t1
+ addp t1, cfr
+
.continue:
# Reload CodeBlock and reset PC, since the slow_path clobbered them.
loadp CodeBlock[cfr], t1
Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp (153231 => 153232)
--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp 2013-07-25 04:03:10 UTC (rev 153232)
@@ -166,29 +166,29 @@
SLOW_PATH_DECL(slow_path_call_arityCheck)
{
BEGIN();
- ExecState* newExec = CommonSlowPaths::arityCheckFor(exec, &vm.interpreter->stack(), CodeForCall);
- if (!newExec) {
+ int SlotsToAdd = CommonSlowPaths::arityCheckFor(exec, &vm.interpreter->stack(), CodeForCall);
+ if (SlotsToAdd < 0) {
ReturnAddressPtr returnPC = exec->returnPC();
exec = exec->callerFrame();
vm.exception = createStackOverflowError(exec);
LLInt::interpreterThrowInCaller(exec, returnPC);
RETURN_TWO(bitwise_cast<void*>(static_cast<uintptr_t>(1)), exec);
}
- RETURN_TWO(0, newExec);
+ RETURN_TWO(0, reinterpret_cast<ExecState*>(SlotsToAdd));
}
SLOW_PATH_DECL(slow_path_construct_arityCheck)
{
BEGIN();
- ExecState* newExec = CommonSlowPaths::arityCheckFor(exec, &vm.interpreter->stack(), CodeForConstruct);
- if (!newExec) {
+ int SlotsToAdd = CommonSlowPaths::arityCheckFor(exec, &vm.interpreter->stack(), CodeForConstruct);
+ if (SlotsToAdd < 0) {
ReturnAddressPtr returnPC = exec->returnPC();
exec = exec->callerFrame();
vm.exception = createStackOverflowError(exec);
LLInt::interpreterThrowInCaller(exec, returnPC);
RETURN_TWO(bitwise_cast<void*>(static_cast<uintptr_t>(1)), exec);
}
- RETURN_TWO(0, newExec);
+ RETURN_TWO(0, reinterpret_cast<ExecState*>(SlotsToAdd));
}
SLOW_PATH_DECL(slow_path_create_arguments)
Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h (153231 => 153232)
--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h 2013-07-25 04:03:07 UTC (rev 153231)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.h 2013-07-25 04:03:10 UTC (rev 153232)
@@ -45,36 +45,22 @@
namespace CommonSlowPaths {
-ALWAYS_INLINE ExecState* arityCheckFor(ExecState* exec, JSStack* stack, CodeSpecializationKind kind)
+ALWAYS_INLINE int arityCheckFor(ExecState* exec, JSStack* stack, CodeSpecializationKind kind)
{
JSFunction* callee = jsCast<JSFunction*>(exec->callee());
ASSERT(!callee->isHostFunction());
CodeBlock* newCodeBlock = &callee->jsExecutable()->generatedBytecodeFor(kind);
int argumentCountIncludingThis = exec->argumentCountIncludingThis();
-
+
// This ensures enough space for the worst case scenario of zero arguments passed by the caller.
if (!stack->grow(exec->registers() + newCodeBlock->numParameters() + newCodeBlock->m_numCalleeRegisters))
- return 0;
-
+ return -1;
+
ASSERT(argumentCountIncludingThis < newCodeBlock->numParameters());
-
- // Too few arguments -- copy call frame and arguments, then fill in missing arguments with undefined.
- size_t delta = newCodeBlock->numParameters() - argumentCountIncludingThis;
- Register* src = ""
- Register* dst = exec->registers() + delta;
-
- int i;
- int end = -ExecState::offsetFor(argumentCountIncludingThis);
- for (i = -1; i >= end; --i)
- dst[i] = src[i];
-
- end -= delta;
- for ( ; i >= end; --i)
- dst[i] = jsUndefined();
-
- ExecState* newExec = ExecState::create(dst);
- ASSERT((void*)newExec <= stack->end());
- return newExec;
+
+ // Too few arguments, return the number of missing arguments so the caller can
+ // grow the frame in place and fill in undefined values for the missing args.
+ return(newCodeBlock->numParameters() - argumentCountIncludingThis);
}
inline bool opIn(ExecState* exec, JSValue propName, JSValue baseVal)