| 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 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 } | 841 } |
| 842 block->set_argument_count(argument_count_); | 842 block->set_argument_count(argument_count_); |
| 843 next_block_ = NULL; | 843 next_block_ = NULL; |
| 844 current_block_ = NULL; | 844 current_block_ = NULL; |
| 845 } | 845 } |
| 846 | 846 |
| 847 | 847 |
| 848 void LChunkBuilder::VisitInstruction(HInstruction* current) { | 848 void LChunkBuilder::VisitInstruction(HInstruction* current) { |
| 849 HInstruction* old_current = current_instruction_; | 849 HInstruction* old_current = current_instruction_; |
| 850 current_instruction_ = current; | 850 current_instruction_ = current; |
| 851 if (current->has_position()) position_ = current->position(); |
| 851 | 852 |
| 852 LInstruction* instr = NULL; | 853 LInstruction* instr = NULL; |
| 853 if (current->CanReplaceWithDummyUses()) { | 854 if (current->CanReplaceWithDummyUses()) { |
| 854 if (current->OperandCount() == 0) { | 855 if (current->OperandCount() == 0) { |
| 855 instr = DefineAsRegister(new(zone()) LDummy()); | 856 instr = DefineAsRegister(new(zone()) LDummy()); |
| 856 } else { | 857 } else { |
| 857 ASSERT(!current->OperandAt(0)->IsControlInstruction()); | 858 ASSERT(!current->OperandAt(0)->IsControlInstruction()); |
| 858 instr = DefineAsRegister(new(zone()) | 859 instr = DefineAsRegister(new(zone()) |
| 859 LDummyUse(UseAny(current->OperandAt(0)))); | 860 LDummyUse(UseAny(current->OperandAt(0)))); |
| 860 } | 861 } |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 | 1095 |
| 1095 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 1096 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 1096 switch (instr->op()) { | 1097 switch (instr->op()) { |
| 1097 case kMathFloor: return DoMathFloor(instr); | 1098 case kMathFloor: return DoMathFloor(instr); |
| 1098 case kMathRound: return DoMathRound(instr); | 1099 case kMathRound: return DoMathRound(instr); |
| 1099 case kMathAbs: return DoMathAbs(instr); | 1100 case kMathAbs: return DoMathAbs(instr); |
| 1100 case kMathLog: return DoMathLog(instr); | 1101 case kMathLog: return DoMathLog(instr); |
| 1101 case kMathExp: return DoMathExp(instr); | 1102 case kMathExp: return DoMathExp(instr); |
| 1102 case kMathSqrt: return DoMathSqrt(instr); | 1103 case kMathSqrt: return DoMathSqrt(instr); |
| 1103 case kMathPowHalf: return DoMathPowHalf(instr); | 1104 case kMathPowHalf: return DoMathPowHalf(instr); |
| 1104 case kMathClz32: return DoMathClz32(instr); | |
| 1105 default: | 1105 default: |
| 1106 UNREACHABLE(); | 1106 UNREACHABLE(); |
| 1107 return NULL; | 1107 return NULL; |
| 1108 } | 1108 } |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 | 1111 |
| 1112 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1112 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
| 1113 ASSERT(instr->representation().IsDouble()); | 1113 ASSERT(instr->representation().IsDouble()); |
| 1114 ASSERT(instr->value()->representation().IsDouble()); | 1114 ASSERT(instr->value()->representation().IsDouble()); |
| 1115 LOperand* input = UseFixedDouble(instr->value(), f4); | 1115 LOperand* input = UseFixedDouble(instr->value(), f4); |
| 1116 return MarkAsCall(DefineFixedDouble(new(zone()) LMathLog(input), f4), instr); | 1116 return MarkAsCall(DefineFixedDouble(new(zone()) LMathLog(input), f4), instr); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 | 1119 |
| 1120 LInstruction* LChunkBuilder::DoMathClz32(HUnaryMathOperation* instr) { | |
| 1121 LOperand* input = UseRegisterAtStart(instr->value()); | |
| 1122 LMathClz32* result = new(zone()) LMathClz32(input); | |
| 1123 return DefineAsRegister(result); | |
| 1124 } | |
| 1125 | |
| 1126 | |
| 1127 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { | 1120 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) { |
| 1128 ASSERT(instr->representation().IsDouble()); | 1121 ASSERT(instr->representation().IsDouble()); |
| 1129 ASSERT(instr->value()->representation().IsDouble()); | 1122 ASSERT(instr->value()->representation().IsDouble()); |
| 1130 LOperand* input = UseRegister(instr->value()); | 1123 LOperand* input = UseRegister(instr->value()); |
| 1131 LOperand* temp1 = TempRegister(); | 1124 LOperand* temp1 = TempRegister(); |
| 1132 LOperand* temp2 = TempRegister(); | 1125 LOperand* temp2 = TempRegister(); |
| 1133 LOperand* double_temp = FixedTemp(f6); // Chosen by fair dice roll. | 1126 LOperand* double_temp = FixedTemp(f6); // Chosen by fair dice roll. |
| 1134 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); | 1127 LMathExp* result = new(zone()) LMathExp(input, double_temp, temp1, temp2); |
| 1135 return DefineAsRegister(result); | 1128 return DefineAsRegister(result); |
| 1136 } | 1129 } |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 | 2399 |
| 2407 | 2400 |
| 2408 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2401 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2409 LOperand* object = UseRegister(instr->object()); | 2402 LOperand* object = UseRegister(instr->object()); |
| 2410 LOperand* index = UseRegister(instr->index()); | 2403 LOperand* index = UseRegister(instr->index()); |
| 2411 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2404 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2412 } | 2405 } |
| 2413 | 2406 |
| 2414 | 2407 |
| 2415 } } // namespace v8::internal | 2408 } } // namespace v8::internal |
| OLD | NEW |