| Index: src/x64/lithium-x64.cc
|
| diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc
|
| index 4153417473e24e4dfc2d915799b294dc3c4413d5..e4b86fdecd4922d31e1445a87b3a46b72622b396 100644
|
| --- a/src/x64/lithium-x64.cc
|
| +++ b/src/x64/lithium-x64.cc
|
| @@ -32,6 +32,7 @@
|
| #include "lithium-allocator-inl.h"
|
| #include "x64/lithium-x64.h"
|
| #include "x64/lithium-codegen-x64.h"
|
| +#include "hydrogen-osr.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
| @@ -449,6 +450,15 @@ LPlatformChunk* LChunkBuilder::Build() {
|
| chunk_ = new(zone()) LPlatformChunk(info(), graph());
|
| LPhase phase("L_Building chunk", chunk_);
|
| status_ = BUILDING;
|
| +
|
| + // If compiling for OSR, reserve space for the unoptimized frame,
|
| + // which will be subsumed into this frame.
|
| + if (graph()->has_osr()) {
|
| + for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) {
|
| + chunk_->GetNextSpillIndex(false);
|
| + }
|
| + }
|
| +
|
| const ZoneList<HBasicBlock*>* blocks = graph()->blocks();
|
| for (int i = 0; i < blocks->length(); i++) {
|
| HBasicBlock* next = NULL;
|
| @@ -2397,10 +2407,18 @@ LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
|
|
|
|
|
| LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
|
| - int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width.
|
| - if (spill_index > LUnallocated::kMaxFixedSlotIndex) {
|
| - Abort("Too many spill slots needed for OSR");
|
| - spill_index = 0;
|
| + // Use an index that corresponds to the location in the unoptimized frame,
|
| + // which the optimized frame will subsume.
|
| + int env_index = instr->index();
|
| + int spill_index = 0;
|
| + if (instr->environment()->is_parameter_index(env_index)) {
|
| + spill_index = chunk()->GetParameterStackSlot(env_index);
|
| + } else {
|
| + spill_index = env_index - instr->environment()->first_local_index();
|
| + if (spill_index > LUnallocated::kMaxFixedSlotIndex) {
|
| + Abort("Too many spill slots needed for OSR");
|
| + spill_index = 0;
|
| + }
|
| }
|
| return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index);
|
| }
|
|
|