Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 0f72e2944ad293b544dd735d20ee37e223b10ee6..f897c0d14adfdae42cf0f5cb7ac30acf9756e86b 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -32,6 +32,7 @@ |
#include "x64/lithium-codegen-x64.h" |
#include "code-stubs.h" |
#include "stub-cache.h" |
+#include "hydrogen-osr.h" |
namespace v8 { |
namespace internal { |
@@ -252,6 +253,21 @@ bool LCodeGen::GeneratePrologue() { |
} |
+void LCodeGen::GenerateOsrPrologue() { |
+ // Generate the OSR entry prologue at the first unknown OSR value, or if there |
+ // are none, at the OSR entrypoint instruction. |
+ if (osr_pc_offset_ >= 0) return; |
+ |
+ osr_pc_offset_ = masm()->pc_offset(); |
+ |
+ // Adjust the frame size, subsuming the unoptimized frame into the |
+ // optimized frame. |
+ int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); |
+ ASSERT(slots >= 0); |
+ __ subq(rsp, Immediate(slots * kPointerSize)); |
+} |
+ |
+ |
bool LCodeGen::GenerateBody() { |
ASSERT(is_generating()); |
bool emit_instructions = true; |
@@ -940,8 +956,7 @@ void LCodeGen::DoCallStub(LCallStub* instr) { |
void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { |
- // Record the address of the first unknown OSR value as the place to enter. |
- if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); |
+ GenerateOsrPrologue(); |
} |
@@ -5485,9 +5500,7 @@ void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
ASSERT(!environment->HasBeenRegistered()); |
RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
- // Normally we record the first unknown OSR value as the entrypoint to the OSR |
- // code, but if there were none, record the entrypoint here. |
- if (osr_pc_offset_ == -1) osr_pc_offset_ = masm()->pc_offset(); |
+ GenerateOsrPrologue(); |
} |