Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index c085fa058883c13ec81a9718b4a7bc08f30a6c58..4e1ac86aefcd18b8d754458b060eeea17812a23c 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -185,16 +185,27 @@ bool LCodeGen::GeneratePrologue() { |
SaveCallerDoubles(); |
} |
} |
+ return !is_aborted(); |
+} |
+ |
+ |
+void LCodeGen::DoPrologue(LPrologue* instr) { |
+ Comment(";;; Prologue begin"); |
// Possibly allocate a local context. |
- int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
- if (heap_slots > 0) { |
+ if (info_->num_heap_slots() > 0) { |
Comment(";;; Allocate local context"); |
bool need_write_barrier = true; |
// Argument to NewContext is the function, which is still in rdi. |
- DCHECK(!info()->scope()->is_script_scope()); |
- if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
- FastNewContextStub stub(isolate(), heap_slots); |
+ int slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
+ Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
+ if (info()->scope()->is_script_scope()) { |
+ __ Push(rdi); |
+ __ Push(info()->scope()->GetScopeInfo(info()->isolate())); |
+ __ CallRuntime(Runtime::kNewScriptContext, 2); |
+ deopt_mode = Safepoint::kLazyDeopt; |
+ } else if (slots <= FastNewContextStub::kMaximumSlots) { |
+ FastNewContextStub stub(isolate(), slots); |
__ CallStub(&stub); |
// Result of FastNewContextStub is always in new space. |
need_write_barrier = false; |
@@ -202,7 +213,8 @@ bool LCodeGen::GeneratePrologue() { |
__ Push(rdi); |
__ CallRuntime(Runtime::kNewFunctionContext, 1); |
} |
- RecordSafepoint(Safepoint::kNoLazyDeopt); |
+ RecordSafepoint(deopt_mode); |
+ |
// Context is returned in rax. It replaces the context passed to us. |
// It's saved in the stack and kept live in rsi. |
__ movp(rsi, rax); |
@@ -235,11 +247,7 @@ bool LCodeGen::GeneratePrologue() { |
Comment(";;; End allocate local context"); |
} |
- // Trace the call. |
- if (FLAG_trace && info()->IsOptimizing()) { |
- __ CallRuntime(Runtime::kTraceEnter, 0); |
- } |
- return !is_aborted(); |
+ Comment(";;; Prologue end"); |
} |