| 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | 664 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
| 665 : Use(value, new LUnallocated(LUnallocated::ANY)); | 665 : Use(value, new LUnallocated(LUnallocated::ANY)); |
| 666 } | 666 } |
| 667 | 667 |
| 668 | 668 |
| 669 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { | 669 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { |
| 670 if (value->EmitAtUses()) { | 670 if (value->EmitAtUses()) { |
| 671 HInstruction* instr = HInstruction::cast(value); | 671 HInstruction* instr = HInstruction::cast(value); |
| 672 VisitInstruction(instr); | 672 VisitInstruction(instr); |
| 673 } | 673 } |
| 674 allocator_->RecordUse(value, operand); | 674 operand->set_virtual_register(value->id()); |
| 675 return operand; | 675 return operand; |
| 676 } | 676 } |
| 677 | 677 |
| 678 | 678 |
| 679 template<int I, int T> | 679 template<int I, int T> |
| 680 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, | 680 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, |
| 681 LUnallocated* result) { | 681 LUnallocated* result) { |
| 682 allocator_->RecordDefinition(current_instruction_, result); | 682 result->set_virtual_register(current_instruction_->id()); |
| 683 instr->set_result(result); | 683 instr->set_result(result); |
| 684 return instr; | 684 return instr; |
| 685 } | 685 } |
| 686 | 686 |
| 687 | 687 |
| 688 template<int I, int T> | 688 template<int I, int T> |
| 689 LInstruction* LChunkBuilder::DefineAsRegister( | 689 LInstruction* LChunkBuilder::DefineAsRegister( |
| 690 LTemplateInstruction<1, I, T>* instr) { | 690 LTemplateInstruction<1, I, T>* instr) { |
| 691 return Define(instr, new LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 691 return Define(instr, new LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); |
| 692 } | 692 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 | 784 |
| 785 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 785 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { |
| 786 ASSERT(!instr->HasPointerMap()); | 786 ASSERT(!instr->HasPointerMap()); |
| 787 instr->set_pointer_map(new LPointerMap(position_)); | 787 instr->set_pointer_map(new LPointerMap(position_)); |
| 788 return instr; | 788 return instr; |
| 789 } | 789 } |
| 790 | 790 |
| 791 | 791 |
| 792 LUnallocated* LChunkBuilder::TempRegister() { | 792 LUnallocated* LChunkBuilder::TempRegister() { |
| 793 LUnallocated* operand = new LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 793 LUnallocated* operand = new LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
| 794 allocator_->RecordTemporary(operand); | 794 operand->set_virtual_register(allocator_->GetVirtualRegister()); |
| 795 if (!allocator_->AllocationOk()) Abort("Not enough virtual registers."); |
| 795 return operand; | 796 return operand; |
| 796 } | 797 } |
| 797 | 798 |
| 798 | 799 |
| 799 LOperand* LChunkBuilder::FixedTemp(Register reg) { | 800 LOperand* LChunkBuilder::FixedTemp(Register reg) { |
| 800 LUnallocated* operand = ToUnallocated(reg); | 801 LUnallocated* operand = ToUnallocated(reg); |
| 801 allocator_->RecordTemporary(operand); | 802 ASSERT(operand->HasFixedPolicy()); |
| 802 return operand; | 803 return operand; |
| 803 } | 804 } |
| 804 | 805 |
| 805 | 806 |
| 806 LOperand* LChunkBuilder::FixedTemp(DoubleRegister reg) { | 807 LOperand* LChunkBuilder::FixedTemp(DoubleRegister reg) { |
| 807 LUnallocated* operand = ToUnallocated(reg); | 808 LUnallocated* operand = ToUnallocated(reg); |
| 808 allocator_->RecordTemporary(operand); | 809 ASSERT(operand->HasFixedPolicy()); |
| 809 return operand; | 810 return operand; |
| 810 } | 811 } |
| 811 | 812 |
| 812 | 813 |
| 813 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { | 814 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { |
| 814 return new LLabel(instr->block()); | 815 return new LLabel(instr->block()); |
| 815 } | 816 } |
| 816 | 817 |
| 817 | 818 |
| 818 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) { | 819 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) { |
| (...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2262 | 2263 |
| 2263 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2264 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
| 2264 LOperand* key = UseRegisterAtStart(instr->key()); | 2265 LOperand* key = UseRegisterAtStart(instr->key()); |
| 2265 LOperand* object = UseRegisterAtStart(instr->object()); | 2266 LOperand* object = UseRegisterAtStart(instr->object()); |
| 2266 LIn* result = new LIn(key, object); | 2267 LIn* result = new LIn(key, object); |
| 2267 return MarkAsCall(DefineFixed(result, v0), instr); | 2268 return MarkAsCall(DefineFixed(result, v0), instr); |
| 2268 } | 2269 } |
| 2269 | 2270 |
| 2270 | 2271 |
| 2271 } } // namespace v8::internal | 2272 } } // namespace v8::internal |
| OLD | NEW |