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

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

Issue 811293002: [turbofan] Further reduction of Word32And with Int32Add. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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
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 <cmath> 8 #include <cmath>
9 9
10 #include "src/compiler/node.h" 10 #include "src/compiler/node.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 has_value_ = true; 95 has_value_ = true;
96 } 96 }
97 } 97 }
98 98
99 99
100 // A pattern matcher for integer constants. 100 // A pattern matcher for integer constants.
101 template <typename T, IrOpcode::Value kOpcode> 101 template <typename T, IrOpcode::Value kOpcode>
102 struct IntMatcher FINAL : public ValueMatcher<T, kOpcode> { 102 struct IntMatcher FINAL : public ValueMatcher<T, kOpcode> {
103 explicit IntMatcher(Node* node) : ValueMatcher<T, kOpcode>(node) {} 103 explicit IntMatcher(Node* node) : ValueMatcher<T, kOpcode>(node) {}
104 104
105 bool IsMultipleOf(T n) const {
106 return this->HasValue() && (this->Value() % n) == 0;
107 }
105 bool IsPowerOf2() const { 108 bool IsPowerOf2() const {
106 return this->HasValue() && this->Value() > 0 && 109 return this->HasValue() && this->Value() > 0 &&
107 (this->Value() & (this->Value() - 1)) == 0; 110 (this->Value() & (this->Value() - 1)) == 0;
108 } 111 }
109 bool IsNegativePowerOf2() const { 112 bool IsNegativePowerOf2() const {
110 return this->HasValue() && this->Value() < 0 && 113 return this->HasValue() && this->Value() < 0 &&
111 (-this->Value() & (-this->Value() - 1)) == 0; 114 (-this->Value() & (-this->Value() - 1)) == 0;
112 } 115 }
113 }; 116 };
114 117
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 typedef BaseWithIndexAndDisplacementMatcher<Int32AddMatcher> 509 typedef BaseWithIndexAndDisplacementMatcher<Int32AddMatcher>
507 BaseWithIndexAndDisplacement32Matcher; 510 BaseWithIndexAndDisplacement32Matcher;
508 typedef BaseWithIndexAndDisplacementMatcher<Int64AddMatcher> 511 typedef BaseWithIndexAndDisplacementMatcher<Int64AddMatcher>
509 BaseWithIndexAndDisplacement64Matcher; 512 BaseWithIndexAndDisplacement64Matcher;
510 513
511 } // namespace compiler 514 } // namespace compiler
512 } // namespace internal 515 } // namespace internal
513 } // namespace v8 516 } // namespace v8
514 517
515 #endif // V8_COMPILER_NODE_MATCHERS_H_ 518 #endif // V8_COMPILER_NODE_MATCHERS_H_
OLDNEW
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | test/unittests/compiler/machine-operator-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698