Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/ia32/lithium-ia32.cc

Issue 212703002: Consistently use a separate Lithium instruction for flooring division. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added TODOs Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 dividend, divisor, temp1, temp2), edx); 1358 dividend, divisor, temp1, temp2), edx);
1359 if (divisor == 0 || 1359 if (divisor == 0 ||
1360 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || 1360 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1361 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { 1361 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) {
1362 result = AssignEnvironment(result); 1362 result = AssignEnvironment(result);
1363 } 1363 }
1364 return result; 1364 return result;
1365 } 1365 }
1366 1366
1367 1367
1368 LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) { 1368 LInstruction* LChunkBuilder::DoDivI(HDiv* instr) {
1369 ASSERT(instr->representation().IsSmiOrInteger32()); 1369 ASSERT(instr->representation().IsSmiOrInteger32());
1370 ASSERT(instr->left()->representation().Equals(instr->representation())); 1370 ASSERT(instr->left()->representation().Equals(instr->representation()));
1371 ASSERT(instr->right()->representation().Equals(instr->representation())); 1371 ASSERT(instr->right()->representation().Equals(instr->representation()));
1372 LOperand* dividend = UseFixed(instr->left(), eax); 1372 LOperand* dividend = UseFixed(instr->left(), eax);
1373 LOperand* divisor = UseRegister(instr->right()); 1373 LOperand* divisor = UseRegister(instr->right());
1374 LOperand* temp = FixedTemp(edx); 1374 LOperand* temp = FixedTemp(edx);
1375 LInstruction* result = DefineFixed(new(zone()) LDivI( 1375 LInstruction* result = DefineFixed(new(zone()) LDivI(
1376 dividend, divisor, temp), eax); 1376 dividend, divisor, temp), eax);
1377 if (instr->CheckFlag(HValue::kCanBeDivByZero) || 1377 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1378 instr->CheckFlag(HValue::kBailoutOnMinusZero) || 1378 instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1379 instr->CheckFlag(HValue::kCanOverflow) || 1379 instr->CheckFlag(HValue::kCanOverflow) ||
1380 (!instr->IsMathFloorOfDiv() && 1380 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32)) {
1381 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32))) {
1382 result = AssignEnvironment(result); 1381 result = AssignEnvironment(result);
1383 } 1382 }
1384 return result; 1383 return result;
1385 } 1384 }
1386 1385
1387 1386
1388 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { 1387 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1389 if (instr->representation().IsSmiOrInteger32()) { 1388 if (instr->representation().IsSmiOrInteger32()) {
1390 if (instr->RightIsPowerOf2()) { 1389 if (instr->RightIsPowerOf2()) {
1391 return DoDivByPowerOf2I(instr); 1390 return DoDivByPowerOf2I(instr);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 temp3), 1434 temp3),
1436 edx); 1435 edx);
1437 if (divisor == 0 || 1436 if (divisor == 0 ||
1438 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { 1437 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) {
1439 result = AssignEnvironment(result); 1438 result = AssignEnvironment(result);
1440 } 1439 }
1441 return result; 1440 return result;
1442 } 1441 }
1443 1442
1444 1443
1444 LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) {
1445 ASSERT(instr->representation().IsSmiOrInteger32());
1446 ASSERT(instr->left()->representation().Equals(instr->representation()));
1447 ASSERT(instr->right()->representation().Equals(instr->representation()));
1448 LOperand* dividend = UseFixed(instr->left(), eax);
1449 LOperand* divisor = UseRegister(instr->right());
1450 LOperand* temp = FixedTemp(edx);
1451 LInstruction* result = DefineFixed(new(zone()) LFlooringDivI(
1452 dividend, divisor, temp), eax);
1453 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1454 instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1455 instr->CheckFlag(HValue::kCanOverflow)) {
1456 result = AssignEnvironment(result);
1457 }
1458 return result;
1459 }
1460
1461
1445 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { 1462 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1446 if (instr->RightIsPowerOf2()) { 1463 if (instr->RightIsPowerOf2()) {
1447 return DoFlooringDivByPowerOf2I(instr); 1464 return DoFlooringDivByPowerOf2I(instr);
1448 } else if (instr->right()->IsConstant()) { 1465 } else if (instr->right()->IsConstant()) {
1449 return DoFlooringDivByConstI(instr); 1466 return DoFlooringDivByConstI(instr);
1450 } else { 1467 } else {
1451 return DoDivI(instr); 1468 return DoFlooringDivI(instr);
1452 } 1469 }
1453 } 1470 }
1454 1471
1455 1472
1456 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { 1473 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
1457 ASSERT(instr->representation().IsSmiOrInteger32()); 1474 ASSERT(instr->representation().IsSmiOrInteger32());
1458 ASSERT(instr->left()->representation().Equals(instr->representation())); 1475 ASSERT(instr->left()->representation().Equals(instr->representation()));
1459 ASSERT(instr->right()->representation().Equals(instr->representation())); 1476 ASSERT(instr->right()->representation().Equals(instr->representation()));
1460 LOperand* dividend = UseRegisterAtStart(instr->left()); 1477 LOperand* dividend = UseRegisterAtStart(instr->left());
1461 int32_t divisor = instr->right()->GetInteger32Constant(); 1478 int32_t divisor = instr->right()->GetInteger32Constant();
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 LOperand* index = UseTempRegister(instr->index()); 2711 LOperand* index = UseTempRegister(instr->index());
2695 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); 2712 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index);
2696 LInstruction* result = DefineSameAsFirst(load); 2713 LInstruction* result = DefineSameAsFirst(load);
2697 return AssignPointerMap(result); 2714 return AssignPointerMap(result);
2698 } 2715 }
2699 2716
2700 2717
2701 } } // namespace v8::internal 2718 } } // namespace v8::internal
2702 2719
2703 #endif // V8_TARGET_ARCH_IA32 2720 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698