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

Unified Diff: runtime/vm/object.h

Issue 1410383020: Eliminate all but one top-level class per library. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address Review Comments Created 5 years, 1 month 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
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 3d36a76859cb210e9648811c0b039a22e6865e7b..9000362f5e7b99c5442567c42fc69139171862e8 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -1716,8 +1716,8 @@ class TypeArguments : public Object {
class PatchClass : public Object {
public:
RawClass* patched_class() const { return raw_ptr()->patched_class_; }
- RawClass* source_class() const { return raw_ptr()->source_class_; }
- RawScript* Script() const;
+ RawClass* origin_class() const { return raw_ptr()->origin_class_; }
+ RawScript* script() const { return raw_ptr()->script_; }
static intptr_t InstanceSize() {
return RoundedAllocationSize(sizeof(RawPatchClass));
@@ -1728,11 +1728,15 @@ class PatchClass : public Object {
}
static RawPatchClass* New(const Class& patched_class,
- const Class& source_class);
+ const Class& origin_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_origin_class(const Class& value) const;
+ void set_script(const Script& value) const;
static RawPatchClass* New();
@@ -2136,6 +2140,7 @@ class Function : public Object {
RawClass* Owner() const;
RawClass* origin() const;
RawScript* script() const;
+ RawObject* RawOwner() const { return raw_ptr()->owner_; }
RawJSRegExp* regexp() const;
intptr_t string_specialization_cid() const;
@@ -2863,6 +2868,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_);
}
@@ -2883,6 +2891,8 @@ class Field : public Object {
RawClass* owner() const;
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.
@@ -2901,6 +2911,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;
@@ -3089,9 +3105,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());
}
@@ -3317,6 +3330,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
};
@@ -3324,7 +3339,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();
@@ -3332,9 +3349,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);
};
@@ -3430,17 +3445,19 @@ class Library : public Object {
void AddExport(const Namespace& ns) const;
void AddClassMetadata(const Class& cls,
- const Class& toplevel_class,
+ const Object& 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 Object& 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_;
@@ -3588,7 +3605,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;
@@ -3611,7 +3628,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 Object& owner, intptr_t token_pos);
RawObject* GetMetadata() const;
static intptr_t InstanceSize() {
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698