| 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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 | 1343 |
| 1344 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1344 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
| 1345 if (instr->representation().IsInteger32()) { | 1345 if (instr->representation().IsInteger32()) { |
| 1346 // TODO(1042) The fixed register allocation | 1346 // TODO(1042) The fixed register allocation |
| 1347 // is needed because we call GenericBinaryOpStub from | 1347 // is needed because we call GenericBinaryOpStub from |
| 1348 // the generated code, which requires registers r0 | 1348 // the generated code, which requires registers r0 |
| 1349 // and r1 to be used. We should remove that | 1349 // and r1 to be used. We should remove that |
| 1350 // when we provide a native implementation. | 1350 // when we provide a native implementation. |
| 1351 ASSERT(instr->left()->representation().IsInteger32()); | 1351 ASSERT(instr->left()->representation().IsInteger32()); |
| 1352 ASSERT(instr->right()->representation().IsInteger32()); | 1352 ASSERT(instr->right()->representation().IsInteger32()); |
| 1353 LOperand* value = UseFixed(instr->left(), r0); | 1353 |
| 1354 LOperand* divisor = UseFixed(instr->right(), r1); | 1354 LInstruction* result; |
| 1355 LInstruction* result = DefineFixed(new LModI(value, divisor), r0); | 1355 if (instr->HasPowerOf2Divisor()) { |
| 1356 result = AssignEnvironment(AssignPointerMap(result)); | 1356 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1357 LOperand* value = UseRegisterAtStart(instr->left()); |
| 1358 LModI* mod = new LModI(value, UseOrConstant(instr->right())); |
| 1359 result = DefineSameAsFirst(mod); |
| 1360 result = AssignEnvironment(result); |
| 1361 } else { |
| 1362 LOperand* value = UseFixed(instr->left(), r0); |
| 1363 LOperand* divisor = UseFixed(instr->right(), r1); |
| 1364 result = DefineFixed(new LModI(value, divisor), r0); |
| 1365 result = AssignEnvironment(AssignPointerMap(result)); |
| 1366 } |
| 1367 |
| 1357 return result; | 1368 return result; |
| 1358 } else if (instr->representation().IsTagged()) { | 1369 } else if (instr->representation().IsTagged()) { |
| 1359 return DoArithmeticT(Token::MOD, instr); | 1370 return DoArithmeticT(Token::MOD, instr); |
| 1360 } else { | 1371 } else { |
| 1361 ASSERT(instr->representation().IsDouble()); | 1372 ASSERT(instr->representation().IsDouble()); |
| 1362 // We call a C function for double modulo. It can't trigger a GC. | 1373 // We call a C function for double modulo. It can't trigger a GC. |
| 1363 // We need to use fixed result register for the call. | 1374 // We need to use fixed result register for the call. |
| 1364 // TODO(fschneider): Allow any register as input registers. | 1375 // TODO(fschneider): Allow any register as input registers. |
| 1365 LOperand* left = UseFixedDouble(instr->left(), d1); | 1376 LOperand* left = UseFixedDouble(instr->left(), d1); |
| 1366 LOperand* right = UseFixedDouble(instr->right(), d2); | 1377 LOperand* right = UseFixedDouble(instr->right(), d2); |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2038 | 2049 |
| 2039 | 2050 |
| 2040 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2051 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2041 HEnvironment* outer = current_block_->last_environment()->outer(); | 2052 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 2042 current_block_->UpdateEnvironment(outer); | 2053 current_block_->UpdateEnvironment(outer); |
| 2043 return NULL; | 2054 return NULL; |
| 2044 } | 2055 } |
| 2045 | 2056 |
| 2046 | 2057 |
| 2047 } } // namespace v8::internal | 2058 } } // namespace v8::internal |
| OLD | NEW |