Chromium Code Reviews| Index: runtime/vm/object.h |
| diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
| index 94e480f2d0deddd4e9be390b9a19fff709ef4854..0e790c22a13e4a3ae773e8171bacfadd848f81ff 100644 |
| --- a/runtime/vm/object.h |
| +++ b/runtime/vm/object.h |
| @@ -1720,7 +1720,7 @@ class PatchClass : public Object { |
| public: |
| RawClass* patched_class() const { return raw_ptr()->patched_class_; } |
| RawClass* source_class() const { return raw_ptr()->source_class_; } |
|
Ivan Posva
2015/11/24 21:30:11
origin_class() or just origin()?
hausner
2015/11/24 22:45:35
origin_class(). Done.
|
| - RawScript* Script() const; |
| + RawScript* script() const { return raw_ptr()->script_; } |
| static intptr_t InstanceSize() { |
| return RoundedAllocationSize(sizeof(RawPatchClass)); |
| @@ -1733,9 +1733,13 @@ class PatchClass : public Object { |
| static RawPatchClass* New(const Class& patched_class, |
| const Class& source_class); |
| + static RawPatchClass* New(const Class& patched_class, |
| + const Script& source); |
| + |
| private: |
| void set_patched_class(const Class& value) const; |
| void set_source_class(const Class& value) const; |
| + void set_script(const Script& value) const; |
| static RawPatchClass* New(); |
| @@ -2138,6 +2142,7 @@ class Function : public Object { |
| RawClass* Owner() const; |
| RawClass* origin() const; |
|
Ivan Posva
2015/11/24 21:30:12
Origin()
hausner
2015/11/24 22:45:35
Leaving origin(), as discussed offline.
|
| RawScript* script() const; |
|
Ivan Posva
2015/11/24 21:30:12
Script()
hausner
2015/11/24 22:45:35
Leaving lower-case due to name conflict with class
|
| + RawObject* RawOwner() const { return raw_ptr()->owner_; } |
| RawJSRegExp* regexp() const; |
| intptr_t string_specialization_cid() const; |
| @@ -2865,6 +2870,9 @@ class Field : public Object { |
| bool is_reflectable() const { |
| return ReflectableBit::decode(raw_ptr()->kind_bits_); |
| } |
| + void set_is_reflectable(bool value) const { |
| + set_kind_bits(ReflectableBit::update(value, raw_ptr()->kind_bits_)); |
| + } |
| bool is_double_initialized() const { |
| return DoubleInitializedBit::decode(raw_ptr()->kind_bits_); |
| } |
| @@ -2885,6 +2893,8 @@ class Field : public Object { |
| RawClass* owner() const; |
|
Ivan Posva
2015/11/24 21:30:11
Owner(), Origin(), Script()
|
| RawClass* origin() const; // Either mixin class, or same as owner(). |
| + RawScript* script() const; |
| + RawObject* RawOwner() const { return raw_ptr()->owner_; } |
| RawAbstractType* type() const { return raw_ptr()->type_; } |
| // Used by class finalizer, otherwise initialized in constructor. |
| @@ -2903,6 +2913,12 @@ class Field : public Object { |
| const AbstractType& type, |
| intptr_t token_pos); |
| + static RawField* NewTopLevel(const String& name, |
| + bool is_final, |
| + bool is_const, |
| + const Object& owner, |
| + intptr_t token_pos); |
| + |
| // Allocate new field object, clone values from this field. The |
| // owner of the clone is new_owner. |
| RawField* Clone(const Class& new_owner) const; |
| @@ -3091,9 +3107,6 @@ class Field : public Object { |
| void set_is_const(bool value) const { |
| set_kind_bits(ConstBit::update(value, raw_ptr()->kind_bits_)); |
| } |
| - void set_is_reflectable(bool value) const { |
| - set_kind_bits(ReflectableBit::update(value, raw_ptr()->kind_bits_)); |
| - } |
| void set_owner(const Object& value) const { |
| StorePointer(&raw_ptr()->owner_, value.raw()); |
| } |
| @@ -3319,6 +3332,8 @@ class DictionaryIterator : public ValueObject { |
| class ClassDictionaryIterator : public DictionaryIterator { |
| public: |
| enum IterationKind { |
| + // TODO(hausner): fix call sites that use kIteratePrivate. There is only |
| + // one top-level class per library left, not an array to iterate over. |
| kIteratePrivate, |
| kNoIteratePrivate |
| }; |
| @@ -3326,7 +3341,9 @@ class ClassDictionaryIterator : public DictionaryIterator { |
| ClassDictionaryIterator(const Library& library, |
| IterationKind kind = kNoIteratePrivate); |
| - bool HasNext() const { return (next_ix_ < size_) || (anon_ix_ < anon_size_); } |
| + bool HasNext() const { |
| + return (next_ix_ < size_) || !toplevel_class_.IsNull(); |
| + } |
| // Returns a non-null raw class. |
| RawClass* GetNextClass(); |
| @@ -3334,9 +3351,7 @@ class ClassDictionaryIterator : public DictionaryIterator { |
| private: |
| void MoveToNextClass(); |
| - const Array& anon_array_; |
| - const int anon_size_; // Number of anonymous classes to iterate over. |
| - int anon_ix_; // Index of next anonymous class. |
| + Class& toplevel_class_; |
| DISALLOW_COPY_AND_ASSIGN(ClassDictionaryIterator); |
| }; |
| @@ -3432,17 +3447,19 @@ class Library : public Object { |
| void AddExport(const Namespace& ns) const; |
| void AddClassMetadata(const Class& cls, |
| - const Class& toplevel_class, |
| + const PatchClass& tl_owner, |
| intptr_t token_pos) const; |
| void AddFieldMetadata(const Field& field, intptr_t token_pos) const; |
| void AddFunctionMetadata(const Function& func, intptr_t token_pos) const; |
| - void AddLibraryMetadata(const Class& cls, intptr_t token_pos) const; |
| + void AddLibraryMetadata(const PatchClass& tl_owner, intptr_t token_pos) const; |
| void AddTypeParameterMetadata(const TypeParameter& param, |
| intptr_t token_pos) const; |
| RawObject* GetMetadata(const Object& obj) const; |
| - intptr_t num_anonymous_classes() const { return raw_ptr()->num_anonymous_; } |
| - RawArray* anonymous_classes() const { return raw_ptr()->anonymous_classes_; } |
| + RawClass* toplevel_class() const { |
| + return raw_ptr()->toplevel_class_; |
| + } |
| + void set_toplevel_class(const Class& value) const; |
| RawGrowableObjectArray* patch_classes() const { |
| return raw_ptr()->patch_classes_; |
| @@ -3590,7 +3607,7 @@ class Library : public Object { |
| RawString* MakeMetadataName(const Object& obj) const; |
| RawField* GetMetadataField(const String& metaname) const; |
| - void AddMetadata(const Class& cls, |
| + void AddMetadata(const Object& owner, |
| const String& name, |
| intptr_t token_pos) const; |
| @@ -3613,7 +3630,7 @@ class Namespace : public Object { |
| RawArray* show_names() const { return raw_ptr()->show_names_; } |
| RawArray* hide_names() const { return raw_ptr()->hide_names_; } |
| - void AddMetadata(intptr_t token_pos, const Class& owner_class); |
| + void AddMetadata(const PatchClass& owner, intptr_t token_pos); |
| RawObject* GetMetadata() const; |
| static intptr_t InstanceSize() { |