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

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

Issue 718193003: [turbofan] Avoid useless bit masking in typed lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « src/compiler/js-typed-lowering.h ('k') | 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 b97fa02be9708a4709e9fbde46dfb20c2b49985b..178a0628f3bb8b567fcd4bcf9821aeb4ebbabb68 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -36,6 +36,8 @@ JSTypedLowering::JSTypedLowering(JSGraph* jsgraph)
Handle<Object> one = factory->NewNumber(1.0);
zero_range_ = Type::Range(zero, zero, zone());
one_range_ = Type::Range(one, one, zone());
+ Handle<Object> thirtyone = factory->NewNumber(31.0);
+ zero_thirtyone_range_ = Type::Range(zero, thirtyone, zone());
}
@@ -79,8 +81,12 @@ class JSBinopReduction {
void ConvertInputsForShift(bool left_signed) {
node_->ReplaceInput(0, ConvertToI32(left_signed, left()));
Node* rnum = ConvertToI32(false, right());
- node_->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rnum,
- jsgraph()->Int32Constant(0x1F)));
+ Type* rnum_type = NodeProperties::GetBounds(rnum).upper;
+ if (!rnum_type->Is(lowering_->zero_thirtyone_range_)) {
+ rnum = graph()->NewNode(machine()->Word32And(), rnum,
+ jsgraph()->Int32Constant(0x1F));
+ }
+ node_->ReplaceInput(1, rnum);
}
void SwapInputs() {
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | test/cctest/compiler/test-js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698