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

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

Issue 23452022: ARM: Improve integer multiplication. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.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 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 UseFixedDouble(right, d2)); 1504 UseFixedDouble(right, d2));
1505 return MarkAsCall(DefineFixedDouble(mod, d1), instr); 1505 return MarkAsCall(DefineFixedDouble(mod, d1), instr);
1506 } 1506 }
1507 } 1507 }
1508 1508
1509 1509
1510 LInstruction* LChunkBuilder::DoMul(HMul* instr) { 1510 LInstruction* LChunkBuilder::DoMul(HMul* instr) {
1511 if (instr->representation().IsSmiOrInteger32()) { 1511 if (instr->representation().IsSmiOrInteger32()) {
1512 ASSERT(instr->left()->representation().Equals(instr->representation())); 1512 ASSERT(instr->left()->representation().Equals(instr->representation()));
1513 ASSERT(instr->right()->representation().Equals(instr->representation())); 1513 ASSERT(instr->right()->representation().Equals(instr->representation()));
1514 LOperand* left; 1514 HValue* left = instr->BetterLeftOperand();
1515 LOperand* right = UseOrConstant(instr->BetterRightOperand()); 1515 HValue* right = instr->BetterRightOperand();
1516 LOperand* temp = NULL; 1516 LOperand* left_op;
1517 if (instr->CheckFlag(HValue::kBailoutOnMinusZero) && 1517 LOperand* right_op;
1518 (instr->CheckFlag(HValue::kCanOverflow) || 1518 bool can_overflow = instr->CheckFlag(HValue::kCanOverflow);
1519 !right->IsConstantOperand())) { 1519 bool bailout_on_minus_zero = instr->CheckFlag(HValue::kBailoutOnMinusZero);
1520 left = UseRegister(instr->BetterLeftOperand()); 1520
1521 temp = TempRegister(); 1521 if (right->IsConstant()) {
1522 HConstant* constant = HConstant::cast(right);
1523 int32_t constant_value = constant->Integer32Value();
1524 // Constants -1, 0 and 1 can be optimized if the result can overflow.
1525 // For other constants, it can be optimized only without overflow.
1526 if (!can_overflow || ((constant_value >= -1) && (constant_value <= 1))) {
1527 left_op = UseRegisterAtStart(left);
1528 right_op = UseConstant(right);
1529 } else {
1530 if (bailout_on_minus_zero) {
1531 left_op = UseRegister(left);
1532 } else {
1533 left_op = UseRegisterAtStart(left);
1534 }
1535 right_op = UseRegister(right);
1536 }
1522 } else { 1537 } else {
1523 left = UseRegisterAtStart(instr->BetterLeftOperand()); 1538 if (bailout_on_minus_zero) {
1539 left_op = UseRegister(left);
1540 } else {
1541 left_op = UseRegisterAtStart(left);
1542 }
1543 right_op = UseRegister(right);
1524 } 1544 }
1525 LMulI* mul = new(zone()) LMulI(left, right, temp); 1545 LMulI* mul = new(zone()) LMulI(left_op, right_op);
1526 if (instr->CheckFlag(HValue::kCanOverflow) || 1546 if (can_overflow || bailout_on_minus_zero) {
1527 instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
1528 AssignEnvironment(mul); 1547 AssignEnvironment(mul);
1529 } 1548 }
1530 return DefineAsRegister(mul); 1549 return DefineAsRegister(mul);
1531 1550
1532 } else if (instr->representation().IsDouble()) { 1551 } else if (instr->representation().IsDouble()) {
1533 if (instr->UseCount() == 1 && (instr->uses().value()->IsAdd() || 1552 if (instr->UseCount() == 1 && (instr->uses().value()->IsAdd() ||
1534 instr->uses().value()->IsSub())) { 1553 instr->uses().value()->IsSub())) {
1535 HBinaryOperation* use = HBinaryOperation::cast(instr->uses().value()); 1554 HBinaryOperation* use = HBinaryOperation::cast(instr->uses().value());
1536 1555
1537 if (use->IsAdd() && instr == use->left()) { 1556 if (use->IsAdd() && instr == use->left()) {
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 2602
2584 2603
2585 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2604 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2586 LOperand* object = UseRegister(instr->object()); 2605 LOperand* object = UseRegister(instr->object());
2587 LOperand* index = UseRegister(instr->index()); 2606 LOperand* index = UseRegister(instr->index());
2588 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2607 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2589 } 2608 }
2590 2609
2591 2610
2592 } } // namespace v8::internal 2611 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698