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 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1180 LOperand* input = UseRegisterAtStart(instr->value()); | 1180 LOperand* input = UseRegisterAtStart(instr->value()); |
1181 LBitNotI* result = new(zone()) LBitNotI(input); | 1181 LBitNotI* result = new(zone()) LBitNotI(input); |
1182 return DefineSameAsFirst(result); | 1182 return DefineSameAsFirst(result); |
1183 } | 1183 } |
1184 | 1184 |
1185 | 1185 |
1186 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { | 1186 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
1187 if (instr->representation().IsDouble()) { | 1187 if (instr->representation().IsDouble()) { |
1188 return DoArithmeticD(Token::DIV, instr); | 1188 return DoArithmeticD(Token::DIV, instr); |
1189 } else if (instr->representation().IsInteger32()) { | 1189 } else if (instr->representation().IsInteger32()) { |
| 1190 if (instr->HasPowerOf2Divisor()) { |
| 1191 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1192 LOperand* value = UseRegisterAtStart(instr->left()); |
| 1193 LDivI* div = |
| 1194 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL); |
| 1195 return AssignEnvironment(DefineSameAsFirst(div)); |
| 1196 } |
1190 // The temporary operand is necessary to ensure that right is not allocated | 1197 // The temporary operand is necessary to ensure that right is not allocated |
1191 // into rdx. | 1198 // into rdx. |
1192 LOperand* temp = FixedTemp(rdx); | 1199 LOperand* temp = FixedTemp(rdx); |
1193 LOperand* dividend = UseFixed(instr->left(), rax); | 1200 LOperand* dividend = UseFixed(instr->left(), rax); |
1194 LOperand* divisor = UseRegister(instr->right()); | 1201 LOperand* divisor = UseRegister(instr->right()); |
1195 LDivI* result = new(zone()) LDivI(dividend, divisor, temp); | 1202 LDivI* result = new(zone()) LDivI(dividend, divisor, temp); |
1196 return AssignEnvironment(DefineFixed(result, rax)); | 1203 return AssignEnvironment(DefineFixed(result, rax)); |
1197 } else { | 1204 } else { |
1198 ASSERT(instr->representation().IsTagged()); | 1205 ASSERT(instr->representation().IsTagged()); |
1199 return DoArithmeticT(Token::DIV, instr); | 1206 return DoArithmeticT(Token::DIV, instr); |
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2320 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2327 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2321 LOperand* object = UseRegister(instr->object()); | 2328 LOperand* object = UseRegister(instr->object()); |
2322 LOperand* index = UseTempRegister(instr->index()); | 2329 LOperand* index = UseTempRegister(instr->index()); |
2323 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2330 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2324 } | 2331 } |
2325 | 2332 |
2326 | 2333 |
2327 } } // namespace v8::internal | 2334 } } // namespace v8::internal |
2328 | 2335 |
2329 #endif // V8_TARGET_ARCH_X64 | 2336 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |