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

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

Issue 607033002: Take output type into account in JSTypedLowering reduction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | « no previous file | src/compiler/opcodes.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 39104bb50d2f5093669d6d627e312a0970d2c0d5..e6610a72dd51d44febd34d70e5fccd5f8192f7fe 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -630,6 +630,15 @@ static Reduction ReplaceWithReduction(Node* node, Reduction reduction) {
Reduction JSTypedLowering::Reduce(Node* node) {
+ // Check if the output type is a singleton. In that case we already know the
+ // result value and can simply replace the node unless there are effects.
+ if (node->bounds().upper->IsConstant() &&
+ !IrOpcode::IsLeafOpcode(node->opcode()) &&
+ !OperatorProperties::HasEffectOutput(node->op())) {
+ return ReplaceEagerly(node, jsgraph()->Constant(
+ node->bounds().upper->AsConstant()->Value()));
+ // TODO(neis): Extend this to Range(x,x), NaN, MinusZero, ...?
+ }
switch (node->opcode()) {
case IrOpcode::kJSEqual:
return ReduceJSEqual(node, false);
« no previous file with comments | « no previous file | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698