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

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

Issue 1170433002: [turbofan] Don't lower to NumberModulus unless the inputs are numbers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tests. Created 5 years, 7 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 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 0f6f38cb0f38f120163956faf008373631c0b6d1..2f0497f50393415217b011aa4c71a9a1a3b66f8a 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -388,10 +388,21 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
}
+Reduction JSTypedLowering::ReduceJSModulus(Node* node) {
+ JSBinopReduction r(this, node);
+ if (r.BothInputsAre(Type::Number())) {
+ // JSModulus(x:number, x:number) => NumberModulus(x, y)
+ return r.ChangeToPureOperator(simplified()->NumberModulus(),
+ Type::Number());
+ }
+ return NoChange();
+}
+
+
Reduction JSTypedLowering::ReduceNumberBinop(Node* node,
const Operator* numberOp) {
JSBinopReduction r(this, node);
- if (r.IsStrong()) {
+ if (r.IsStrong() || numberOp == simplified()->NumberModulus()) {
if (r.BothInputsAre(Type::Number())) {
return r.ChangeToPureOperator(numberOp, Type::Number());
}
@@ -1469,7 +1480,7 @@ Reduction JSTypedLowering::Reduce(Node* node) {
case IrOpcode::kJSDivide:
return ReduceNumberBinop(node, simplified()->NumberDivide());
case IrOpcode::kJSModulus:
- return ReduceNumberBinop(node, simplified()->NumberModulus());
+ return ReduceJSModulus(node);
case IrOpcode::kJSUnaryNot:
return ReduceJSUnaryNot(node);
case IrOpcode::kJSToBoolean:
« 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