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

Side by Side 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, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/compiler/opcodes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/access-builder.h" 5 #include "src/compiler/access-builder.h"
6 #include "src/compiler/graph-inl.h" 6 #include "src/compiler/graph-inl.h"
7 #include "src/compiler/js-builtin-reducer.h" 7 #include "src/compiler/js-builtin-reducer.h"
8 #include "src/compiler/js-typed-lowering.h" 8 #include "src/compiler/js-typed-lowering.h"
9 #include "src/compiler/node-aux-data-inl.h" 9 #include "src/compiler/node-aux-data-inl.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 static Reduction ReplaceWithReduction(Node* node, Reduction reduction) { 623 static Reduction ReplaceWithReduction(Node* node, Reduction reduction) {
624 if (reduction.Changed()) { 624 if (reduction.Changed()) {
625 NodeProperties::ReplaceWithValue(node, reduction.replacement()); 625 NodeProperties::ReplaceWithValue(node, reduction.replacement());
626 return reduction; 626 return reduction;
627 } 627 }
628 return Reducer::NoChange(); 628 return Reducer::NoChange();
629 } 629 }
630 630
631 631
632 Reduction JSTypedLowering::Reduce(Node* node) { 632 Reduction JSTypedLowering::Reduce(Node* node) {
633 // Check if the output type is a singleton. In that case we already know the
634 // result value and can simply replace the node unless there are effects.
635 if (node->bounds().upper->IsConstant() &&
636 !IrOpcode::IsLeafOpcode(node->opcode()) &&
637 !OperatorProperties::HasEffectOutput(node->op())) {
638 return ReplaceEagerly(node, jsgraph()->Constant(
639 node->bounds().upper->AsConstant()->Value()));
640 // TODO(neis): Extend this to Range(x,x), NaN, MinusZero, ...?
641 }
633 switch (node->opcode()) { 642 switch (node->opcode()) {
634 case IrOpcode::kJSEqual: 643 case IrOpcode::kJSEqual:
635 return ReduceJSEqual(node, false); 644 return ReduceJSEqual(node, false);
636 case IrOpcode::kJSNotEqual: 645 case IrOpcode::kJSNotEqual:
637 return ReduceJSEqual(node, true); 646 return ReduceJSEqual(node, true);
638 case IrOpcode::kJSStrictEqual: 647 case IrOpcode::kJSStrictEqual:
639 return ReduceJSStrictEqual(node, false); 648 return ReduceJSStrictEqual(node, false);
640 case IrOpcode::kJSStrictNotEqual: 649 case IrOpcode::kJSStrictNotEqual:
641 return ReduceJSStrictEqual(node, true); 650 return ReduceJSStrictEqual(node, true);
642 case IrOpcode::kJSLessThan: // fall through 651 case IrOpcode::kJSLessThan: // fall through
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 return JSBuiltinReducer(jsgraph()).Reduce(node); 711 return JSBuiltinReducer(jsgraph()).Reduce(node);
703 default: 712 default:
704 break; 713 break;
705 } 714 }
706 return NoChange(); 715 return NoChange();
707 } 716 }
708 717
709 } // namespace compiler 718 } // namespace compiler
710 } // namespace internal 719 } // namespace internal
711 } // namespace v8 720 } // namespace v8
OLDNEW
« 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