OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 ASSERT(instr->representation().IsTagged()); | 1359 ASSERT(instr->representation().IsTagged()); |
1360 return DoArithmeticT(Token::DIV, instr); | 1360 return DoArithmeticT(Token::DIV, instr); |
1361 } | 1361 } |
1362 } | 1362 } |
1363 | 1363 |
1364 | 1364 |
1365 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1365 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
1366 if (instr->representation().IsInteger32()) { | 1366 if (instr->representation().IsInteger32()) { |
1367 ASSERT(instr->left()->representation().IsInteger32()); | 1367 ASSERT(instr->left()->representation().IsInteger32()); |
1368 ASSERT(instr->right()->representation().IsInteger32()); | 1368 ASSERT(instr->right()->representation().IsInteger32()); |
1369 // The temporary operand is necessary to ensure that right is not allocated | 1369 |
1370 // into edx. | 1370 LInstruction* result; |
1371 LOperand* temp = FixedTemp(edx); | 1371 if (instr->HasPowerOf2Divisor()) { |
1372 LOperand* value = UseFixed(instr->left(), eax); | 1372 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
1373 LOperand* divisor = UseRegister(instr->right()); | 1373 LOperand* value = UseRegisterAtStart(instr->left()); |
1374 LModI* mod = new LModI(value, divisor, temp); | 1374 LModI* mod = new LModI(value, UseOrConstant(instr->right()), NULL); |
1375 LInstruction* result = DefineFixed(mod, edx); | 1375 result = DefineSameAsFirst(mod); |
| 1376 } else { |
| 1377 // The temporary operand is necessary to ensure that right is |
| 1378 // not allocated into edx. |
| 1379 LOperand* temp = FixedTemp(edx); |
| 1380 LOperand* value = UseFixed(instr->left(), eax); |
| 1381 LOperand* divisor = UseRegister(instr->right()); |
| 1382 LModI* mod = new LModI(value, divisor, temp); |
| 1383 result = DefineFixed(mod, edx); |
| 1384 } |
| 1385 |
1376 return (instr->CheckFlag(HValue::kBailoutOnMinusZero) || | 1386 return (instr->CheckFlag(HValue::kBailoutOnMinusZero) || |
1377 instr->CheckFlag(HValue::kCanBeDivByZero)) | 1387 instr->CheckFlag(HValue::kCanBeDivByZero)) |
1378 ? AssignEnvironment(result) | 1388 ? AssignEnvironment(result) |
1379 : result; | 1389 : result; |
1380 } else if (instr->representation().IsTagged()) { | 1390 } else if (instr->representation().IsTagged()) { |
1381 return DoArithmeticT(Token::MOD, instr); | 1391 return DoArithmeticT(Token::MOD, instr); |
1382 } else { | 1392 } else { |
1383 ASSERT(instr->representation().IsDouble()); | 1393 ASSERT(instr->representation().IsDouble()); |
1384 // We call a C function for double modulo. It can't trigger a GC. | 1394 // We call a C function for double modulo. It can't trigger a GC. |
1385 // We need to use fixed result register for the call. | 1395 // We need to use fixed result register for the call. |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2082 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2092 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
2083 HEnvironment* outer = current_block_->last_environment()->outer(); | 2093 HEnvironment* outer = current_block_->last_environment()->outer(); |
2084 current_block_->UpdateEnvironment(outer); | 2094 current_block_->UpdateEnvironment(outer); |
2085 return NULL; | 2095 return NULL; |
2086 } | 2096 } |
2087 | 2097 |
2088 | 2098 |
2089 } } // namespace v8::internal | 2099 } } // namespace v8::internal |
2090 | 2100 |
2091 #endif // V8_TARGET_ARCH_IA32 | 2101 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |