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

Side by Side Diff: src/compiler/operator.h

Issue 543743002: Remove deprecated PrintableUnique. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/node-matchers.h ('k') | src/compiler/raw-machine-assembler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_OPERATOR_H_ 5 #ifndef V8_COMPILER_OPERATOR_H_
6 #define V8_COMPILER_OPERATOR_H_ 6 #define V8_COMPILER_OPERATOR_H_
7 7
8 #include "src/base/flags.h" 8 #include "src/base/flags.h"
9 #include "src/ostreams.h" 9 #include "src/ostreams.h"
10 #include "src/unique.h" 10 #include "src/unique.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 return os << val; 171 return os << val;
172 } 172 }
173 static int HashCode(double a) { 173 static int HashCode(double a) {
174 return static_cast<int>(BitCast<int64_t>(a)); 174 return static_cast<int>(BitCast<int64_t>(a));
175 } 175 }
176 static bool Equals(double a, double b) { 176 static bool Equals(double a, double b) {
177 return BitCast<int64_t>(a) == BitCast<int64_t>(b); 177 return BitCast<int64_t>(a) == BitCast<int64_t>(b);
178 } 178 }
179 }; 179 };
180 180
181 // Specialization for static parameters of type {PrintableUnique<Object>}. 181 // Specialization for static parameters of type {Unique<Object>}.
182 template <> 182 template <>
183 struct StaticParameterTraits<PrintableUnique<Object> > { 183 struct StaticParameterTraits<Unique<Object> > {
184 static OStream& PrintTo(OStream& os, PrintableUnique<Object> val) { // NOLINT 184 static OStream& PrintTo(OStream& os, Unique<Object> val) { // NOLINT
185 return os << val.string(); 185 return os << Brief(*val.handle());
186 } 186 }
187 static int HashCode(PrintableUnique<Object> a) { 187 static int HashCode(Unique<Object> a) {
188 return static_cast<int>(a.Hashcode()); 188 return static_cast<int>(a.Hashcode());
189 } 189 }
190 static bool Equals(PrintableUnique<Object> a, PrintableUnique<Object> b) { 190 static bool Equals(Unique<Object> a, Unique<Object> b) { return a == b; }
191 return a == b;
192 }
193 }; 191 };
194 192
195 // Specialization for static parameters of type {PrintableUnique<Name>}. 193 // Specialization for static parameters of type {Unique<Name>}.
196 template <> 194 template <>
197 struct StaticParameterTraits<PrintableUnique<Name> > { 195 struct StaticParameterTraits<Unique<Name> > {
198 static OStream& PrintTo(OStream& os, PrintableUnique<Name> val) { // NOLINT 196 static OStream& PrintTo(OStream& os, Unique<Name> val) { // NOLINT
199 return os << val.string(); 197 return os << Brief(*val.handle());
200 } 198 }
201 static int HashCode(PrintableUnique<Name> a) { 199 static int HashCode(Unique<Name> a) { return static_cast<int>(a.Hashcode()); }
202 return static_cast<int>(a.Hashcode()); 200 static bool Equals(Unique<Name> a, Unique<Name> b) { return a == b; }
203 }
204 static bool Equals(PrintableUnique<Name> a, PrintableUnique<Name> b) {
205 return a == b;
206 }
207 }; 201 };
208 202
209 #if DEBUG 203 #if DEBUG
210 // Specialization for static parameters of type {Handle<Object>} to prevent any 204 // Specialization for static parameters of type {Handle<Object>} to prevent any
211 // direct usage of Handles in constants. 205 // direct usage of Handles in constants.
212 template <> 206 template <>
213 struct StaticParameterTraits<Handle<Object> > { 207 struct StaticParameterTraits<Handle<Object> > {
214 static OStream& PrintTo(OStream& os, Handle<Object> val) { // NOLINT 208 static OStream& PrintTo(OStream& os, Handle<Object> val) { // NOLINT
215 UNREACHABLE(); // Should use PrintableUnique<Object> instead 209 UNREACHABLE(); // Should use Unique<Object> instead
216 return os; 210 return os;
217 } 211 }
218 static int HashCode(Handle<Object> a) { 212 static int HashCode(Handle<Object> a) {
219 UNREACHABLE(); // Should use PrintableUnique<Object> instead 213 UNREACHABLE(); // Should use Unique<Object> instead
220 return 0; 214 return 0;
221 } 215 }
222 static bool Equals(Handle<Object> a, Handle<Object> b) { 216 static bool Equals(Handle<Object> a, Handle<Object> b) {
223 UNREACHABLE(); // Should use PrintableUnique<Object> instead 217 UNREACHABLE(); // Should use Unique<Object> instead
224 return false; 218 return false;
225 } 219 }
226 }; 220 };
227 #endif 221 #endif
228 222
229 // A templatized implementation of Operator that has one static parameter of 223 // A templatized implementation of Operator that has one static parameter of
230 // type {T}. If a specialization of StaticParameterTraits<{T}> exists, then 224 // type {T}. If a specialization of StaticParameterTraits<{T}> exists, then
231 // operators of this kind can automatically be hashed, compared, and printed. 225 // operators of this kind can automatically be hashed, compared, and printed.
232 template <typename T> 226 template <typename T>
233 class Operator1 : public Operator { 227 class Operator1 : public Operator {
(...skipping 26 matching lines...) Expand all
260 return PrintParameter(os << mnemonic()); 254 return PrintParameter(os << mnemonic());
261 } 255 }
262 256
263 private: 257 private:
264 int input_count_; 258 int input_count_;
265 int output_count_; 259 int output_count_;
266 T parameter_; 260 T parameter_;
267 }; 261 };
268 262
269 // Type definitions for operators with specific types of parameters. 263 // Type definitions for operators with specific types of parameters.
270 typedef Operator1<PrintableUnique<Name> > NameOperator; 264 typedef Operator1<Unique<Name> > NameOperator;
271 265
272 266
273 // Helper to extract parameters from Operator1<*> operator. 267 // Helper to extract parameters from Operator1<*> operator.
274 template <typename T> 268 template <typename T>
275 static inline T OpParameter(const Operator* op) { 269 static inline T OpParameter(const Operator* op) {
276 return reinterpret_cast<const Operator1<T>*>(op)->parameter(); 270 return reinterpret_cast<const Operator1<T>*>(op)->parameter();
277 } 271 }
278 272
279 } // namespace compiler 273 } // namespace compiler
280 } // namespace internal 274 } // namespace internal
281 } // namespace v8 275 } // namespace v8
282 276
283 #endif // V8_COMPILER_OPERATOR_H_ 277 #endif // V8_COMPILER_OPERATOR_H_
OLDNEW
« no previous file with comments | « src/compiler/node-matchers.h ('k') | src/compiler/raw-machine-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698