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

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

Issue 713013003: [WIP] Modulus on copy.js. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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') | src/compiler/machine-operator.h » ('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..1479570bf94b37817f5441a08db10d2381c635c3 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -299,6 +299,21 @@ Reduction JSTypedLowering::ReduceJSMultiply(Node* node) {
}
+Reduction JSTypedLowering::ReduceJSModulus(Node* node) {
+ JSBinopReduction r(this, node);
+ if (r.left_type()->Is(NodeProperties::GetBounds(node).upper)) {
+ RelaxEffects(node);
+ return Replace(r.left());
+ }
+ if (r.BothInputsAre(Type::Primitive())) {
+ r.ConvertInputsToNumber();
+ return r.ChangeToPureOperator(simplified()->NumberModulus());
+ }
+ // TODO(turbofan): relax/remove the effects of this operator in other cases.
+ return NoChange();
+}
+
+
Reduction JSTypedLowering::ReduceNumberBinop(Node* node,
const Operator* numberOp) {
JSBinopReduction r(this, node);
@@ -757,7 +772,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: {
Reduction result = ReduceJSToBooleanInput(node->InputAt(0));
Node* value;
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698