Index: src/full-codegen/x87/full-codegen-x87.cc |
diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc |
index e07a7e6ba894a24c5b24b384888aec1cc06d09af..ebac0b8c161e36b4d3b28d3a16686cc279bcc2e3 100644 |
--- a/src/full-codegen/x87/full-codegen-x87.cc |
+++ b/src/full-codegen/x87/full-codegen-x87.cc |
@@ -189,12 +189,17 @@ void FullCodeGenerator::Generate() { |
if (info->scope()->new_target_var() != nullptr) { |
__ push(edx); // Preserve new target. |
} |
- FastNewFunctionContextStub stub(isolate()); |
- __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), |
- Immediate(slots)); |
- __ CallStub(&stub); |
- // Result of FastNewFunctionContextStub is always in new space. |
- need_write_barrier = false; |
+ if (slots <= FastNewFunctionContextStub::kMaximumSlots) { |
+ FastNewFunctionContextStub stub(isolate()); |
+ __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), |
+ Immediate(slots)); |
+ __ CallStub(&stub); |
+ // Result of FastNewFunctionContextStub is always in new space. |
+ need_write_barrier = false; |
+ } else { |
+ __ push(edi); |
+ __ CallRuntime(Runtime::kNewFunctionContext); |
+ } |
if (info->scope()->new_target_var() != nullptr) { |
__ pop(edx); // Restore new target. |
} |