| Index: src/ia32/lithium-codegen-ia32.cc
|
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
|
| index ef3761e51e7a8a5d53c59b26966f43f29273e2e6..515eb5de7717ac07efe466e1baf55269991b6ff4 100644
|
| --- a/src/ia32/lithium-codegen-ia32.cc
|
| +++ b/src/ia32/lithium-codegen-ia32.cc
|
| @@ -35,6 +35,7 @@
|
| #include "deoptimizer.h"
|
| #include "stub-cache.h"
|
| #include "codegen.h"
|
| +#include "hydrogen-osr.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
| @@ -327,6 +328,28 @@ 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();
|
| +
|
| + // Save the first local, which is overwritten by the alignment state.
|
| + Operand alignment_loc = MemOperand(ebp, -3 * kPointerSize);
|
| + __ push(alignment_loc);
|
| +
|
| + // Set the dynamic frame alignment state to "not aligned".
|
| + __ mov(alignment_loc, Immediate(kNoAlignmentPadding));
|
| +
|
| + // Adjust the frame size, subsuming the unoptimized frame into the
|
| + // optimized frame.
|
| + int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots();
|
| + ASSERT(slots >= 1);
|
| + __ sub(esp, Immediate((slots - 1) * kPointerSize));
|
| +}
|
| +
|
| +
|
| bool LCodeGen::GenerateBody() {
|
| ASSERT(is_generating());
|
| bool emit_instructions = true;
|
| @@ -1250,8 +1273,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();
|
| }
|
|
|
|
|
| @@ -6438,9 +6460,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();
|
| }
|
|
|
|
|
|
|