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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 } | 904 } |
905 | 905 |
906 | 906 |
907 void LChunkBuilder::VisitInstruction(HInstruction* current) { | 907 void LChunkBuilder::VisitInstruction(HInstruction* current) { |
908 HInstruction* old_current = current_instruction_; | 908 HInstruction* old_current = current_instruction_; |
909 current_instruction_ = current; | 909 current_instruction_ = current; |
910 if (current->has_position()) position_ = current->position(); | 910 if (current->has_position()) position_ = current->position(); |
911 LInstruction* instr = current->CompileToLithium(this); | 911 LInstruction* instr = current->CompileToLithium(this); |
912 | 912 |
913 if (instr != NULL) { | 913 if (instr != NULL) { |
| 914 // Associate the hydrogen instruction first, since we may need it for |
| 915 // the ClobbersRegisters() or ClobbersDoubleRegisters() calls below. |
| 916 instr->set_hydrogen_value(current); |
| 917 |
914 #if DEBUG | 918 #if DEBUG |
915 // Make sure that the lithium instruction has either no fixed register | 919 // Make sure that the lithium instruction has either no fixed register |
916 // constraints in temps or the result OR no uses that are only used at | 920 // constraints in temps or the result OR no uses that are only used at |
917 // start. If this invariant doesn't hold, the register allocator can decide | 921 // start. If this invariant doesn't hold, the register allocator can decide |
918 // to insert a split of a range immediately before the instruction due to an | 922 // to insert a split of a range immediately before the instruction due to an |
919 // already allocated register needing to be used for the instruction's fixed | 923 // already allocated register needing to be used for the instruction's fixed |
920 // register constraint. In this case, The register allocator won't see an | 924 // register constraint. In this case, The register allocator won't see an |
921 // interference between the split child and the use-at-start (it would if | 925 // interference between the split child and the use-at-start (it would if |
922 // the it was just a plain use), so it is free to move the split child into | 926 // the it was just a plain use), so it is free to move the split child into |
923 // the same register that is used for the use-at-start. | 927 // the same register that is used for the use-at-start. |
(...skipping 26 matching lines...) Expand all Loading... |
950 if (!CpuFeatures::IsSafeForSnapshot(SSE2) && instr->IsGoto() && | 954 if (!CpuFeatures::IsSafeForSnapshot(SSE2) && instr->IsGoto() && |
951 LGoto::cast(instr)->jumps_to_join()) { | 955 LGoto::cast(instr)->jumps_to_join()) { |
952 // TODO(olivf) Since phis of spilled values are joined as registers | 956 // TODO(olivf) Since phis of spilled values are joined as registers |
953 // (not in the stack slot), we need to allow the goto gaps to keep one | 957 // (not in the stack slot), we need to allow the goto gaps to keep one |
954 // x87 register alive. To ensure all other values are still spilled, we | 958 // x87 register alive. To ensure all other values are still spilled, we |
955 // insert a fpu register barrier right before. | 959 // insert a fpu register barrier right before. |
956 LClobberDoubles* clobber = new(zone()) LClobberDoubles(); | 960 LClobberDoubles* clobber = new(zone()) LClobberDoubles(); |
957 clobber->set_hydrogen_value(current); | 961 clobber->set_hydrogen_value(current); |
958 chunk_->AddInstruction(clobber, current_block_); | 962 chunk_->AddInstruction(clobber, current_block_); |
959 } | 963 } |
960 instr->set_hydrogen_value(current); | |
961 chunk_->AddInstruction(instr, current_block_); | 964 chunk_->AddInstruction(instr, current_block_); |
962 } | 965 } |
963 current_instruction_ = old_current; | 966 current_instruction_ = old_current; |
964 } | 967 } |
965 | 968 |
966 | 969 |
967 LEnvironment* LChunkBuilder::CreateEnvironment( | 970 LEnvironment* LChunkBuilder::CreateEnvironment( |
968 HEnvironment* hydrogen_env, | 971 HEnvironment* hydrogen_env, |
969 int* argument_index_accumulator, | 972 int* argument_index_accumulator, |
970 ZoneList<HValue*>* objects_to_materialize) { | 973 ZoneList<HValue*>* objects_to_materialize) { |
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2719 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2722 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2720 LOperand* object = UseRegister(instr->object()); | 2723 LOperand* object = UseRegister(instr->object()); |
2721 LOperand* index = UseTempRegister(instr->index()); | 2724 LOperand* index = UseTempRegister(instr->index()); |
2722 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2725 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2723 } | 2726 } |
2724 | 2727 |
2725 | 2728 |
2726 } } // namespace v8::internal | 2729 } } // namespace v8::internal |
2727 | 2730 |
2728 #endif // V8_TARGET_ARCH_IA32 | 2731 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |