| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr); | 1370 return MarkAsCall(new(zone()) LDeclareGlobals(context), instr); |
| 1371 } | 1371 } |
| 1372 | 1372 |
| 1373 | 1373 |
| 1374 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { | 1374 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { |
| 1375 return AssignEnvironment(new(zone()) LDeoptimize); | 1375 return AssignEnvironment(new(zone()) LDeoptimize); |
| 1376 } | 1376 } |
| 1377 | 1377 |
| 1378 | 1378 |
| 1379 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { | 1379 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
| 1380 if (instr->representation().IsInteger32()) { | 1380 if (instr->representation().IsSmiOrInteger32()) { |
| 1381 // TODO(all): Update this case to support smi inputs. | |
| 1382 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1381 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1383 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1382 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1383 |
| 1384 LOperand* dividend = UseRegister(instr->left()); |
| 1385 |
| 1384 if (instr->RightIsPowerOf2()) { | 1386 if (instr->RightIsPowerOf2()) { |
| 1385 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); | 1387 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1386 LOperand* value = UseRegisterAtStart(instr->left()); | 1388 LOperand* divisor = UseConstant(instr->right()); |
| 1387 LDivI* div = new(zone()) LDivI(value, UseConstant(instr->right()), NULL); | 1389 LDivConstI* div = new(zone()) LDivConstI(dividend, divisor); |
| 1390 return AssignEnvironment(DefineAsRegister(div)); |
| 1391 } else { |
| 1392 LOperand* divisor = UseRegister(instr->right()); |
| 1393 LOperand* temp1 = |
| 1394 instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) |
| 1395 ? NULL : TempRegister(); |
| 1396 LOperand* temp2 = instr->representation().IsSmi() ? TempRegister() : NULL; |
| 1397 LOperand* temp3 = instr->representation().IsSmi() ? TempRegister() : NULL; |
| 1398 |
| 1399 LDivI* div = new(zone()) LDivI(dividend, divisor, temp1, temp2, temp3); |
| 1388 return AssignEnvironment(DefineAsRegister(div)); | 1400 return AssignEnvironment(DefineAsRegister(div)); |
| 1389 } | 1401 } |
| 1390 LOperand* dividend = UseRegister(instr->left()); | |
| 1391 LOperand* divisor = UseRegister(instr->right()); | |
| 1392 LOperand* temp = instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32) | |
| 1393 ? NULL : TempRegister(); | |
| 1394 LDivI* div = new(zone()) LDivI(dividend, divisor, temp); | |
| 1395 return AssignEnvironment(DefineAsRegister(div)); | |
| 1396 } else if (instr->representation().IsDouble()) { | 1402 } else if (instr->representation().IsDouble()) { |
| 1397 return DoArithmeticD(Token::DIV, instr); | 1403 return DoArithmeticD(Token::DIV, instr); |
| 1398 } else { | 1404 } else { |
| 1399 return DoArithmeticT(Token::DIV, instr); | 1405 return DoArithmeticT(Token::DIV, instr); |
| 1400 } | 1406 } |
| 1401 } | 1407 } |
| 1402 | 1408 |
| 1403 | 1409 |
| 1404 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) { | 1410 LInstruction* LChunkBuilder::DoDummyUse(HDummyUse* instr) { |
| 1405 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value()))); | 1411 return DefineAsRegister(new(zone()) LDummyUse(UseAny(instr->value()))); |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2442 | 2448 |
| 2443 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2449 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2444 LOperand* receiver = UseRegister(instr->receiver()); | 2450 LOperand* receiver = UseRegister(instr->receiver()); |
| 2445 LOperand* function = UseRegister(instr->function()); | 2451 LOperand* function = UseRegister(instr->function()); |
| 2446 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2452 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
| 2447 return AssignEnvironment(DefineAsRegister(result)); | 2453 return AssignEnvironment(DefineAsRegister(result)); |
| 2448 } | 2454 } |
| 2449 | 2455 |
| 2450 | 2456 |
| 2451 } } // namespace v8::internal | 2457 } } // namespace v8::internal |
| OLD | NEW |