Index: src/crankshaft/x64/lithium-codegen-x64.cc |
diff --git a/src/crankshaft/x64/lithium-codegen-x64.cc b/src/crankshaft/x64/lithium-codegen-x64.cc |
index 6ff918fd54b2b13b757df9db56e5249ef35db991..00c989787e086bf9ce26e92da9455a17dbf238ef 100644 |
--- a/src/crankshaft/x64/lithium-codegen-x64.cc |
+++ b/src/crankshaft/x64/lithium-codegen-x64.cc |
@@ -179,11 +179,16 @@ void LCodeGen::DoPrologue(LPrologue* instr) { |
__ CallRuntime(Runtime::kNewScriptContext); |
deopt_mode = Safepoint::kLazyDeopt; |
} else { |
- 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); |
+ } |
} |
RecordSafepoint(deopt_mode); |