| Index: src/a64/lithium-a64.cc
|
| diff --git a/src/a64/lithium-a64.cc b/src/a64/lithium-a64.cc
|
| index 66778d355f2c258c93865b758c4e667c04a054ae..2002835145838c538c6ad486c3370c82dbfb2765 100644
|
| --- a/src/a64/lithium-a64.cc
|
| +++ b/src/a64/lithium-a64.cc
|
| @@ -30,6 +30,7 @@
|
| #include "lithium-allocator-inl.h"
|
| #include "a64/lithium-a64.h"
|
| #include "a64/lithium-codegen-a64.h"
|
| +#include "hydrogen-osr.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
| @@ -592,6 +593,17 @@ 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()) {
|
| + // TODO(all): GetNextSpillIndex just increments a field. It has no other
|
| + // side effects, so we should get rid of this loop.
|
| + for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) {
|
| + chunk_->GetNextSpillIndex();
|
| + }
|
| + }
|
| +
|
| const ZoneList<HBasicBlock*>* blocks = graph_->blocks();
|
| for (int i = 0; i < blocks->length(); i++) {
|
| DoBasicBlock(blocks->at(i));
|
| @@ -2462,10 +2474,18 @@ LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
|
|
|
|
|
| LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) {
|
| - int spill_index = chunk_->GetNextSpillIndex();
|
| - if (spill_index > LUnallocated::kMaxFixedSlotIndex) {
|
| - Abort(kTooManySpillSlotsNeededForOSR);
|
| - 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(kTooManySpillSlotsNeededForOSR);
|
| + spill_index = 0;
|
| + }
|
| }
|
| return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index);
|
| }
|
|
|