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 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 LOperand* input = UseRegisterAtStart(instr->value()); | 1257 LOperand* input = UseRegisterAtStart(instr->value()); |
1258 LBitNotI* result = new(zone()) LBitNotI(input); | 1258 LBitNotI* result = new(zone()) LBitNotI(input); |
1259 return DefineSameAsFirst(result); | 1259 return DefineSameAsFirst(result); |
1260 } | 1260 } |
1261 | 1261 |
1262 | 1262 |
1263 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { | 1263 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
1264 if (instr->representation().IsDouble()) { | 1264 if (instr->representation().IsDouble()) { |
1265 return DoArithmeticD(Token::DIV, instr); | 1265 return DoArithmeticD(Token::DIV, instr); |
1266 } else if (instr->representation().IsInteger32()) { | 1266 } else if (instr->representation().IsInteger32()) { |
| 1267 if (instr->HasPowerOf2Divisor()) { |
| 1268 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1269 LOperand* value = UseRegisterAtStart(instr->left()); |
| 1270 LDivI* div = |
| 1271 new(zone()) LDivI(value, UseOrConstant(instr->right()), NULL); |
| 1272 return AssignEnvironment(DefineSameAsFirst(div)); |
| 1273 } |
1267 // The temporary operand is necessary to ensure that right is not allocated | 1274 // The temporary operand is necessary to ensure that right is not allocated |
1268 // into edx. | 1275 // into edx. |
1269 LOperand* temp = FixedTemp(edx); | 1276 LOperand* temp = FixedTemp(edx); |
1270 LOperand* dividend = UseFixed(instr->left(), eax); | 1277 LOperand* dividend = UseFixed(instr->left(), eax); |
1271 LOperand* divisor = UseRegister(instr->right()); | 1278 LOperand* divisor = UseRegister(instr->right()); |
1272 LDivI* result = new(zone()) LDivI(dividend, divisor, temp); | 1279 LDivI* result = new(zone()) LDivI(dividend, divisor, temp); |
1273 return AssignEnvironment(DefineFixed(result, eax)); | 1280 return AssignEnvironment(DefineFixed(result, eax)); |
1274 } else { | 1281 } else { |
1275 ASSERT(instr->representation().IsTagged()); | 1282 ASSERT(instr->representation().IsTagged()); |
1276 return DoArithmeticT(Token::DIV, instr); | 1283 return DoArithmeticT(Token::DIV, instr); |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2471 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2478 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2472 LOperand* object = UseRegister(instr->object()); | 2479 LOperand* object = UseRegister(instr->object()); |
2473 LOperand* index = UseTempRegister(instr->index()); | 2480 LOperand* index = UseTempRegister(instr->index()); |
2474 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2481 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2475 } | 2482 } |
2476 | 2483 |
2477 | 2484 |
2478 } } // namespace v8::internal | 2485 } } // namespace v8::internal |
2479 | 2486 |
2480 #endif // V8_TARGET_ARCH_IA32 | 2487 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |