Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index 241991cd4b5c5e38dc9eca1bf1e74b05402af8c6..8b079eddd95fddf7ba819bc7804a87930c175ec1 100644 |
--- a/src/arm/full-codegen-arm.cc |
+++ b/src/arm/full-codegen-arm.cc |
@@ -88,31 +88,6 @@ class JumpPatchSite BASE_EMBEDDED { |
}; |
-static void EmitStackCheck(MacroAssembler* masm_, |
- Register stack_limit_scratch, |
- int pointers = 0, |
- Register scratch = sp) { |
- Isolate* isolate = masm_->isolate(); |
- Label ok; |
- ASSERT(scratch.is(sp) == (pointers == 0)); |
- Heap::RootListIndex index; |
- if (pointers != 0) { |
- __ sub(scratch, sp, Operand(pointers * kPointerSize)); |
- index = Heap::kRealStackLimitRootIndex; |
- } else { |
- index = Heap::kStackLimitRootIndex; |
- } |
- __ LoadRoot(stack_limit_scratch, index); |
- __ cmp(scratch, Operand(stack_limit_scratch)); |
- __ b(hs, &ok); |
- Handle<Code> stack_check = isolate->builtins()->StackCheck(); |
- PredictableCodeSizeScope predictable(masm_, |
- masm_->CallSize(stack_check, RelocInfo::CODE_TARGET)); |
- __ Call(stack_check, RelocInfo::CODE_TARGET); |
- __ bind(&ok); |
-} |
- |
- |
// Generate code for a JS function. On entry to the function the receiver |
// and arguments have been pushed on the stack left to right. The actual |
// argument count matches the formal parameter count expected by the |
@@ -180,7 +155,13 @@ void FullCodeGenerator::Generate() { |
ASSERT(!info->function()->is_generator() || locals_count == 0); |
if (locals_count > 0) { |
if (locals_count >= 128) { |
- EmitStackCheck(masm_, r2, locals_count, r9); |
+ Label ok; |
+ __ sub(r9, sp, Operand(locals_count * kPointerSize)); |
+ __ LoadRoot(r2, Heap::kRealStackLimitRootIndex); |
+ __ cmp(r9, Operand(r2)); |
+ __ b(hs, &ok); |
+ __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); |
+ __ bind(&ok); |
} |
__ LoadRoot(r9, Heap::kUndefinedValueRootIndex); |
int kMaxPushes = FLAG_optimize_for_size ? 4 : 32; |
@@ -321,7 +302,15 @@ void FullCodeGenerator::Generate() { |
{ Comment cmnt(masm_, "[ Stack check"); |
PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS); |
- EmitStackCheck(masm_, ip); |
+ Label ok; |
+ __ LoadRoot(ip, Heap::kStackLimitRootIndex); |
+ __ cmp(sp, Operand(ip)); |
+ __ b(hs, &ok); |
+ Handle<Code> stack_check = isolate()->builtins()->StackCheck(); |
+ PredictableCodeSizeScope predictable(masm_, |
+ masm_->CallSize(stack_check, RelocInfo::CODE_TARGET)); |
+ __ Call(stack_check, RelocInfo::CODE_TARGET); |
+ __ bind(&ok); |
} |
{ Comment cmnt(masm_, "[ Body"); |