Commit 1a4da971 authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Stack checks in generated code for function apply is now controlled

by the check-stack flag. Changed the condition code from greater to
above_equal as the SP should be unsigned (this matches the stack
check in function entry).
Review URL: http://codereview.chromium.org/4296

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@384 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0b02000d
...@@ -517,21 +517,23 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { ...@@ -517,21 +517,23 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
// Eagerly check for stack-overflow before pushing all the arguments // Eagerly check for stack-overflow before pushing all the arguments
// to the stack. // to the stack.
Label okay; if (FLAG_check_stack) {
__ lea(ecx, Operand(esp, -3 * kPointerSize)); // receiver, limit, index Label okay;
__ mov(edx, Operand(eax)); __ lea(ecx, Operand(esp, -3 * kPointerSize)); // receiver, limit, index
__ shl(edx, kPointerSizeLog2 - kSmiTagSize); __ mov(edx, Operand(eax));
__ sub(ecx, Operand(edx)); __ shl(edx, kPointerSizeLog2 - kSmiTagSize);
ExternalReference stack_guard_limit_address = __ sub(ecx, Operand(edx));
ExternalReference::address_of_stack_guard_limit(); ExternalReference stack_guard_limit_address =
__ cmp(ecx, Operand::StaticVariable(stack_guard_limit_address)); ExternalReference::address_of_stack_guard_limit();
__ j(greater, &okay, taken); __ cmp(ecx, Operand::StaticVariable(stack_guard_limit_address));
__ j(greater, &okay, taken);
// Too bad: Out of stack space.
__ push(Operand(ebp, 4 * kPointerSize)); // push this // Too bad: Out of stack space.
__ push(eax); __ push(Operand(ebp, 4 * kPointerSize)); // push this
__ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION); __ push(eax);
__ bind(&okay); __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION);
__ bind(&okay);
}
// Push current index and limit. // Push current index and limit.
const int kLimitOffset = const int kLimitOffset =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment