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

Unified Diff: src/compiler/node-matchers.h

Issue 638853004: [turbofan] Eliminate typed array bounds checks if both key and length are constant. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/pipeline.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/node-matchers.h
diff --git a/src/compiler/node-matchers.h b/src/compiler/node-matchers.h
index 718803f314243bec661bccf0dbf99e495f16d724..3e64ddd4f7b337202cd93ceac55a1911f3a26181 100644
--- a/src/compiler/node-matchers.h
+++ b/src/compiler/node-matchers.h
@@ -96,6 +96,41 @@ typedef FloatMatcher<double, IrOpcode::kFloat64Constant> Float64Matcher;
typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher;
+// A pattern matcher for any numberic constant.
+struct NumericValueMatcher : public NodeMatcher {
+ explicit NumericValueMatcher(Node* const node) : NodeMatcher(node) {
+ switch (opcode()) {
+ case IrOpcode::kInt32Constant:
+ has_value_ = true;
+ value_ = OpParameter<int32_t>(node);
+ break;
+ case IrOpcode::kFloat32Constant:
+ has_value_ = true;
+ value_ = OpParameter<float>(node);
+ break;
+ case IrOpcode::kFloat64Constant:
+ case IrOpcode::kNumberConstant:
+ has_value_ = true;
+ value_ = OpParameter<double>(node);
+ break;
+ default:
+ has_value_ = false;
+ break;
+ }
+ }
+
+ bool HasValue() const { return has_value_; }
+ double Value() const {
+ DCHECK(HasValue());
+ return value_;
+ }
+
+ private:
+ double value_;
+ bool has_value_;
+};
+
+
// A pattern matcher for heap object constants.
template <typename T>
struct HeapObjectMatcher FINAL
« no previous file with comments | « no previous file | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698