Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index bc34cfafe08e08b3075ff8ae2b377c2393223255..bc201718d146cffcbc4b5008a01774d5c76d6ddc 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -31,6 +31,7 @@ |
#include "arm/lithium-gap-resolver-arm.h" |
#include "code-stubs.h" |
#include "stub-cache.h" |
+#include "hydrogen-osr.h" |
namespace v8 { |
namespace internal { |
@@ -253,6 +254,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); |
+ __ sub(sp, sp, Operand(slots * kPointerSize)); |
+} |
+ |
+ |
bool LCodeGen::GenerateBody() { |
ASSERT(is_generating()); |
bool emit_instructions = true; |
@@ -1098,8 +1114,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(); |
} |
@@ -5684,9 +5699,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(); |
} |