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

Side by Side Diff: src/x64/lithium-x64.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/x64/lithium-x64.h ('k') | no next file » | 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 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 dividend, divisor, temp1, temp2), rdx); 1303 dividend, divisor, temp1, temp2), rdx);
1304 if (divisor == 0 || 1304 if (divisor == 0 ||
1305 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || 1305 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) ||
1306 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { 1306 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) {
1307 result = AssignEnvironment(result); 1307 result = AssignEnvironment(result);
1308 } 1308 }
1309 return result; 1309 return result;
1310 } 1310 }
1311 1311
1312 1312
1313 LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) { 1313 LInstruction* LChunkBuilder::DoDivI(HDiv* instr) {
1314 ASSERT(instr->representation().IsSmiOrInteger32()); 1314 ASSERT(instr->representation().IsSmiOrInteger32());
1315 ASSERT(instr->left()->representation().Equals(instr->representation())); 1315 ASSERT(instr->left()->representation().Equals(instr->representation()));
1316 ASSERT(instr->right()->representation().Equals(instr->representation())); 1316 ASSERT(instr->right()->representation().Equals(instr->representation()));
1317 LOperand* dividend = UseFixed(instr->left(), rax); 1317 LOperand* dividend = UseFixed(instr->left(), rax);
1318 LOperand* divisor = UseRegister(instr->right()); 1318 LOperand* divisor = UseRegister(instr->right());
1319 LOperand* temp = FixedTemp(rdx); 1319 LOperand* temp = FixedTemp(rdx);
1320 LInstruction* result = DefineFixed(new(zone()) LDivI( 1320 LInstruction* result = DefineFixed(new(zone()) LDivI(
1321 dividend, divisor, temp), rax); 1321 dividend, divisor, temp), rax);
1322 if (instr->CheckFlag(HValue::kCanBeDivByZero) || 1322 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1323 instr->CheckFlag(HValue::kBailoutOnMinusZero) || 1323 instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1324 instr->CheckFlag(HValue::kCanOverflow) || 1324 instr->CheckFlag(HValue::kCanOverflow) ||
1325 (!instr->IsMathFloorOfDiv() && 1325 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32)) {
1326 !instr->CheckFlag(HValue::kAllUsesTruncatingToInt32))) {
1327 result = AssignEnvironment(result); 1326 result = AssignEnvironment(result);
1328 } 1327 }
1329 return result; 1328 return result;
1330 } 1329 }
1331 1330
1332 1331
1333 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { 1332 LInstruction* LChunkBuilder::DoDiv(HDiv* instr) {
1334 if (instr->representation().IsSmiOrInteger32()) { 1333 if (instr->representation().IsSmiOrInteger32()) {
1335 if (instr->RightIsPowerOf2()) { 1334 if (instr->RightIsPowerOf2()) {
1336 return DoDivByPowerOf2I(instr); 1335 return DoDivByPowerOf2I(instr);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 temp3), 1379 temp3),
1381 rdx); 1380 rdx);
1382 if (divisor == 0 || 1381 if (divisor == 0 ||
1383 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { 1382 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) {
1384 result = AssignEnvironment(result); 1383 result = AssignEnvironment(result);
1385 } 1384 }
1386 return result; 1385 return result;
1387 } 1386 }
1388 1387
1389 1388
1389 LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) {
1390 ASSERT(instr->representation().IsSmiOrInteger32());
1391 ASSERT(instr->left()->representation().Equals(instr->representation()));
1392 ASSERT(instr->right()->representation().Equals(instr->representation()));
1393 LOperand* dividend = UseFixed(instr->left(), rax);
1394 LOperand* divisor = UseRegister(instr->right());
1395 LOperand* temp = FixedTemp(rdx);
1396 LInstruction* result = DefineFixed(new(zone()) LFlooringDivI(
1397 dividend, divisor, temp), rax);
1398 if (instr->CheckFlag(HValue::kCanBeDivByZero) ||
1399 instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
1400 instr->CheckFlag(HValue::kCanOverflow)) {
1401 result = AssignEnvironment(result);
1402 }
1403 return result;
1404 }
1405
1406
1390 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { 1407 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1391 if (instr->RightIsPowerOf2()) { 1408 if (instr->RightIsPowerOf2()) {
1392 return DoFlooringDivByPowerOf2I(instr); 1409 return DoFlooringDivByPowerOf2I(instr);
1393 } else if (instr->right()->IsConstant()) { 1410 } else if (instr->right()->IsConstant()) {
1394 return DoFlooringDivByConstI(instr); 1411 return DoFlooringDivByConstI(instr);
1395 } else { 1412 } else {
1396 return DoDivI(instr); 1413 return DoFlooringDivI(instr);
1397 } 1414 }
1398 } 1415 }
1399 1416
1400 1417
1401 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { 1418 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) {
1402 ASSERT(instr->representation().IsSmiOrInteger32()); 1419 ASSERT(instr->representation().IsSmiOrInteger32());
1403 ASSERT(instr->left()->representation().Equals(instr->representation())); 1420 ASSERT(instr->left()->representation().Equals(instr->representation()));
1404 ASSERT(instr->right()->representation().Equals(instr->representation())); 1421 ASSERT(instr->right()->representation().Equals(instr->representation()));
1405 LOperand* dividend = UseRegisterAtStart(instr->left()); 1422 LOperand* dividend = UseRegisterAtStart(instr->left());
1406 int32_t divisor = instr->right()->GetInteger32Constant(); 1423 int32_t divisor = instr->right()->GetInteger32Constant();
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
2581 LOperand* index = UseTempRegister(instr->index()); 2598 LOperand* index = UseTempRegister(instr->index());
2582 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); 2599 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index);
2583 LInstruction* result = DefineSameAsFirst(load); 2600 LInstruction* result = DefineSameAsFirst(load);
2584 return AssignPointerMap(result); 2601 return AssignPointerMap(result);
2585 } 2602 }
2586 2603
2587 2604
2588 } } // namespace v8::internal 2605 } } // namespace v8::internal
2589 2606
2590 #endif // V8_TARGET_ARCH_X64 2607 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698