Chromium Code Reviews| Index: runtime/vm/object.h |
| diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
| index a271d16546362b10a431eec655d358dcb7b8b66f..0f2476fbf66389f228f3544347ca40a79c76a031 100644 |
| --- a/runtime/vm/object.h |
| +++ b/runtime/vm/object.h |
| @@ -2822,11 +2822,12 @@ class Field : public Object { |
| set_kind_bits(DoubleInitializedBit::update(value, raw_ptr()->kind_bits_)); |
| } |
| - inline intptr_t Offset() const; |
| - inline void SetOffset(intptr_t value_in_bytes) const; |
| + inline intptr_t InstanceFieldOffset() const; |
| + inline void SetInstanceFieldOffset(intptr_t offset_in_bytes) const; |
| - RawInstance* value() const; |
| - void set_value(const Instance& value) const; |
| + RawInstance* StaticFieldValue() const; |
|
rmacnak
2015/09/01 16:54:55
FWIW, the service protocol simply calls this "stat
siva
2015/09/03 23:32:09
Acknowledged.
|
| + void SetStaticFieldValue(const Instance& value, |
| + bool save_initial_value = false) const; |
| RawClass* owner() const; |
| RawClass* origin() const; // Either mixin class, or same as owner(). |
| @@ -2850,7 +2851,12 @@ class Field : public Object { |
| // owner of the clone is new_owner. |
| RawField* Clone(const Class& new_owner) const; |
| - static intptr_t value_offset() { return OFFSET_OF(RawField, value_); } |
| + static intptr_t instance_field_offset() { |
| + return OFFSET_OF(RawField, value_.offset_); |
| + } |
| + static intptr_t static_value_offset() { |
| + return OFFSET_OF(RawField, value_.static_value_); |
| + } |
| static intptr_t kind_bits_offset() { return OFFSET_OF(RawField, kind_bits_); } |
| @@ -2961,10 +2967,16 @@ class Field : public Object { |
| void EvaluateInitializer() const; |
| - RawFunction* initializer() const { |
| - return raw_ptr()->initializer_; |
| + RawFunction* PrecompiledInitializer() const { |
| + return raw_ptr()->initializer_.precompiled_initializer_; |
| + } |
| + void SetPrecompiledInitializer(const Function& initializer) const; |
| + bool HasPrecompiledInitializer() const; |
| + |
| + RawInstance* SavedInitialStaticValue() const { |
| + return raw_ptr()->initializer_.saved_initial_value_; |
| } |
| - void set_initializer(const Function& initializer) const; |
| + void SetSavedInitialStaticValue(const Instance& value) const; |
| // For static fields only. Constructs a closure that gets/sets the |
| // field value. |
| @@ -3036,6 +3048,7 @@ class Field : public Object { |
| FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object); |
| friend class Class; |
| friend class HeapProfiler; |
| + friend class RawField; |
| }; |
| @@ -4888,7 +4901,7 @@ class Instance : public Object { |
| return reinterpret_cast<RawObject**>(raw_value() - kHeapObjectTag + offset); |
| } |
| RawObject** FieldAddr(const Field& field) const { |
| - return FieldAddrAtOffset(field.Offset()); |
| + return FieldAddrAtOffset(field.InstanceFieldOffset()); |
| } |
| RawObject** NativeFieldsAddr() const { |
| return FieldAddrAtOffset(sizeof(RawObject)); |
| @@ -7948,18 +7961,18 @@ DART_FORCE_INLINE void Object::SetRaw(RawObject* value) { |
| } |
| -intptr_t Field::Offset() const { |
| - ASSERT(!is_static()); // Offset is valid only for instance fields. |
| - intptr_t value = Smi::Value(reinterpret_cast<RawSmi*>(raw_ptr()->value_)); |
| +intptr_t Field::InstanceFieldOffset() const { |
| + ASSERT(!is_static()); // Valid only for dart instance fields. |
| + intptr_t value = Smi::Value(raw_ptr()->value_.offset_); |
| return (value * kWordSize); |
| } |
| -void Field::SetOffset(intptr_t value_in_bytes) const { |
| - ASSERT(!is_static()); // SetOffset is valid only for instance fields. |
| +void Field::SetInstanceFieldOffset(intptr_t offset_in_bytes) const { |
| + ASSERT(!is_static()); // Valid only for dart instance fields. |
| ASSERT(kWordSize != 0); |
| - StorePointer(&raw_ptr()->value_, |
| - static_cast<RawInstance*>(Smi::New(value_in_bytes / kWordSize))); |
| + StorePointer(&raw_ptr()->value_.offset_, |
| + Smi::New(offset_in_bytes / kWordSize)); |
| } |