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

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

Issue 2390823011: [turbofan] HeapConstant types should compare by handle address (Closed)
Patch Set: HeapConstantType holds a HeapObject. Created 4 years, 2 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
« no previous file with comments | « src/compiler/typer.cc ('k') | src/compiler/types.cc » ('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 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_TYPES_H_ 5 #ifndef V8_COMPILER_TYPES_H_
6 #define V8_COMPILER_TYPES_H_ 6 #define V8_COMPILER_TYPES_H_
7 7
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 CHECK(IsOtherNumberConstant(value)); 313 CHECK(IsOtherNumberConstant(value));
314 } 314 }
315 315
316 BitsetType::bitset Lub() { return BitsetType::kOtherNumber; } 316 BitsetType::bitset Lub() { return BitsetType::kOtherNumber; }
317 317
318 double value_; 318 double value_;
319 }; 319 };
320 320
321 class HeapConstantType : public TypeBase { 321 class HeapConstantType : public TypeBase {
322 public: 322 public:
323 i::Handle<i::Object> Value() { return object_; } 323 i::Handle<i::HeapObject> Value() { return object_; }
324 324
325 private: 325 private:
326 friend class Type; 326 friend class Type;
327 friend class BitsetType; 327 friend class BitsetType;
328 328
329 static Type* New(i::Handle<i::Object> value, Zone* zone) { 329 static Type* New(i::Handle<i::HeapObject> value, Zone* zone) {
330 BitsetType::bitset bitset = BitsetType::Lub(*value); 330 BitsetType::bitset bitset = BitsetType::Lub(*value);
331 return AsType(new (zone->New(sizeof(HeapConstantType))) 331 return AsType(new (zone->New(sizeof(HeapConstantType)))
332 HeapConstantType(bitset, value)); 332 HeapConstantType(bitset, value));
333 } 333 }
334 334
335 static HeapConstantType* cast(Type* type) { 335 static HeapConstantType* cast(Type* type) {
336 DCHECK(IsKind(type, kHeapConstant)); 336 DCHECK(IsKind(type, kHeapConstant));
337 return static_cast<HeapConstantType*>(FromType(type)); 337 return static_cast<HeapConstantType*>(FromType(type));
338 } 338 }
339 339
340 HeapConstantType(BitsetType::bitset bitset, i::Handle<i::Object> object); 340 HeapConstantType(BitsetType::bitset bitset, i::Handle<i::HeapObject> object);
341 341
342 BitsetType::bitset Lub() { return bitset_; } 342 BitsetType::bitset Lub() { return bitset_; }
343 343
344 BitsetType::bitset bitset_; 344 BitsetType::bitset bitset_;
345 Handle<i::Object> object_; 345 Handle<i::HeapObject> object_;
346 }; 346 };
347 347
348 // ----------------------------------------------------------------------------- 348 // -----------------------------------------------------------------------------
349 // Range types. 349 // Range types.
350 350
351 class RangeType : public TypeBase { 351 class RangeType : public TypeBase {
352 public: 352 public:
353 struct Limits { 353 struct Limits {
354 double min; 354 double min;
355 double max; 355 double max;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 static Type* SignedSmall() { 499 static Type* SignedSmall() {
500 return BitsetType::New(BitsetType::SignedSmall()); 500 return BitsetType::New(BitsetType::SignedSmall());
501 } 501 }
502 static Type* UnsignedSmall() { 502 static Type* UnsignedSmall() {
503 return BitsetType::New(BitsetType::UnsignedSmall()); 503 return BitsetType::New(BitsetType::UnsignedSmall());
504 } 504 }
505 505
506 static Type* OtherNumberConstant(double value, Zone* zone) { 506 static Type* OtherNumberConstant(double value, Zone* zone) {
507 return OtherNumberConstantType::New(value, zone); 507 return OtherNumberConstantType::New(value, zone);
508 } 508 }
509 static Type* HeapConstant(i::Handle<i::Object> value, Zone* zone) { 509 static Type* HeapConstant(i::Handle<i::HeapObject> value, Zone* zone) {
510 return HeapConstantType::New(value, zone); 510 return HeapConstantType::New(value, zone);
511 } 511 }
512 static Type* Range(double min, double max, Zone* zone) { 512 static Type* Range(double min, double max, Zone* zone) {
513 return RangeType::New(min, max, zone); 513 return RangeType::New(min, max, zone);
514 } 514 }
515 static Type* Tuple(Type* first, Type* second, Type* third, Zone* zone) { 515 static Type* Tuple(Type* first, Type* second, Type* third, Zone* zone) {
516 Type* tuple = TupleType::New(3, zone); 516 Type* tuple = TupleType::New(3, zone);
517 tuple->AsTuple()->InitElement(0, first); 517 tuple->AsTuple()->InitElement(0, first);
518 tuple->AsTuple()->InitElement(1, second); 518 tuple->AsTuple()->InitElement(1, second);
519 tuple->AsTuple()->InitElement(2, third); 519 tuple->AsTuple()->InitElement(2, third);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 RangeType::Limits* limits, Zone* zone); 639 RangeType::Limits* limits, Zone* zone);
640 static Type* NormalizeUnion(Type* unioned, int size, Zone* zone); 640 static Type* NormalizeUnion(Type* unioned, int size, Zone* zone);
641 static Type* NormalizeRangeAndBitset(Type* range, bitset* bits, Zone* zone); 641 static Type* NormalizeRangeAndBitset(Type* range, bitset* bits, Zone* zone);
642 }; 642 };
643 643
644 } // namespace compiler 644 } // namespace compiler
645 } // namespace internal 645 } // namespace internal
646 } // namespace v8 646 } // namespace v8
647 647
648 #endif // V8_COMPILER_TYPES_H_ 648 #endif // V8_COMPILER_TYPES_H_
OLDNEW
« no previous file with comments | « src/compiler/typer.cc ('k') | src/compiler/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698