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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 ? chunk_->DefineConstantOperand(HConstant::cast(value)) | 663 ? chunk_->DefineConstantOperand(HConstant::cast(value)) |
664 : Use(value, new(zone()) LUnallocated(LUnallocated::ANY)); | 664 : Use(value, new(zone()) LUnallocated(LUnallocated::ANY)); |
665 } | 665 } |
666 | 666 |
667 | 667 |
668 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { | 668 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { |
669 if (value->EmitAtUses()) { | 669 if (value->EmitAtUses()) { |
670 HInstruction* instr = HInstruction::cast(value); | 670 HInstruction* instr = HInstruction::cast(value); |
671 VisitInstruction(instr); | 671 VisitInstruction(instr); |
672 } | 672 } |
673 allocator_->RecordUse(value, operand); | 673 operand->set_virtual_register(value->id()); |
674 return operand; | 674 return operand; |
675 } | 675 } |
676 | 676 |
677 | 677 |
678 template<int I, int T> | 678 template<int I, int T> |
679 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, | 679 LInstruction* LChunkBuilder::Define(LTemplateInstruction<1, I, T>* instr, |
680 LUnallocated* result) { | 680 LUnallocated* result) { |
681 allocator_->RecordDefinition(current_instruction_, result); | 681 result->set_virtual_register(current_instruction_->id()); |
682 instr->set_result(result); | 682 instr->set_result(result); |
683 return instr; | 683 return instr; |
684 } | 684 } |
685 | 685 |
686 | 686 |
687 template<int I, int T> | 687 template<int I, int T> |
688 LInstruction* LChunkBuilder::DefineAsRegister( | 688 LInstruction* LChunkBuilder::DefineAsRegister( |
689 LTemplateInstruction<1, I, T>* instr) { | 689 LTemplateInstruction<1, I, T>* instr) { |
690 return Define(instr, | 690 return Define(instr, |
691 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 691 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 789 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { |
790 ASSERT(!instr->HasPointerMap()); | 790 ASSERT(!instr->HasPointerMap()); |
791 instr->set_pointer_map(new(zone()) LPointerMap(position_)); | 791 instr->set_pointer_map(new(zone()) LPointerMap(position_)); |
792 return instr; | 792 return instr; |
793 } | 793 } |
794 | 794 |
795 | 795 |
796 LUnallocated* LChunkBuilder::TempRegister() { | 796 LUnallocated* LChunkBuilder::TempRegister() { |
797 LUnallocated* operand = | 797 LUnallocated* operand = |
798 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 798 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
799 allocator_->RecordTemporary(operand); | 799 operand->set_virtual_register(allocator_->GetVirtualRegister()); |
| 800 if (!allocator_->AllocationOk()) Abort("Not enough virtual registers (temps)."
); |
800 return operand; | 801 return operand; |
801 } | 802 } |
802 | 803 |
803 | 804 |
804 LOperand* LChunkBuilder::FixedTemp(Register reg) { | 805 LOperand* LChunkBuilder::FixedTemp(Register reg) { |
805 LUnallocated* operand = ToUnallocated(reg); | 806 LUnallocated* operand = ToUnallocated(reg); |
806 allocator_->RecordTemporary(operand); | 807 ASSERT(operand->HasFixedPolicy()); |
807 return operand; | 808 return operand; |
808 } | 809 } |
809 | 810 |
810 | 811 |
811 LOperand* LChunkBuilder::FixedTemp(XMMRegister reg) { | 812 LOperand* LChunkBuilder::FixedTemp(XMMRegister reg) { |
812 LUnallocated* operand = ToUnallocated(reg); | 813 LUnallocated* operand = ToUnallocated(reg); |
813 allocator_->RecordTemporary(operand); | 814 ASSERT(operand->HasFixedPolicy()); |
814 return operand; | 815 return operand; |
815 } | 816 } |
816 | 817 |
817 | 818 |
818 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { | 819 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { |
819 return new(zone()) LLabel(instr->block()); | 820 return new(zone()) LLabel(instr->block()); |
820 } | 821 } |
821 | 822 |
822 | 823 |
823 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) { | 824 LInstruction* LChunkBuilder::DoSoftDeoptimize(HSoftDeoptimize* instr) { |
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 LOperand* key = UseOrConstantAtStart(instr->key()); | 2397 LOperand* key = UseOrConstantAtStart(instr->key()); |
2397 LOperand* object = UseOrConstantAtStart(instr->object()); | 2398 LOperand* object = UseOrConstantAtStart(instr->object()); |
2398 LIn* result = new(zone()) LIn(context, key, object); | 2399 LIn* result = new(zone()) LIn(context, key, object); |
2399 return MarkAsCall(DefineFixed(result, eax), instr); | 2400 return MarkAsCall(DefineFixed(result, eax), instr); |
2400 } | 2401 } |
2401 | 2402 |
2402 | 2403 |
2403 } } // namespace v8::internal | 2404 } } // namespace v8::internal |
2404 | 2405 |
2405 #endif // V8_TARGET_ARCH_IA32 | 2406 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |