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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 if (needs_environment && !instr->HasEnvironment()) { | 658 if (needs_environment && !instr->HasEnvironment()) { |
659 instr = AssignEnvironment(instr); | 659 instr = AssignEnvironment(instr); |
660 } | 660 } |
661 | 661 |
662 return instr; | 662 return instr; |
663 } | 663 } |
664 | 664 |
665 | 665 |
666 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { | 666 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { |
667 ASSERT(!instr->HasPointerMap()); | 667 ASSERT(!instr->HasPointerMap()); |
668 instr->set_pointer_map(new(zone()) LPointerMap(position_, zone())); | 668 instr->set_pointer_map(new(zone()) LPointerMap(zone())); |
669 return instr; | 669 return instr; |
670 } | 670 } |
671 | 671 |
672 | 672 |
673 LUnallocated* LChunkBuilder::TempRegister() { | 673 LUnallocated* LChunkBuilder::TempRegister() { |
674 LUnallocated* operand = | 674 LUnallocated* operand = |
675 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); | 675 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER); |
676 int vreg = allocator_->GetVirtualRegister(); | 676 int vreg = allocator_->GetVirtualRegister(); |
677 if (!allocator_->AllocationOk()) { | 677 if (!allocator_->AllocationOk()) { |
678 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); | 678 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 } | 852 } |
853 block->set_argument_count(argument_count_); | 853 block->set_argument_count(argument_count_); |
854 next_block_ = NULL; | 854 next_block_ = NULL; |
855 current_block_ = NULL; | 855 current_block_ = NULL; |
856 } | 856 } |
857 | 857 |
858 | 858 |
859 void LChunkBuilder::VisitInstruction(HInstruction* current) { | 859 void LChunkBuilder::VisitInstruction(HInstruction* current) { |
860 HInstruction* old_current = current_instruction_; | 860 HInstruction* old_current = current_instruction_; |
861 current_instruction_ = current; | 861 current_instruction_ = current; |
862 if (current->has_position()) position_ = current->position(); | |
863 | 862 |
864 LInstruction* instr = NULL; | 863 LInstruction* instr = NULL; |
865 if (current->CanReplaceWithDummyUses()) { | 864 if (current->CanReplaceWithDummyUses()) { |
866 HValue* first_operand = current->OperandCount() == 0 | 865 HValue* first_operand = current->OperandCount() == 0 |
867 ? graph()->GetConstant1() | 866 ? graph()->GetConstant1() |
868 : current->OperandAt(0); | 867 : current->OperandAt(0); |
869 instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand))); | 868 instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand))); |
870 for (int i = 1; i < current->OperandCount(); ++i) { | 869 for (int i = 1; i < current->OperandCount(); ++i) { |
871 LInstruction* dummy = | 870 LInstruction* dummy = |
872 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); | 871 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; | 906 if (LUnallocated::cast(instr->Output())->HasFixedPolicy()) ++fixed; |
908 } | 907 } |
909 for (TempIterator it(instr); !it.Done(); it.Advance()) { | 908 for (TempIterator it(instr); !it.Done(); it.Advance()) { |
910 LUnallocated* operand = LUnallocated::cast(it.Current()); | 909 LUnallocated* operand = LUnallocated::cast(it.Current()); |
911 if (operand->HasFixedPolicy()) ++fixed; | 910 if (operand->HasFixedPolicy()) ++fixed; |
912 } | 911 } |
913 ASSERT(fixed == 0 || used_at_start == 0); | 912 ASSERT(fixed == 0 || used_at_start == 0); |
914 } | 913 } |
915 #endif | 914 #endif |
916 | 915 |
917 instr->set_position(position_); | |
918 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { | 916 if (FLAG_stress_pointer_maps && !instr->HasPointerMap()) { |
919 instr = AssignPointerMap(instr); | 917 instr = AssignPointerMap(instr); |
920 } | 918 } |
921 if (FLAG_stress_environments && !instr->HasEnvironment()) { | 919 if (FLAG_stress_environments && !instr->HasEnvironment()) { |
922 instr = AssignEnvironment(instr); | 920 instr = AssignEnvironment(instr); |
923 } | 921 } |
924 chunk_->AddInstruction(instr, current_block_); | 922 chunk_->AddInstruction(instr, current_block_); |
925 } | 923 } |
926 current_instruction_ = old_current; | 924 current_instruction_ = old_current; |
927 } | 925 } |
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2537 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2535 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2538 LOperand* object = UseRegister(instr->object()); | 2536 LOperand* object = UseRegister(instr->object()); |
2539 LOperand* index = UseTempRegister(instr->index()); | 2537 LOperand* index = UseTempRegister(instr->index()); |
2540 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2538 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2541 } | 2539 } |
2542 | 2540 |
2543 | 2541 |
2544 } } // namespace v8::internal | 2542 } } // namespace v8::internal |
2545 | 2543 |
2546 #endif // V8_TARGET_ARCH_X64 | 2544 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |