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

Side by Side Diff: src/compiler/node-matchers.h

Issue 479793004: [turbofan] Initial import of SimplifiedOperatorReducer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 6 years, 4 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 | « src/compiler/graph-reducer.h ('k') | src/compiler/simplified-operator-reducer.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 #ifndef V8_COMPILER_NODE_MATCHERS_H_ 5 #ifndef V8_COMPILER_NODE_MATCHERS_H_
6 #define V8_COMPILER_NODE_MATCHERS_H_ 6 #define V8_COMPILER_NODE_MATCHERS_H_
7 7
8 #include "src/compiler/common-operator.h" 8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/node.h"
9 10
10 namespace v8 { 11 namespace v8 {
11 namespace internal { 12 namespace internal {
12 namespace compiler { 13 namespace compiler {
13 14
14 // A pattern matcher for nodes. 15 // A pattern matcher for nodes.
15 struct NodeMatcher { 16 struct NodeMatcher {
16 explicit NodeMatcher(Node* node) : node_(node) {} 17 explicit NodeMatcher(Node* node) : node_(node) {}
17 18
18 Node* node() const { return node_; } 19 Node* node() const { return node_; }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 template <typename T> 86 template <typename T>
86 struct FloatMatcher V8_FINAL : public ValueMatcher<T> { 87 struct FloatMatcher V8_FINAL : public ValueMatcher<T> {
87 explicit FloatMatcher(Node* node) : ValueMatcher<T>(node) {} 88 explicit FloatMatcher(Node* node) : ValueMatcher<T>(node) {}
88 89
89 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); } 90 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); }
90 }; 91 };
91 92
92 typedef FloatMatcher<double> Float64Matcher; 93 typedef FloatMatcher<double> Float64Matcher;
93 94
94 95
96 // A pattern matcher for heap object constants.
97 struct HeapObjectMatcher V8_FINAL
98 : public ValueMatcher<PrintableUnique<HeapObject> > {
99 explicit HeapObjectMatcher(Node* node)
100 : ValueMatcher<PrintableUnique<HeapObject> >(node) {}
101
102 bool IsKnownGlobal(HeapObject* global) const {
103 return HasValue() && Value().IsKnownGlobal(global);
104 }
105 };
106
107
95 // For shorter pattern matching code, this struct matches both the left and 108 // For shorter pattern matching code, this struct matches both the left and
96 // right hand sides of a binary operation and can put constants on the right 109 // right hand sides of a binary operation and can put constants on the right
97 // if they appear on the left hand side of a commutative operation. 110 // if they appear on the left hand side of a commutative operation.
98 template <typename Left, typename Right> 111 template <typename Left, typename Right>
99 struct BinopMatcher V8_FINAL : public NodeMatcher { 112 struct BinopMatcher V8_FINAL : public NodeMatcher {
100 explicit BinopMatcher(Node* node) 113 explicit BinopMatcher(Node* node)
101 : NodeMatcher(node), left_(InputAt(0)), right_(InputAt(1)) { 114 : NodeMatcher(node), left_(InputAt(0)), right_(InputAt(1)) {
102 if (HasProperty(Operator::kCommutative)) PutConstantOnRight(); 115 if (HasProperty(Operator::kCommutative)) PutConstantOnRight();
103 } 116 }
104 117
(...skipping 19 matching lines...) Expand all
124 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher; 137 typedef BinopMatcher<Int32Matcher, Int32Matcher> Int32BinopMatcher;
125 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher; 138 typedef BinopMatcher<Uint32Matcher, Uint32Matcher> Uint32BinopMatcher;
126 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher; 139 typedef BinopMatcher<Int64Matcher, Int64Matcher> Int64BinopMatcher;
127 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher; 140 typedef BinopMatcher<Uint64Matcher, Uint64Matcher> Uint64BinopMatcher;
128 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher; 141 typedef BinopMatcher<Float64Matcher, Float64Matcher> Float64BinopMatcher;
129 } 142 }
130 } 143 }
131 } // namespace v8::internal::compiler 144 } // namespace v8::internal::compiler
132 145
133 #endif // V8_COMPILER_NODE_MATCHERS_H_ 146 #endif // V8_COMPILER_NODE_MATCHERS_H_
OLDNEW
« no previous file with comments | « src/compiler/graph-reducer.h ('k') | src/compiler/simplified-operator-reducer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698