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

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

Issue 1841513003: [crankshaft] Address the deoptimization loops of Math.floor, Math.round and Math.ceil. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Register constraints in Crankshaft are fun Created 4 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
« no previous file with comments | « src/crankshaft/hydrogen-instructions.h ('k') | src/crankshaft/ia32/lithium-codegen-ia32.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 // 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 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 HValue* HUnaryMathOperation::Canonicalize() { 1477 HValue* HUnaryMathOperation::Canonicalize() {
1478 if (op() == kMathRound || op() == kMathFloor) { 1478 if (op() == kMathRound || op() == kMathFloor) {
1479 HValue* val = value(); 1479 HValue* val = value();
1480 if (val->IsChange()) val = HChange::cast(val)->value(); 1480 if (val->IsChange()) val = HChange::cast(val)->value();
1481 if (val->representation().IsSmiOrInteger32()) { 1481 if (val->representation().IsSmiOrInteger32()) {
1482 if (val->representation().Equals(representation())) return val; 1482 if (val->representation().Equals(representation())) return val;
1483 return Prepend(new(block()->zone()) HChange( 1483 return Prepend(new(block()->zone()) HChange(
1484 val, representation(), false, false)); 1484 val, representation(), false, false));
1485 } 1485 }
1486 } 1486 }
1487 if (op() == kMathFloor && value()->IsDiv() && value()->HasOneUse()) { 1487 if (op() == kMathFloor && representation().IsSmiOrInteger32() &&
1488 value()->IsDiv() && value()->HasOneUse()) {
1488 HDiv* hdiv = HDiv::cast(value()); 1489 HDiv* hdiv = HDiv::cast(value());
1489 1490
1490 HValue* left = hdiv->left(); 1491 HValue* left = hdiv->left();
1491 if (left->representation().IsInteger32() && !left->CheckFlag(kUint32)) { 1492 if (left->representation().IsInteger32() && !left->CheckFlag(kUint32)) {
1492 // A value with an integer representation does not need to be transformed. 1493 // A value with an integer representation does not need to be transformed.
1493 } else if (left->IsChange() && HChange::cast(left)->from().IsInteger32() && 1494 } else if (left->IsChange() && HChange::cast(left)->from().IsInteger32() &&
1494 !HChange::cast(left)->value()->CheckFlag(kUint32)) { 1495 !HChange::cast(left)->value()->CheckFlag(kUint32)) {
1495 // A change from an integer32 can be replaced by the integer32 value. 1496 // A change from an integer32 can be replaced by the integer32 value.
1496 left = HChange::cast(left)->value(); 1497 left = HChange::cast(left)->value();
1497 } else if (hdiv->observed_input_representation(1).IsSmiOrInteger32()) { 1498 } else if (hdiv->observed_input_representation(1).IsSmiOrInteger32()) {
(...skipping 2631 matching lines...) Expand 10 before | Expand all | Expand 10 after
4129 case HObjectAccess::kExternalMemory: 4130 case HObjectAccess::kExternalMemory:
4130 os << "[external-memory]"; 4131 os << "[external-memory]";
4131 break; 4132 break;
4132 } 4133 }
4133 4134
4134 return os << "@" << access.offset(); 4135 return os << "@" << access.offset();
4135 } 4136 }
4136 4137
4137 } // namespace internal 4138 } // namespace internal
4138 } // namespace v8 4139 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen-instructions.h ('k') | src/crankshaft/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698