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

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 721723004: [turbofan] Remove int32 add/subtract narrowing during typed lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Resurrect tests Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/compiler/test-js-typed-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index 178a0628f3bb8b567fcd4bcf9821aeb4ebbabb68..9f9e6f9cc1e61f1694de5f962390c34268e1cc54 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -179,48 +179,10 @@ class JSBinopReduction {
return n;
}
- // Try narrowing a double or number operation to an Int32 operation.
- bool TryNarrowingToI32(Type* type, Node* node) {
- switch (node->opcode()) {
- case IrOpcode::kFloat64Add:
- case IrOpcode::kNumberAdd: {
- JSBinopReduction r(lowering_, node);
- if (r.BothInputsAre(Type::Integral32())) {
- node->set_op(lowering_->machine()->Int32Add());
- // TODO(titzer): narrow bounds instead of overwriting.
- NodeProperties::SetBounds(node, Bounds(type));
- return true;
- }
- }
- case IrOpcode::kFloat64Sub:
- case IrOpcode::kNumberSubtract: {
- JSBinopReduction r(lowering_, node);
- if (r.BothInputsAre(Type::Integral32())) {
- node->set_op(lowering_->machine()->Int32Sub());
- // TODO(titzer): narrow bounds instead of overwriting.
- NodeProperties::SetBounds(node, Bounds(type));
- return true;
- }
- }
- default:
- return false;
- }
- }
-
Node* ConvertToI32(bool is_signed, Node* node) {
- Type* type = is_signed ? Type::Signed32() : Type::Unsigned32();
- if (node->OwnedBy(node_)) {
- // If this node {node_} has the only edge to {node}, then try narrowing
- // its operation to an Int32 add or subtract.
- if (TryNarrowingToI32(type, node)) return node;
- } else {
- // Otherwise, {node} has multiple uses. Leave it as is and let the
- // further lowering passes deal with it, which use a full backwards
- // fixpoint.
- }
-
// Avoid introducing too many eager NumberToXXnt32() operations.
node = ConvertToNumber(node);
+ Type* type = is_signed ? Type::Signed32() : Type::Unsigned32();
Type* input_type = NodeProperties::GetBounds(node).upper;
if (input_type->Is(type)) return node; // already in the value range.
« no previous file with comments | « no previous file | test/cctest/compiler/test-js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698