| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 26 matching lines...) Expand all Loading... |
| 37 namespace internal { | 37 namespace internal { |
| 38 | 38 |
| 39 #define DEFINE_COMPILE(type) \ | 39 #define DEFINE_COMPILE(type) \ |
| 40 void L##type::CompileToNative(LCodeGen* generator) { \ | 40 void L##type::CompileToNative(LCodeGen* generator) { \ |
| 41 generator->Do##type(this); \ | 41 generator->Do##type(this); \ |
| 42 } | 42 } |
| 43 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) | 43 LITHIUM_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE) |
| 44 #undef DEFINE_COMPILE | 44 #undef DEFINE_COMPILE |
| 45 | 45 |
| 46 LOsrEntry::LOsrEntry() { | 46 LOsrEntry::LOsrEntry() { |
| 47 for (int i = 0; i < Register::kNumAllocatableRegisters; ++i) { | 47 for (int i = 0; i < Register::NumAllocatableRegisters(); ++i) { |
| 48 register_spills_[i] = NULL; | 48 register_spills_[i] = NULL; |
| 49 } | 49 } |
| 50 for (int i = 0; i < DoubleRegister::kNumAllocatableRegisters; ++i) { | 50 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); ++i) { |
| 51 double_register_spills_[i] = NULL; | 51 double_register_spills_[i] = NULL; |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 void LOsrEntry::MarkSpilledRegister(int allocation_index, | 56 void LOsrEntry::MarkSpilledRegister(int allocation_index, |
| 57 LOperand* spill_operand) { | 57 LOperand* spill_operand) { |
| 58 ASSERT(spill_operand->IsStackSlot()); | 58 ASSERT(spill_operand->IsStackSlot()); |
| 59 ASSERT(register_spills_[allocation_index] == NULL); | 59 ASSERT(register_spills_[allocation_index] == NULL); |
| 60 register_spills_[allocation_index] = spill_operand; | 60 register_spills_[allocation_index] = spill_operand; |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 432 } |
| 433 | 433 |
| 434 | 434 |
| 435 LPlatformChunk* LChunkBuilder::Build() { | 435 LPlatformChunk* LChunkBuilder::Build() { |
| 436 ASSERT(is_unused()); | 436 ASSERT(is_unused()); |
| 437 chunk_ = new(zone()) LPlatformChunk(info(), graph()); | 437 chunk_ = new(zone()) LPlatformChunk(info(), graph()); |
| 438 HPhase phase("L_Building chunk", chunk_); | 438 HPhase phase("L_Building chunk", chunk_); |
| 439 status_ = BUILDING; | 439 status_ = BUILDING; |
| 440 | 440 |
| 441 // Reserve the first spill slot for the state of dynamic alignment. | 441 // Reserve the first spill slot for the state of dynamic alignment. |
| 442 int alignment_state_index = chunk_->GetNextSpillIndex(false); | 442 if (info()->IsOptimizing()) { |
| 443 ASSERT_EQ(alignment_state_index, 0); | 443 int alignment_state_index = chunk_->GetNextSpillIndex(false); |
| 444 USE(alignment_state_index); | 444 ASSERT_EQ(alignment_state_index, 0); |
| 445 USE(alignment_state_index); |
| 446 } |
| 445 | 447 |
| 446 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); | 448 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); |
| 447 for (int i = 0; i < blocks->length(); i++) { | 449 for (int i = 0; i < blocks->length(); i++) { |
| 448 HBasicBlock* next = NULL; | 450 HBasicBlock* next = NULL; |
| 449 if (i < blocks->length() - 1) next = blocks->at(i + 1); | 451 if (i < blocks->length() - 1) next = blocks->at(i + 1); |
| 450 DoBasicBlock(blocks->at(i), next); | 452 DoBasicBlock(blocks->at(i), next); |
| 451 if (is_aborted()) return NULL; | 453 if (is_aborted()) return NULL; |
| 452 } | 454 } |
| 453 status_ = DONE; | 455 status_ = DONE; |
| 454 return chunk_; | 456 return chunk_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 466 Register::ToAllocationIndex(reg)); | 468 Register::ToAllocationIndex(reg)); |
| 467 } | 469 } |
| 468 | 470 |
| 469 | 471 |
| 470 LUnallocated* LChunkBuilder::ToUnallocated(XMMRegister reg) { | 472 LUnallocated* LChunkBuilder::ToUnallocated(XMMRegister reg) { |
| 471 return new(zone()) LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER, | 473 return new(zone()) LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER, |
| 472 XMMRegister::ToAllocationIndex(reg)); | 474 XMMRegister::ToAllocationIndex(reg)); |
| 473 } | 475 } |
| 474 | 476 |
| 475 | 477 |
| 478 LUnallocated* LChunkBuilder::ToUnallocated(X87TopOfStackProxyRegister reg) { |
| 479 return new(zone()) LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER, |
| 480 X87TopOfStackProxyRegister::ToAllocationIndex(reg)); |
| 481 } |
| 482 |
| 483 |
| 476 LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) { | 484 LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) { |
| 477 return Use(value, ToUnallocated(fixed_register)); | 485 return Use(value, ToUnallocated(fixed_register)); |
| 478 } | 486 } |
| 479 | 487 |
| 480 | 488 |
| 481 LOperand* LChunkBuilder::UseFixedDouble(HValue* value, XMMRegister reg) { | 489 LOperand* LChunkBuilder::UseFixedDouble(HValue* value, XMMRegister reg) { |
| 482 return Use(value, ToUnallocated(reg)); | 490 return Use(value, ToUnallocated(reg)); |
| 483 } | 491 } |
| 484 | 492 |
| 485 | 493 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 | 606 |
| 599 | 607 |
| 600 template<int I, int T> | 608 template<int I, int T> |
| 601 LInstruction* LChunkBuilder::DefineFixedDouble( | 609 LInstruction* LChunkBuilder::DefineFixedDouble( |
| 602 LTemplateInstruction<1, I, T>* instr, | 610 LTemplateInstruction<1, I, T>* instr, |
| 603 XMMRegister reg) { | 611 XMMRegister reg) { |
| 604 return Define(instr, ToUnallocated(reg)); | 612 return Define(instr, ToUnallocated(reg)); |
| 605 } | 613 } |
| 606 | 614 |
| 607 | 615 |
| 616 template<int I, int T> |
| 617 LInstruction* LChunkBuilder::DefineX87TOS( |
| 618 LTemplateInstruction<1, I, T>* instr) { |
| 619 return Define(instr, ToUnallocated(x87tos)); |
| 620 } |
| 621 |
| 622 |
| 608 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { | 623 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { |
| 609 HEnvironment* hydrogen_env = current_block_->last_environment(); | 624 HEnvironment* hydrogen_env = current_block_->last_environment(); |
| 610 int argument_index_accumulator = 0; | 625 int argument_index_accumulator = 0; |
| 611 instr->set_environment(CreateEnvironment(hydrogen_env, | 626 instr->set_environment(CreateEnvironment(hydrogen_env, |
| 612 &argument_index_accumulator)); | 627 &argument_index_accumulator)); |
| 613 return instr; | 628 return instr; |
| 614 } | 629 } |
| 615 | 630 |
| 616 | 631 |
| 617 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, | 632 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, |
| 618 HInstruction* hinstr, | 633 HInstruction* hinstr, |
| 619 CanDeoptimize can_deoptimize) { | 634 CanDeoptimize can_deoptimize) { |
| 635 info()->MarkAsNonDeferredCalling(); |
| 636 |
| 620 #ifdef DEBUG | 637 #ifdef DEBUG |
| 621 instr->VerifyCall(); | 638 instr->VerifyCall(); |
| 622 #endif | 639 #endif |
| 623 instr->MarkAsCall(); | 640 instr->MarkAsCall(); |
| 624 instr = AssignPointerMap(instr); | 641 instr = AssignPointerMap(instr); |
| 625 | 642 |
| 626 if (hinstr->HasObservableSideEffects()) { | 643 if (hinstr->HasObservableSideEffects()) { |
| 627 ASSERT(hinstr->next()->IsSimulate()); | 644 ASSERT(hinstr->next()->IsSimulate()); |
| 628 HSimulate* sim = HSimulate::cast(hinstr->next()); | 645 HSimulate* sim = HSimulate::cast(hinstr->next()); |
| 629 ASSERT(instruction_pending_deoptimization_environment_ == NULL); | 646 ASSERT(instruction_pending_deoptimization_environment_ == NULL); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 LArithmeticT* result = | 792 LArithmeticT* result = |
| 776 new(zone()) LArithmeticT(op, context, left_operand, right_operand); | 793 new(zone()) LArithmeticT(op, context, left_operand, right_operand); |
| 777 return MarkAsCall(DefineFixed(result, eax), instr); | 794 return MarkAsCall(DefineFixed(result, eax), instr); |
| 778 } | 795 } |
| 779 | 796 |
| 780 | 797 |
| 781 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { | 798 void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { |
| 782 ASSERT(is_building()); | 799 ASSERT(is_building()); |
| 783 current_block_ = block; | 800 current_block_ = block; |
| 784 next_block_ = next_block; | 801 next_block_ = next_block; |
| 785 if (block->IsStartBlock()) { | 802 if (graph()->info()->IsOptimizing()) { |
| 786 block->UpdateEnvironment(graph_->start_environment()); | 803 if (block->IsStartBlock()) { |
| 787 argument_count_ = 0; | 804 block->UpdateEnvironment(graph_->start_environment()); |
| 788 } else if (block->predecessors()->length() == 1) { | 805 argument_count_ = 0; |
| 789 // We have a single predecessor => copy environment and outgoing | 806 } else if (block->predecessors()->length() == 1) { |
| 790 // argument count from the predecessor. | 807 // We have a single predecessor => copy environment and outgoing |
| 791 ASSERT(block->phis()->length() == 0); | 808 // argument count from the predecessor. |
| 792 HBasicBlock* pred = block->predecessors()->at(0); | 809 ASSERT(block->phis()->length() == 0); |
| 793 HEnvironment* last_environment = pred->last_environment(); | 810 HBasicBlock* pred = block->predecessors()->at(0); |
| 794 ASSERT(last_environment != NULL); | 811 HEnvironment* last_environment = pred->last_environment(); |
| 795 // Only copy the environment, if it is later used again. | 812 ASSERT(last_environment != NULL); |
| 796 if (pred->end()->SecondSuccessor() == NULL) { | 813 // Only copy the environment, if it is later used again. |
| 797 ASSERT(pred->end()->FirstSuccessor() == block); | 814 if (pred->end()->SecondSuccessor() == NULL) { |
| 815 ASSERT(pred->end()->FirstSuccessor() == block); |
| 816 } else { |
| 817 if (pred->end()->FirstSuccessor()->block_id() > block->block_id() || |
| 818 pred->end()->SecondSuccessor()->block_id() > block->block_id()) { |
| 819 last_environment = last_environment->Copy(); |
| 820 } |
| 821 } |
| 822 block->UpdateEnvironment(last_environment); |
| 823 ASSERT(pred->argument_count() >= 0); |
| 824 argument_count_ = pred->argument_count(); |
| 798 } else { | 825 } else { |
| 799 if (pred->end()->FirstSuccessor()->block_id() > block->block_id() || | 826 // We are at a state join => process phis. |
| 800 pred->end()->SecondSuccessor()->block_id() > block->block_id()) { | 827 HBasicBlock* pred = block->predecessors()->at(0); |
| 801 last_environment = last_environment->Copy(); | 828 // No need to copy the environment, it cannot be used later. |
| 829 HEnvironment* last_environment = pred->last_environment(); |
| 830 for (int i = 0; i < block->phis()->length(); ++i) { |
| 831 HPhi* phi = block->phis()->at(i); |
| 832 last_environment->SetValueAt(phi->merged_index(), phi); |
| 802 } | 833 } |
| 834 for (int i = 0; i < block->deleted_phis()->length(); ++i) { |
| 835 last_environment->SetValueAt(block->deleted_phis()->at(i), |
| 836 graph_->GetConstantUndefined()); |
| 837 } |
| 838 block->UpdateEnvironment(last_environment); |
| 839 // Pick up the outgoing argument count of one of the predecessors. |
| 840 argument_count_ = pred->argument_count(); |
| 803 } | 841 } |
| 804 block->UpdateEnvironment(last_environment); | |
| 805 ASSERT(pred->argument_count() >= 0); | |
| 806 argument_count_ = pred->argument_count(); | |
| 807 } else { | |
| 808 // We are at a state join => process phis. | |
| 809 HBasicBlock* pred = block->predecessors()->at(0); | |
| 810 // No need to copy the environment, it cannot be used later. | |
| 811 HEnvironment* last_environment = pred->last_environment(); | |
| 812 for (int i = 0; i < block->phis()->length(); ++i) { | |
| 813 HPhi* phi = block->phis()->at(i); | |
| 814 last_environment->SetValueAt(phi->merged_index(), phi); | |
| 815 } | |
| 816 for (int i = 0; i < block->deleted_phis()->length(); ++i) { | |
| 817 last_environment->SetValueAt(block->deleted_phis()->at(i), | |
| 818 graph_->GetConstantUndefined()); | |
| 819 } | |
| 820 block->UpdateEnvironment(last_environment); | |
| 821 // Pick up the outgoing argument count of one of the predecessors. | |
| 822 argument_count_ = pred->argument_count(); | |
| 823 } | 842 } |
| 824 HInstruction* current = block->first(); | 843 HInstruction* current = block->first(); |
| 825 int start = chunk_->instructions()->length(); | 844 int start = chunk_->instructions()->length(); |
| 826 while (current != NULL && !is_aborted()) { | 845 while (current != NULL && !is_aborted()) { |
| 827 // Code for constants in registers is generated lazily. | 846 // Code for constants in registers is generated lazily. |
| 828 if (!current->EmitAtUses()) { | 847 if (!current->EmitAtUses()) { |
| 829 VisitInstruction(current); | 848 VisitInstruction(current); |
| 830 } | 849 } |
| 831 current = current->next(); | 850 current = current->next(); |
| 832 } | 851 } |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 // All HForceRepresentation instructions should be eliminated in the | 1663 // All HForceRepresentation instructions should be eliminated in the |
| 1645 // representation change phase of Hydrogen. | 1664 // representation change phase of Hydrogen. |
| 1646 UNREACHABLE(); | 1665 UNREACHABLE(); |
| 1647 return NULL; | 1666 return NULL; |
| 1648 } | 1667 } |
| 1649 | 1668 |
| 1650 | 1669 |
| 1651 LInstruction* LChunkBuilder::DoChange(HChange* instr) { | 1670 LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
| 1652 Representation from = instr->from(); | 1671 Representation from = instr->from(); |
| 1653 Representation to = instr->to(); | 1672 Representation to = instr->to(); |
| 1673 // Only mark conversions that might need to allocate as calling rather than |
| 1674 // all changes. This makes simple, non-allocating conversion not have to force |
| 1675 // building a stack frame. |
| 1654 if (from.IsTagged()) { | 1676 if (from.IsTagged()) { |
| 1655 if (to.IsDouble()) { | 1677 if (to.IsDouble()) { |
| 1678 info()->MarkAsDeferredCalling(); |
| 1656 LOperand* value = UseRegister(instr->value()); | 1679 LOperand* value = UseRegister(instr->value()); |
| 1657 // Temp register only necessary for minus zero check. | 1680 // Temp register only necessary for minus zero check. |
| 1658 LOperand* temp = instr->deoptimize_on_minus_zero() | 1681 LOperand* temp = instr->deoptimize_on_minus_zero() |
| 1659 ? TempRegister() | 1682 ? TempRegister() |
| 1660 : NULL; | 1683 : NULL; |
| 1661 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); | 1684 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); |
| 1662 return AssignEnvironment(DefineAsRegister(res)); | 1685 return AssignEnvironment(DefineAsRegister(res)); |
| 1663 } else { | 1686 } else { |
| 1664 ASSERT(to.IsInteger32()); | 1687 ASSERT(to.IsInteger32()); |
| 1665 LOperand* value = UseRegister(instr->value()); | 1688 LOperand* value = UseRegister(instr->value()); |
| 1666 if (instr->value()->type().IsSmi()) { | 1689 if (instr->value()->type().IsSmi()) { |
| 1667 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); | 1690 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); |
| 1668 } else { | 1691 } else { |
| 1669 bool truncating = instr->CanTruncateToInt32(); | 1692 bool truncating = instr->CanTruncateToInt32(); |
| 1670 LOperand* xmm_temp = | 1693 LOperand* xmm_temp = |
| 1671 (truncating && CpuFeatures::IsSupported(SSE3)) | 1694 (truncating && CpuFeatures::IsSupported(SSE3)) |
| 1672 ? NULL | 1695 ? NULL |
| 1673 : FixedTemp(xmm1); | 1696 : FixedTemp(xmm1); |
| 1674 LTaggedToI* res = new(zone()) LTaggedToI(value, xmm_temp); | 1697 LTaggedToI* res = new(zone()) LTaggedToI(value, xmm_temp); |
| 1675 return AssignEnvironment(DefineSameAsFirst(res)); | 1698 return AssignEnvironment(DefineSameAsFirst(res)); |
| 1676 } | 1699 } |
| 1677 } | 1700 } |
| 1678 } else if (from.IsDouble()) { | 1701 } else if (from.IsDouble()) { |
| 1679 if (to.IsTagged()) { | 1702 if (to.IsTagged()) { |
| 1680 LOperand* value = UseRegister(instr->value()); | 1703 info()->MarkAsDeferredCalling(); |
| 1704 LOperand* value = CpuFeatures::IsSupported(SSE2) |
| 1705 ? UseRegisterAtStart(instr->value()) |
| 1706 : UseAtStart(instr->value()); |
| 1681 LOperand* temp = TempRegister(); | 1707 LOperand* temp = TempRegister(); |
| 1682 | 1708 |
| 1683 // Make sure that temp and result_temp are different registers. | 1709 // Make sure that temp and result_temp are different registers. |
| 1684 LUnallocated* result_temp = TempRegister(); | 1710 LUnallocated* result_temp = TempRegister(); |
| 1685 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); | 1711 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); |
| 1686 return AssignPointerMap(Define(result, result_temp)); | 1712 return AssignPointerMap(Define(result, result_temp)); |
| 1687 } else { | 1713 } else { |
| 1688 ASSERT(to.IsInteger32()); | 1714 ASSERT(to.IsInteger32()); |
| 1689 bool truncating = instr->CanTruncateToInt32(); | 1715 bool truncating = instr->CanTruncateToInt32(); |
| 1690 bool needs_temp = truncating && !CpuFeatures::IsSupported(SSE3); | 1716 bool needs_temp = truncating && !CpuFeatures::IsSupported(SSE3); |
| 1691 LOperand* value = needs_temp ? | 1717 LOperand* value = needs_temp ? |
| 1692 UseTempRegister(instr->value()) : UseRegister(instr->value()); | 1718 UseTempRegister(instr->value()) : UseRegister(instr->value()); |
| 1693 LOperand* temp = needs_temp ? TempRegister() : NULL; | 1719 LOperand* temp = needs_temp ? TempRegister() : NULL; |
| 1694 return AssignEnvironment( | 1720 return AssignEnvironment( |
| 1695 DefineAsRegister(new(zone()) LDoubleToI(value, temp))); | 1721 DefineAsRegister(new(zone()) LDoubleToI(value, temp))); |
| 1696 } | 1722 } |
| 1697 } else if (from.IsInteger32()) { | 1723 } else if (from.IsInteger32()) { |
| 1724 info()->MarkAsDeferredCalling(); |
| 1698 if (to.IsTagged()) { | 1725 if (to.IsTagged()) { |
| 1699 HValue* val = instr->value(); | 1726 HValue* val = instr->value(); |
| 1700 LOperand* value = UseRegister(val); | 1727 LOperand* value = UseRegister(val); |
| 1701 if (val->HasRange() && val->range()->IsInSmiRange()) { | 1728 if (val->HasRange() && val->range()->IsInSmiRange()) { |
| 1702 return DefineSameAsFirst(new(zone()) LSmiTag(value)); | 1729 return DefineSameAsFirst(new(zone()) LSmiTag(value)); |
| 1703 } else if (val->CheckFlag(HInstruction::kUint32)) { | 1730 } else if (val->CheckFlag(HInstruction::kUint32)) { |
| 1704 LOperand* temp = FixedTemp(xmm1); | 1731 LOperand* temp = FixedTemp(xmm1); |
| 1705 LNumberTagU* result = new(zone()) LNumberTagU(value, temp); | 1732 LNumberTagU* result = new(zone()) LNumberTagU(value, temp); |
| 1706 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1733 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
| 1707 } else { | 1734 } else { |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 | 2236 |
| 2210 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { | 2237 LInstruction* LChunkBuilder::DoOsrEntry(HOsrEntry* instr) { |
| 2211 ASSERT(argument_count_ == 0); | 2238 ASSERT(argument_count_ == 0); |
| 2212 allocator_->MarkAsOsrEntry(); | 2239 allocator_->MarkAsOsrEntry(); |
| 2213 current_block_->last_environment()->set_ast_id(instr->ast_id()); | 2240 current_block_->last_environment()->set_ast_id(instr->ast_id()); |
| 2214 return AssignEnvironment(new(zone()) LOsrEntry); | 2241 return AssignEnvironment(new(zone()) LOsrEntry); |
| 2215 } | 2242 } |
| 2216 | 2243 |
| 2217 | 2244 |
| 2218 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { | 2245 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { |
| 2219 int spill_index = chunk()->GetParameterStackSlot(instr->index()); | 2246 LParameter* result = new(zone()) LParameter; |
| 2220 return DefineAsSpilled(new(zone()) LParameter, spill_index); | 2247 switch (instr->kind()) { |
| 2248 case FUNCTION_PARAMETER: { |
| 2249 int spill_index = chunk()->GetParameterStackSlot(instr->index()); |
| 2250 return DefineAsSpilled(result, spill_index); |
| 2251 } |
| 2252 case KEYED_LOAD_IC_PARAMETER: { |
| 2253 if (instr->index() == 0) return DefineFixed(result, edx); |
| 2254 if (instr->index() == 1) return DefineFixed(result, ecx); |
| 2255 UNREACHABLE(); |
| 2256 break; |
| 2257 } |
| 2258 case KEYED_STORE_IC_PARAMETER: |
| 2259 if (instr->index() == 0) return DefineFixed(result, edx); |
| 2260 if (instr->index() == 1) return DefineFixed(result, ecx); |
| 2261 if (instr->index() == 2) return DefineFixed(result, eax); |
| 2262 break; |
| 2263 default: |
| 2264 UNREACHABLE(); |
| 2265 } |
| 2266 return NULL; |
| 2221 } | 2267 } |
| 2222 | 2268 |
| 2223 | 2269 |
| 2224 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { | 2270 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
| 2225 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. | 2271 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. |
| 2226 if (spill_index > LUnallocated::kMaxFixedIndex) { | 2272 if (spill_index > LUnallocated::kMaxFixedIndex) { |
| 2227 Abort("Too many spill slots needed for OSR"); | 2273 Abort("Too many spill slots needed for OSR"); |
| 2228 spill_index = 0; | 2274 spill_index = 0; |
| 2229 } | 2275 } |
| 2230 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2276 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2311 instruction_pending_deoptimization_environment_ = NULL; | 2357 instruction_pending_deoptimization_environment_ = NULL; |
| 2312 pending_deoptimization_ast_id_ = BailoutId::None(); | 2358 pending_deoptimization_ast_id_ = BailoutId::None(); |
| 2313 return result; | 2359 return result; |
| 2314 } | 2360 } |
| 2315 | 2361 |
| 2316 return NULL; | 2362 return NULL; |
| 2317 } | 2363 } |
| 2318 | 2364 |
| 2319 | 2365 |
| 2320 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { | 2366 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { |
| 2367 info()->MarkAsDeferredCalling(); |
| 2321 if (instr->is_function_entry()) { | 2368 if (instr->is_function_entry()) { |
| 2322 LOperand* context = UseFixed(instr->context(), esi); | 2369 LOperand* context = UseFixed(instr->context(), esi); |
| 2323 return MarkAsCall(new(zone()) LStackCheck(context), instr); | 2370 return MarkAsCall(new(zone()) LStackCheck(context), instr); |
| 2324 } else { | 2371 } else { |
| 2325 ASSERT(instr->is_backwards_branch()); | 2372 ASSERT(instr->is_backwards_branch()); |
| 2326 LOperand* context = UseAny(instr->context()); | 2373 LOperand* context = UseAny(instr->context()); |
| 2327 return AssignEnvironment( | 2374 return AssignEnvironment( |
| 2328 AssignPointerMap(new(zone()) LStackCheck(context))); | 2375 AssignPointerMap(new(zone()) LStackCheck(context))); |
| 2329 } | 2376 } |
| 2330 } | 2377 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2401 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2448 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2402 LOperand* object = UseRegister(instr->object()); | 2449 LOperand* object = UseRegister(instr->object()); |
| 2403 LOperand* index = UseTempRegister(instr->index()); | 2450 LOperand* index = UseTempRegister(instr->index()); |
| 2404 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2451 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2405 } | 2452 } |
| 2406 | 2453 |
| 2407 | 2454 |
| 2408 } } // namespace v8::internal | 2455 } } // namespace v8::internal |
| 2409 | 2456 |
| 2410 #endif // V8_TARGET_ARCH_IA32 | 2457 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |