Index: src/full-codegen/x64/full-codegen-x64.cc |
diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc |
index 05daaac458d4c37de185e1d8e1040b2cd880ea1c..c7dbe0f6bdb086b24184580cfadd4874c10e7d76 100644 |
--- a/src/full-codegen/x64/full-codegen-x64.cc |
+++ b/src/full-codegen/x64/full-codegen-x64.cc |
@@ -189,11 +189,16 @@ void FullCodeGenerator::Generate() { |
if (info->scope()->new_target_var() != nullptr) { |
__ Push(rdx); // Preserve new target. |
} |
- FastNewFunctionContextStub stub(isolate()); |
- __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); |
- __ CallStub(&stub); |
- // Result of FastNewFunctionContextStub is always in new space. |
- need_write_barrier = false; |
+ if (slots <= FastNewFunctionContextStub::kMaximumSlots) { |
+ FastNewFunctionContextStub stub(isolate()); |
+ __ Set(FastNewFunctionContextDescriptor::SlotsRegister(), slots); |
+ __ CallStub(&stub); |
+ // Result of FastNewFunctionContextStub is always in new space. |
+ need_write_barrier = false; |
+ } else { |
+ __ Push(rdi); |
+ __ CallRuntime(Runtime::kNewFunctionContext); |
+ } |
if (info->scope()->new_target_var() != nullptr) { |
__ Pop(rdx); // Restore new target. |
} |