Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 // TODO(turbofan): Move ExternalReference out of assembler.h | 10 // TODO(turbofan): Move ExternalReference out of assembler.h |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 | 245 |
| 246 const Left& left() const { return left_; } | 246 const Left& left() const { return left_; } |
| 247 const Right& right() const { return right_; } | 247 const Right& right() const { return right_; } |
| 248 | 248 |
| 249 bool IsFoldable() const { return left().HasValue() && right().HasValue(); } | 249 bool IsFoldable() const { return left().HasValue() && right().HasValue(); } |
| 250 bool LeftEqualsRight() const { return left().node() == right().node(); } | 250 bool LeftEqualsRight() const { return left().node() == right().node(); } |
| 251 | 251 |
| 252 protected: | 252 protected: |
| 253 void SwapInputs() { | 253 void SwapInputs() { |
| 254 std::swap(left_, right_); | 254 std::swap(left_, right_); |
| 255 // TODO(tebbi): This modification should notify the reducers using | |
|
Michael Starzinger
2017/03/02 16:38:35
It might make sense to also file a bug on the issu
| |
| 256 // BinopMatcher. Alternatively, all reducers (especially value numbering) | |
| 257 // could ignore the ordering for commutative binops. | |
| 255 node()->ReplaceInput(0, left().node()); | 258 node()->ReplaceInput(0, left().node()); |
| 256 node()->ReplaceInput(1, right().node()); | 259 node()->ReplaceInput(1, right().node()); |
| 257 } | 260 } |
| 258 | 261 |
| 259 private: | 262 private: |
| 260 void PutConstantOnRight() { | 263 void PutConstantOnRight() { |
| 261 if (left().HasValue() && !right().HasValue()) { | 264 if (left().HasValue() && !right().HasValue()) { |
| 262 SwapInputs(); | 265 SwapInputs(); |
| 263 } | 266 } |
| 264 } | 267 } |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 718 Node* branch_; | 721 Node* branch_; |
| 719 Node* if_true_; | 722 Node* if_true_; |
| 720 Node* if_false_; | 723 Node* if_false_; |
| 721 }; | 724 }; |
| 722 | 725 |
| 723 } // namespace compiler | 726 } // namespace compiler |
| 724 } // namespace internal | 727 } // namespace internal |
| 725 } // namespace v8 | 728 } // namespace v8 |
| 726 | 729 |
| 727 #endif // V8_COMPILER_NODE_MATCHERS_H_ | 730 #endif // V8_COMPILER_NODE_MATCHERS_H_ |
| OLD | NEW |