| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "lithium-allocator-inl.h" | 30 #include "lithium-allocator-inl.h" |
| 31 #include "a64/lithium-a64.h" | 31 #include "a64/lithium-a64.h" |
| 32 #include "a64/lithium-codegen-a64.h" | 32 #include "a64/lithium-codegen-a64.h" |
| 33 #include "hydrogen-osr.h" |
| 33 | 34 |
| 34 namespace v8 { | 35 namespace v8 { |
| 35 namespace internal { | 36 namespace internal { |
| 36 | 37 |
| 37 | 38 |
| 38 #define DEFINE_COMPILE(type) \ | 39 #define DEFINE_COMPILE(type) \ |
| 39 void L##type::CompileToNative(LCodeGen* generator) { \ | 40 void L##type::CompileToNative(LCodeGen* generator) { \ |
| 40 generator->Do##type(this); \ | 41 generator->Do##type(this); \ |
| 41 } | 42 } |
| 42 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) | 43 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 ASSERT(operand->HasFixedPolicy()); | 586 ASSERT(operand->HasFixedPolicy()); |
| 586 return operand; | 587 return operand; |
| 587 } | 588 } |
| 588 | 589 |
| 589 | 590 |
| 590 LPlatformChunk* LChunkBuilder::Build() { | 591 LPlatformChunk* LChunkBuilder::Build() { |
| 591 ASSERT(is_unused()); | 592 ASSERT(is_unused()); |
| 592 chunk_ = new(zone_) LPlatformChunk(info_, graph_); | 593 chunk_ = new(zone_) LPlatformChunk(info_, graph_); |
| 593 LPhase phase("L_Building chunk", chunk_); | 594 LPhase phase("L_Building chunk", chunk_); |
| 594 status_ = BUILDING; | 595 status_ = BUILDING; |
| 596 |
| 597 // If compiling for OSR, reserve space for the unoptimized frame, |
| 598 // which will be subsumed into this frame. |
| 599 if (graph()->has_osr()) { |
| 600 // TODO(all): GetNextSpillIndex just increments a field. It has no other |
| 601 // side effects, so we should get rid of this loop. |
| 602 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { |
| 603 chunk_->GetNextSpillIndex(); |
| 604 } |
| 605 } |
| 606 |
| 595 const ZoneList<HBasicBlock*>* blocks = graph_->blocks(); | 607 const ZoneList<HBasicBlock*>* blocks = graph_->blocks(); |
| 596 for (int i = 0; i < blocks->length(); i++) { | 608 for (int i = 0; i < blocks->length(); i++) { |
| 597 DoBasicBlock(blocks->at(i)); | 609 DoBasicBlock(blocks->at(i)); |
| 598 if (is_aborted()) return NULL; | 610 if (is_aborted()) return NULL; |
| 599 } | 611 } |
| 600 status_ = DONE; | 612 status_ = DONE; |
| 601 return chunk_; | 613 return chunk_; |
| 602 } | 614 } |
| 603 | 615 |
| 604 | 616 |
| (...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2455 return MarkAsCall(DefineFixedDouble(result, d0), instr); | 2467 return MarkAsCall(DefineFixedDouble(result, d0), instr); |
| 2456 } | 2468 } |
| 2457 default: | 2469 default: |
| 2458 UNREACHABLE(); | 2470 UNREACHABLE(); |
| 2459 return NULL; | 2471 return NULL; |
| 2460 } | 2472 } |
| 2461 } | 2473 } |
| 2462 | 2474 |
| 2463 | 2475 |
| 2464 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { | 2476 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
| 2465 int spill_index = chunk_->GetNextSpillIndex(); | 2477 // Use an index that corresponds to the location in the unoptimized frame, |
| 2466 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2478 // which the optimized frame will subsume. |
| 2467 Abort(kTooManySpillSlotsNeededForOSR); | 2479 int env_index = instr->index(); |
| 2468 spill_index = 0; | 2480 int spill_index = 0; |
| 2481 if (instr->environment()->is_parameter_index(env_index)) { |
| 2482 spill_index = chunk_->GetParameterStackSlot(env_index); |
| 2483 } else { |
| 2484 spill_index = env_index - instr->environment()->first_local_index(); |
| 2485 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { |
| 2486 Abort(kTooManySpillSlotsNeededForOSR); |
| 2487 spill_index = 0; |
| 2488 } |
| 2469 } | 2489 } |
| 2470 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2490 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
| 2471 } | 2491 } |
| 2472 | 2492 |
| 2473 | 2493 |
| 2474 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { | 2494 LInstruction* LChunkBuilder::DoUseConst(HUseConst* instr) { |
| 2475 return NULL; | 2495 return NULL; |
| 2476 } | 2496 } |
| 2477 | 2497 |
| 2478 | 2498 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2516 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2536 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2517 LOperand* receiver = UseRegister(instr->receiver()); | 2537 LOperand* receiver = UseRegister(instr->receiver()); |
| 2518 LOperand* function = UseRegisterAtStart(instr->function()); | 2538 LOperand* function = UseRegisterAtStart(instr->function()); |
| 2519 LOperand* temp = TempRegister(); | 2539 LOperand* temp = TempRegister(); |
| 2520 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); | 2540 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); |
| 2521 return AssignEnvironment(DefineAsRegister(result)); | 2541 return AssignEnvironment(DefineAsRegister(result)); |
| 2522 } | 2542 } |
| 2523 | 2543 |
| 2524 | 2544 |
| 2525 } } // namespace v8::internal | 2545 } } // namespace v8::internal |
| OLD | NEW |