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

Side by Side Diff: src/crankshaft/hydrogen-instructions.cc

Issue 1409353005: [Crankshaft] Don't do HMathFloorOfDiv optimization for kUint32 values (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-4507.js » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/crankshaft/hydrogen-instructions.h" 5 #include "src/crankshaft/hydrogen-instructions.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/safe_math.h" 8 #include "src/base/safe_math.h"
9 #include "src/crankshaft/hydrogen-infer-representation.h" 9 #include "src/crankshaft/hydrogen-infer-representation.h"
10 #include "src/double.h" 10 #include "src/double.h"
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 if (val->representation().IsSmiOrInteger32()) { 1574 if (val->representation().IsSmiOrInteger32()) {
1575 if (val->representation().Equals(representation())) return val; 1575 if (val->representation().Equals(representation())) return val;
1576 return Prepend(new(block()->zone()) HChange( 1576 return Prepend(new(block()->zone()) HChange(
1577 val, representation(), false, false)); 1577 val, representation(), false, false));
1578 } 1578 }
1579 } 1579 }
1580 if (op() == kMathFloor && value()->IsDiv() && value()->HasOneUse()) { 1580 if (op() == kMathFloor && value()->IsDiv() && value()->HasOneUse()) {
1581 HDiv* hdiv = HDiv::cast(value()); 1581 HDiv* hdiv = HDiv::cast(value());
1582 1582
1583 HValue* left = hdiv->left(); 1583 HValue* left = hdiv->left();
1584 if (left->representation().IsInteger32()) { 1584 if (left->representation().IsInteger32() && !left->CheckFlag(kUint32)) {
1585 // A value with an integer representation does not need to be transformed. 1585 // A value with an integer representation does not need to be transformed.
1586 } else if (left->IsChange() && HChange::cast(left)->from().IsInteger32()) { 1586 } else if (left->IsChange() && HChange::cast(left)->from().IsInteger32() &&
1587 !HChange::cast(left)->value()->CheckFlag(kUint32)) {
1587 // A change from an integer32 can be replaced by the integer32 value. 1588 // A change from an integer32 can be replaced by the integer32 value.
1588 left = HChange::cast(left)->value(); 1589 left = HChange::cast(left)->value();
1589 } else if (hdiv->observed_input_representation(1).IsSmiOrInteger32()) { 1590 } else if (hdiv->observed_input_representation(1).IsSmiOrInteger32()) {
1590 left = Prepend(new(block()->zone()) HChange( 1591 left = Prepend(new(block()->zone()) HChange(
1591 left, Representation::Integer32(), false, false)); 1592 left, Representation::Integer32(), false, false));
1592 } else { 1593 } else {
1593 return this; 1594 return this;
1594 } 1595 }
1595 1596
1596 HValue* right = hdiv->right(); 1597 HValue* right = hdiv->right();
1597 if (right->IsInteger32Constant()) { 1598 if (right->IsInteger32Constant()) {
1598 right = Prepend(HConstant::cast(right)->CopyToRepresentation( 1599 right = Prepend(HConstant::cast(right)->CopyToRepresentation(
1599 Representation::Integer32(), right->block()->zone())); 1600 Representation::Integer32(), right->block()->zone()));
1600 } else if (right->representation().IsInteger32()) { 1601 } else if (right->representation().IsInteger32() &&
1602 !right->CheckFlag(kUint32)) {
1601 // A value with an integer representation does not need to be transformed. 1603 // A value with an integer representation does not need to be transformed.
1602 } else if (right->IsChange() && 1604 } else if (right->IsChange() &&
1603 HChange::cast(right)->from().IsInteger32()) { 1605 HChange::cast(right)->from().IsInteger32() &&
1606 !HChange::cast(right)->value()->CheckFlag(kUint32)) {
1604 // A change from an integer32 can be replaced by the integer32 value. 1607 // A change from an integer32 can be replaced by the integer32 value.
1605 right = HChange::cast(right)->value(); 1608 right = HChange::cast(right)->value();
1606 } else if (hdiv->observed_input_representation(2).IsSmiOrInteger32()) { 1609 } else if (hdiv->observed_input_representation(2).IsSmiOrInteger32()) {
1607 right = Prepend(new(block()->zone()) HChange( 1610 right = Prepend(new(block()->zone()) HChange(
1608 right, Representation::Integer32(), false, false)); 1611 right, Representation::Integer32(), false, false));
1609 } else { 1612 } else {
1610 return this; 1613 return this;
1611 } 1614 }
1612 1615
1613 return Prepend(HMathFloorOfDiv::New( 1616 return Prepend(HMathFloorOfDiv::New(
(...skipping 3077 matching lines...) Expand 10 before | Expand all | Expand 10 after
4691 case HObjectAccess::kExternalMemory: 4694 case HObjectAccess::kExternalMemory:
4692 os << "[external-memory]"; 4695 os << "[external-memory]";
4693 break; 4696 break;
4694 } 4697 }
4695 4698
4696 return os << "@" << access.offset(); 4699 return os << "@" << access.offset();
4697 } 4700 }
4698 4701
4699 } // namespace internal 4702 } // namespace internal
4700 } // namespace v8 4703 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-4507.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698