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 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 return AssignEnvironment(AssignPointerMap( | 1248 return AssignEnvironment(AssignPointerMap( |
1249 DefineFixed(new LDivI(value, divisor), r0))); | 1249 DefineFixed(new LDivI(value, divisor), r0))); |
1250 } else { | 1250 } else { |
1251 return DoArithmeticT(Token::DIV, instr); | 1251 return DoArithmeticT(Token::DIV, instr); |
1252 } | 1252 } |
1253 } | 1253 } |
1254 | 1254 |
1255 | 1255 |
1256 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1256 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
1257 if (instr->representation().IsInteger32()) { | 1257 if (instr->representation().IsInteger32()) { |
| 1258 // TODO(1042) The fixed register allocation |
| 1259 // is needed because we call GenericBinaryOpStub from |
| 1260 // the generated code, which requires registers r0 |
| 1261 // and r1 to be used. We should remove that |
| 1262 // when we provide a native implementation. |
1258 ASSERT(instr->left()->representation().IsInteger32()); | 1263 ASSERT(instr->left()->representation().IsInteger32()); |
1259 ASSERT(instr->right()->representation().IsInteger32()); | 1264 ASSERT(instr->right()->representation().IsInteger32()); |
1260 // The temporary operand is necessary to ensure that right is not allocated | |
1261 // into edx. | |
1262 FixedTemp(r1); | |
1263 LOperand* value = UseFixed(instr->left(), r0); | 1265 LOperand* value = UseFixed(instr->left(), r0); |
1264 LOperand* divisor = UseRegister(instr->right()); | 1266 LOperand* divisor = UseFixed(instr->right(), r1); |
1265 LInstruction* result = DefineFixed(new LModI(value, divisor), r1); | 1267 LInstruction* result = DefineFixed(new LModI(value, divisor), r0); |
1266 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) || | 1268 result = AssignEnvironment(AssignPointerMap(result)); |
1267 instr->CheckFlag(HValue::kCanBeDivByZero)) { | |
1268 result = AssignEnvironment(result); | |
1269 } | |
1270 return result; | 1269 return result; |
1271 } else if (instr->representation().IsTagged()) { | 1270 } else if (instr->representation().IsTagged()) { |
1272 return DoArithmeticT(Token::MOD, instr); | 1271 return DoArithmeticT(Token::MOD, instr); |
1273 } else { | 1272 } else { |
1274 ASSERT(instr->representation().IsDouble()); | 1273 ASSERT(instr->representation().IsDouble()); |
1275 // We call a C function for double modulo. It can't trigger a GC. | 1274 // We call a C function for double modulo. It can't trigger a GC. |
1276 // We need to use fixed result register for the call. | 1275 // We need to use fixed result register for the call. |
1277 // TODO(fschneider): Allow any register as input registers. | 1276 // TODO(fschneider): Allow any register as input registers. |
1278 LOperand* left = UseFixedDouble(instr->left(), d1); | 1277 LOperand* left = UseFixedDouble(instr->left(), d1); |
1279 LOperand* right = UseFixedDouble(instr->right(), d2); | 1278 LOperand* right = UseFixedDouble(instr->right(), d2); |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 | 1835 |
1837 | 1836 |
1838 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 1837 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
1839 HEnvironment* outer = current_block_->last_environment()->outer(); | 1838 HEnvironment* outer = current_block_->last_environment()->outer(); |
1840 current_block_->UpdateEnvironment(outer); | 1839 current_block_->UpdateEnvironment(outer); |
1841 return NULL; | 1840 return NULL; |
1842 } | 1841 } |
1843 | 1842 |
1844 | 1843 |
1845 } } // namespace v8::internal | 1844 } } // namespace v8::internal |
OLD | NEW |