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

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

Issue 1196623002: [ubsan] Fix HeapObjectMatcher to avoid invalid casts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE Created 5 years, 6 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
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 // TODO(turbofan): Move ExternalReference out of assembler.h 10 // TODO(turbofan): Move ExternalReference out of assembler.h
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); } 145 bool IsNaN() const { return this->HasValue() && std::isnan(this->Value()); }
146 bool IsZero() const { return this->Is(0.0) && !std::signbit(this->Value()); } 146 bool IsZero() const { return this->Is(0.0) && !std::signbit(this->Value()); }
147 }; 147 };
148 148
149 typedef FloatMatcher<float, IrOpcode::kFloat32Constant> Float32Matcher; 149 typedef FloatMatcher<float, IrOpcode::kFloat32Constant> Float32Matcher;
150 typedef FloatMatcher<double, IrOpcode::kFloat64Constant> Float64Matcher; 150 typedef FloatMatcher<double, IrOpcode::kFloat64Constant> Float64Matcher;
151 typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher; 151 typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher;
152 152
153 153
154 // A pattern matcher for heap object constants. 154 // A pattern matcher for heap object constants.
155 template <typename T>
156 struct HeapObjectMatcher final 155 struct HeapObjectMatcher final
157 : public ValueMatcher<Unique<T>, IrOpcode::kHeapConstant> { 156 : public ValueMatcher<Unique<HeapObject>, IrOpcode::kHeapConstant> {
158 explicit HeapObjectMatcher(Node* node) 157 explicit HeapObjectMatcher(Node* node)
159 : ValueMatcher<Unique<T>, IrOpcode::kHeapConstant>(node) {} 158 : ValueMatcher<Unique<HeapObject>, IrOpcode::kHeapConstant>(node) {}
160 }; 159 };
161 160
162 161
163 // A pattern matcher for external reference constants. 162 // A pattern matcher for external reference constants.
164 struct ExternalReferenceMatcher final 163 struct ExternalReferenceMatcher final
165 : public ValueMatcher<ExternalReference, IrOpcode::kExternalConstant> { 164 : public ValueMatcher<ExternalReference, IrOpcode::kExternalConstant> {
166 explicit ExternalReferenceMatcher(Node* node) 165 explicit ExternalReferenceMatcher(Node* node)
167 : ValueMatcher<ExternalReference, IrOpcode::kExternalConstant>(node) {} 166 : ValueMatcher<ExternalReference, IrOpcode::kExternalConstant>(node) {}
168 }; 167 };
169 168
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 Node* branch_; 590 Node* branch_;
592 Node* if_true_; 591 Node* if_true_;
593 Node* if_false_; 592 Node* if_false_;
594 }; 593 };
595 594
596 } // namespace compiler 595 } // namespace compiler
597 } // namespace internal 596 } // namespace internal
598 } // namespace v8 597 } // namespace v8
599 598
600 #endif // V8_COMPILER_NODE_MATCHERS_H_ 599 #endif // V8_COMPILER_NODE_MATCHERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698