| Index: src/compiler/node-matchers.h
|
| diff --git a/src/compiler/node-matchers.h b/src/compiler/node-matchers.h
|
| index d543425fca48606a0947291dc13bda6ecaa1c9cd..054aee9c1a4fbb29959494ef3498b58b80dc7a78 100644
|
| --- a/src/compiler/node-matchers.h
|
| +++ b/src/compiler/node-matchers.h
|
| @@ -62,14 +62,6 @@ struct ValueMatcher : public NodeMatcher {
|
| return value_;
|
| }
|
|
|
| - bool Is(const T& value) const {
|
| - return this->HasValue() && this->Value() == value;
|
| - }
|
| -
|
| - bool IsInRange(const T& low, const T& high) const {
|
| - return this->HasValue() && low <= this->Value() && this->Value() <= high;
|
| - }
|
| -
|
| private:
|
| T value_;
|
| bool has_value_;
|
| @@ -108,6 +100,12 @@ template <typename T, IrOpcode::Value kOpcode>
|
| struct IntMatcher final : public ValueMatcher<T, kOpcode> {
|
| explicit IntMatcher(Node* node) : ValueMatcher<T, kOpcode>(node) {}
|
|
|
| + bool Is(const T& value) const {
|
| + return this->HasValue() && this->Value() == value;
|
| + }
|
| + bool IsInRange(const T& low, const T& high) const {
|
| + return this->HasValue() && low <= this->Value() && this->Value() <= high;
|
| + }
|
| bool IsMultipleOf(T n) const {
|
| return this->HasValue() && (this->Value() % n) == 0;
|
| }
|
| @@ -139,6 +137,12 @@ template <typename T, IrOpcode::Value kOpcode>
|
| struct FloatMatcher final : public ValueMatcher<T, kOpcode> {
|
| explicit FloatMatcher(Node* node) : ValueMatcher<T, kOpcode>(node) {}
|
|
|
| + bool Is(const T& value) const {
|
| + return this->HasValue() && this->Value() == value;
|
| + }
|
| + bool IsInRange(const T& low, const T& high) const {
|
| + return this->HasValue() && low <= this->Value() && this->Value() <= high;
|
| + }
|
| bool IsMinusZero() const {
|
| return this->Is(0.0) && std::signbit(this->Value());
|
| }
|
| @@ -153,9 +157,9 @@ typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher;
|
|
|
| // A pattern matcher for heap object constants.
|
| struct HeapObjectMatcher final
|
| - : public ValueMatcher<Unique<HeapObject>, IrOpcode::kHeapConstant> {
|
| + : public ValueMatcher<Handle<HeapObject>, IrOpcode::kHeapConstant> {
|
| explicit HeapObjectMatcher(Node* node)
|
| - : ValueMatcher<Unique<HeapObject>, IrOpcode::kHeapConstant>(node) {}
|
| + : ValueMatcher<Handle<HeapObject>, IrOpcode::kHeapConstant>(node) {}
|
| };
|
|
|
|
|
| @@ -164,6 +168,9 @@ struct ExternalReferenceMatcher final
|
| : public ValueMatcher<ExternalReference, IrOpcode::kExternalConstant> {
|
| explicit ExternalReferenceMatcher(Node* node)
|
| : ValueMatcher<ExternalReference, IrOpcode::kExternalConstant>(node) {}
|
| + bool Is(const ExternalReference& value) const {
|
| + return this->HasValue() && this->Value() == value;
|
| + }
|
| };
|
|
|
|
|
|
|