Index: runtime/vm/object.h |
diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
index c3d39af7ec4ccca3d5e1de1c4b6c3df2fd0c2fab..13dcf3f59f57034ecfbdd33e9e0777e1b8443ef8 100644 |
--- a/runtime/vm/object.h |
+++ b/runtime/vm/object.h |
@@ -1210,6 +1210,8 @@ class Class : public Object { |
int64_t value, intptr_t* index) const; |
RawBigint* LookupCanonicalBigint(Zone* zone, |
const Bigint& value, intptr_t* index) const; |
+ RawPixels* LookupCanonicalPixels(Zone* zone, |
+ intptr_t value, intptr_t* index) const; |
// The methods above are more efficient than this generic one. |
RawInstance* LookupCanonicalInstance(Zone* zone, |
const Instance& value) const; |
@@ -6344,7 +6346,51 @@ class Bigint : public Integer { |
}; |
-// Class Double represents class Double in corelib_impl, which implements |
+class Pixels : public Number { |
+ public: |
+ static const intptr_t kFractionalBits = 6; |
+ static const intptr_t kScaling = 1 << kFractionalBits; |
+ static const intptr_t kPlusInfinity = kSmiMax32; |
+ static const intptr_t kMinusInfinity = kSmiMin32; |
+ |
+ // Returns the internal representation, i.e. the scaled value. |
+ intptr_t Value() const { |
+ return Smi::Value(raw_ptr()->value_); |
+ } |
+ virtual bool CanonicalizeEquals(const Instance& other) const; |
+ |
+ static RawPixels* New(Heap::Space space = Heap::kNew) { // For snapshots. |
+ return New(0, space); |
+ } |
+ |
+ static RawPixels* New(intptr_t value, Heap::Space space = Heap::kNew); |
+ |
+ // Returns a canonical Pixels object allocated in the old gen space. |
+ static RawPixels* NewCanonical(intptr_t value); |
+ |
+ // Returns a canonical Pixels object (allocated in the old gen space) or |
+ // Pixels::null() if str points to a string that does not convert to a |
+ // Pixels value. |
+ static RawPixels* NewCanonical(const String& str); |
+ |
+ static intptr_t InstanceSize() { |
+ return RoundedAllocationSize(sizeof(RawPixels)); |
+ } |
+ |
+ static intptr_t value_offset() { |
+ return OFFSET_OF(RawPixels, value_); |
+ } |
+ |
+ private: |
+ void set_value(intptr_t value) const; |
+ |
+ FINAL_HEAP_OBJECT_IMPLEMENTATION(Pixels, Number); |
+ friend class Class; |
+ friend class Number; |
+}; |
+ |
+ |
+// Class Double represents Dart class _Double in runtime/lib, which implements |
// abstract class double in corelib. |
class Double : public Number { |
public: |