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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | 657 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
658 : Use(value, new LUnallocated(LUnallocated::ANY)); | 658 : Use(value, new LUnallocated(LUnallocated::ANY)); |
659 } | 659 } |
660 | 660 |
661 | 661 |
662 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { | 662 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { |
663 if (value->EmitAtUses()) { | 663 if (value->EmitAtUses()) { |
664 HInstruction* instr = HInstruction::cast(value); | 664 HInstruction* instr = HInstruction::cast(value); |
665 VisitInstruction(instr); | 665 VisitInstruction(instr); |
666 } | 666 } |
667 allocator_->RecordUse(value, operand); | 667 operand->set_virtual_register(value->id()); |
668 return operand; | 668 return operand; |
669 } | 669 } |
670 | 670 |
671 | 671 |
672 template<int I, int T> | 672 template<int I, int T> |
673 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, | 673 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, |
674 LUnallocated* result) { | 674 LUnallocated* result) { |
675 allocator_->RecordDefinition(current_instruction_, result); | 675 result->set_virtual_register(current_instruction_->id()); |
676 instr->set_result(result); | 676 instr->set_result(result); |
677 return instr; | 677 return instr; |
678 } | 678 } |
679 | 679 |
680 | 680 |
681 template<int I, int T> | 681 template<int I, int T> |
682 LInstruction* LChunkBuilder::DefineAsRegister( | 682 LInstruction* LChunkBuilder::DefineAsRegister( |
683 LTemplateInstruction<1, I, T>* instr) { | 683 LTemplateInstruction<1, I, T>* instr) { |
684 return Define(instr, new LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 684 return Define(instr, new LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); |
685 } | 685 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 | 779 |
780 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 780 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { |
781 ASSERT(!instr->HasPointerMap()); | 781 ASSERT(!instr->HasPointerMap()); |
782 instr->set_pointer_map(new LPointerMap(position_)); | 782 instr->set_pointer_map(new LPointerMap(position_)); |
783 return instr; | 783 return instr; |
784 } | 784 } |
785 | 785 |
786 | 786 |
787 LUnallocated* LChunkBuilder::TempRegister() { | 787 LUnallocated* LChunkBuilder::TempRegister() { |
788 LUnallocated* operand = new LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 788 LUnallocated* operand = new LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
789 allocator_->RecordTemporary(operand); | 789 operand->set_virtual_register(allocator_->GetVirtualRegister()); |
| 790 if (!allocator_->AllocationOk()) Abort("Not enough virtual registers."); |
790 return operand; | 791 return operand; |
791 } | 792 } |
792 | 793 |
793 | 794 |
794 LOperand* LChunkBuilder::FixedTemp(Register reg) { | 795 LOperand* LChunkBuilder::FixedTemp(Register reg) { |
795 LUnallocated* operand = ToUnallocated(reg); | 796 LUnallocated* operand = ToUnallocated(reg); |
796 allocator_->RecordTemporary(operand); | 797 ASSERT(operand->HasFixedPolicy()); |
797 return operand; | 798 return operand; |
798 } | 799 } |
799 | 800 |
800 | 801 |
801 LOperand* LChunkBuilder::FixedTemp(XMMRegister reg) { | 802 LOperand* LChunkBuilder::FixedTemp(XMMRegister reg) { |
802 LUnallocated* operand = ToUnallocated(reg); | 803 LUnallocated* operand = ToUnallocated(reg); |
803 allocator_->RecordTemporary(operand); | 804 ASSERT(operand->HasFixedPolicy()); |
804 return operand; | 805 return operand; |
805 } | 806 } |
806 | 807 |
807 | 808 |
808 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { | 809 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { |
809 return new LLabel(instr->block()); | 810 return new LLabel(instr->block()); |
810 } | 811 } |
811 | 812 |
812 | 813 |
813 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) { | 814 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) { |
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2260 LOperand* key = UseOrConstantAtStart(instr->key()); | 2261 LOperand* key = UseOrConstantAtStart(instr->key()); |
2261 LOperand* object = UseOrConstantAtStart(instr->object()); | 2262 LOperand* object = UseOrConstantAtStart(instr->object()); |
2262 LIn* result = new LIn(key, object); | 2263 LIn* result = new LIn(key, object); |
2263 return MarkAsCall(DefineFixed(result, rax), instr); | 2264 return MarkAsCall(DefineFixed(result, rax), instr); |
2264 } | 2265 } |
2265 | 2266 |
2266 | 2267 |
2267 } } // namespace v8::internal | 2268 } } // namespace v8::internal |
2268 | 2269 |
2269 #endif // V8_TARGET_ARCH_X64 | 2270 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |