| Index: src/arm/full-codegen-arm.cc
|
| diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
|
| index 885f3ba2759493b761341418ca03e3b12a5f3023..b5d160b8ea173b2675fd22eb0c320cdc260c6d6c 100644
|
| --- a/src/arm/full-codegen-arm.cc
|
| +++ b/src/arm/full-codegen-arm.cc
|
| @@ -155,15 +155,7 @@ void FullCodeGenerator::Generate() {
|
| // Generators allocate locals, if any, in context slots.
|
| DCHECK(!IsGeneratorFunction(info->function()->kind()) || locals_count == 0);
|
| if (locals_count > 0) {
|
| - if (locals_count >= 128) {
|
| - 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);
|
| - }
|
| + EmitPreemptiveStackCheck(locals_count);
|
| __ LoadRoot(r9, Heap::kUndefinedValueRootIndex);
|
| int kMaxPushes = FLAG_optimize_for_size ? 4 : 32;
|
| if (locals_count >= kMaxPushes) {
|
| @@ -3035,6 +3027,9 @@ void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) {
|
| // Load the arguments.
|
| ZoneList<Expression*>* args = expr->arguments();
|
| int arg_count = args->length();
|
| +
|
| + EmitPreemptiveStackCheck(arg_count);
|
| +
|
| { PreservePositionScope scope(masm()->positions_recorder());
|
| for (int i = 0; i < arg_count; i++) {
|
| VisitForStackValue(args->at(i));
|
| @@ -5216,6 +5211,19 @@ void FullCodeGenerator::EmitLiteralCompareNil(CompareOperation* expr,
|
| }
|
|
|
|
|
| +void FullCodeGenerator::EmitPreemptiveStackCheck(int required_stack_size) {
|
| + if (required_stack_size >= 128) {
|
| + Label ok;
|
| + __ sub(r9, sp, Operand(required_stack_size * kPointerSize));
|
| + __ LoadRoot(r2, Heap::kRealStackLimitRootIndex);
|
| + __ cmp(r9, Operand(r2));
|
| + __ b(hs, &ok);
|
| + __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION);
|
| + __ bind(&ok);
|
| + }
|
| +}
|
| +
|
| +
|
| void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) {
|
| __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
|
| context()->Plug(r0);
|
|
|