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

Unified Diff: runtime/vm/object.h

Issue 1722733002: In background compilation make a copy of Field in order to freeze its state (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: e Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 98cf34dc19ef58707557eb00ae5bfe5f5f750514..a552daf77eabd31f310ecaccf9822dafbd859399 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -2881,6 +2881,22 @@ class RedirectionData: public Object {
class Field : public Object {
public:
+ RawField* Original() const;
+ Field* OriginalAsHandle(Zone* zone = NULL) const {
+ if (zone == NULL) {
+ zone = Thread::Current()->zone();
+ }
+ return &Field::ZoneHandle(zone, Original());
+ }
siva 2016/02/25 23:38:33 Can this function be moved to the callers (e.g ast
srdjan 2016/02/26 00:40:43 Removed function.
+ void SetOriginal(const Field& value) const;
+ bool IsOriginal() const {
+ return Original() == this->raw();
siva 2016/02/25 23:38:33 Wouldn't it be easier to just do: { if (IsNull()
srdjan 2016/02/26 00:40:43 Adapted: bool IsOriginal() const { if (IsNul
+ }
+
+ // Returns ZoneHandle of a field cloned from 'this'. 'this' is set as the
+ // original field of result.
+ Field* CloneFromOriginal() const;
siva 2016/02/25 23:38:33 RawField* CloneFromOriginal() const; (See comment
srdjan 2016/02/26 00:40:43 Returning RawField*
+
RawString* name() const { return raw_ptr()->name_; }
RawString* UserVisibleName() const; // Same as scrubbed name.
virtual RawString* DictionaryName() const { return name(); }
@@ -2892,6 +2908,7 @@ class Field : public Object {
return ReflectableBit::decode(raw_ptr()->kind_bits_);
}
void set_is_reflectable(bool value) const {
+ ASSERT(IsOriginal());
set_kind_bits(ReflectableBit::update(value, raw_ptr()->kind_bits_));
}
bool is_double_initialized() const {
@@ -2901,6 +2918,7 @@ class Field : public Object {
// Marks fields that are initialized with a simple double constant.
void set_is_double_initialized(bool value) const {
ASSERT(Thread::Current()->IsMutatorThread());
+ ASSERT(IsOriginal());
set_kind_bits(DoubleInitializedBit::update(value, raw_ptr()->kind_bits_));
}
@@ -2912,10 +2930,10 @@ class Field : public Object {
inline void SetStaticValue(const Instance& value,
bool save_initial_value = false) const;
- RawClass* owner() const;
- RawClass* origin() const; // Either mixin class, or same as owner().
- RawScript* script() const;
- RawObject* RawOwner() const { return raw_ptr()->owner_; }
+ RawClass* Owner() const;
+ RawClass* Origin() const; // Either mixin class, or same as owner().
+ RawScript* Script() const;
+ RawObject* RawOwner() const;
RawAbstractType* type() const { return raw_ptr()->type_; }
// Used by class finalizer, otherwise initialized in constructor.
@@ -2943,6 +2961,9 @@ class Field : public Object {
// Allocate new field object, clone values from this field. The
// owner of the clone is new_owner.
RawField* Clone(const Class& new_owner) const;
+ // Allocate new field object, clone values from this field. The
+ // original is specified.
+ RawField* Clone(const Field& original) const;
static intptr_t instance_field_offset() {
return OFFSET_OF(RawField, value_.offset_);
@@ -2960,6 +2981,7 @@ class Field : public Object {
}
// Called by parser after allocating field.
void set_has_initializer(bool has_initializer) const {
+ ASSERT(IsOriginal());
ASSERT(Thread::Current()->IsMutatorThread());
set_kind_bits(HasInitializerBit::update(has_initializer,
raw_ptr()->kind_bits_));
@@ -2971,6 +2993,7 @@ class Field : public Object {
intptr_t guarded_cid() const { return raw_ptr()->guarded_cid_; }
void set_guarded_cid(intptr_t cid) const {
+ ASSERT(IsOriginal());
ASSERT(Thread::Current()->IsMutatorThread());
StoreNonPointer(&raw_ptr()->guarded_cid_, cid);
}
@@ -3010,6 +3033,7 @@ class Field : public Object {
// Default 'true', set to false once optimizing compiler determines it should
// be boxed.
void set_is_unboxing_candidate(bool b) const {
+ ASSERT(IsOriginal());
set_kind_bits(UnboxingCandidateBit::update(b, raw_ptr()->kind_bits_));
}
@@ -3031,6 +3055,7 @@ class Field : public Object {
return raw_ptr()->is_nullable_ == kNullCid;
}
void set_is_nullable(bool val) const {
+ ASSERT(IsOriginal());
ASSERT(Thread::Current()->IsMutatorThread());
StoreNonPointer(&raw_ptr()->is_nullable_, val ? kNullCid : kIllegalCid);
}

Powered by Google App Engine
This is Rietveld 408576698