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

Unified Diff: runtime/vm/object.h

Issue 208323015: Support deferred library prefix syntax (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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
===================================================================
--- runtime/vm/object.h (revision 34312)
+++ runtime/vm/object.h (working copy)
@@ -447,7 +447,6 @@
static RawClass* token_stream_class() { return token_stream_class_; }
static RawClass* script_class() { return script_class_; }
static RawClass* library_class() { return library_class_; }
- static RawClass* library_prefix_class() { return library_prefix_class_; }
static RawClass* namespace_class() { return namespace_class_; }
static RawClass* code_class() { return code_class_; }
static RawClass* instructions_class() { return instructions_class_; }
@@ -598,7 +597,6 @@
static RawClass* token_stream_class_; // Class of the TokenStream vm object.
static RawClass* script_class_; // Class of the Script vm object.
static RawClass* library_class_; // Class of the Library vm object.
- static RawClass* library_prefix_class_; // Class of Library prefix vm object.
static RawClass* namespace_class_; // Class of Namespace vm object.
static RawClass* code_class_; // Class of the Code vm object.
static RawClass* instructions_class_; // Class of the Instructions vm object.
@@ -2611,6 +2609,14 @@
raw_ptr()->debuggable_ = value;
}
+ bool IsDeferred() const {
Ivan Posva 2014/03/27 07:38:48 The deferred state is not part of the library. It
hausner 2014/03/27 20:45:39 When I started this change I thought we'd need to
+ return raw_ptr()->deferred_load_;
+ }
+ void set_deferred_load() const {
+ raw_ptr()->deferred_load_ = true;
+ }
+
+
bool IsCoreLibrary() const {
return raw() == CoreLibrary();
}
@@ -2707,41 +2713,6 @@
};
-class LibraryPrefix : public Object {
- public:
- RawString* name() const { return raw_ptr()->name_; }
- virtual RawString* DictionaryName() const { return name(); }
-
- RawArray* imports() const { return raw_ptr()->imports_; }
- intptr_t num_imports() const { return raw_ptr()->num_imports_; }
-
- bool ContainsLibrary(const Library& library) const;
- RawLibrary* GetLibrary(int index) const;
- void AddImport(const Namespace& import) const;
- RawObject* LookupObject(const String& name) const;
- RawClass* LookupClass(const String& class_name) const;
-
- static intptr_t InstanceSize() {
- return RoundedAllocationSize(sizeof(RawLibraryPrefix));
- }
-
- static RawLibraryPrefix* New(const String& name, const Namespace& import);
-
- private:
- static const int kInitialSize = 2;
- static const int kIncrementSize = 2;
-
- void set_name(const String& value) const;
- void set_imports(const Array& value) const;
- void set_num_imports(intptr_t value) const;
-
- static RawLibraryPrefix* New();
-
- FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object);
- friend class Class;
-};
-
-
// A Namespace contains the names in a library dictionary, filtered by
// the show/hide combinators.
class Namespace : public Object {
@@ -4106,6 +4077,58 @@
};
+class LibraryPrefix : public Instance {
+ public:
+ RawString* name() const { return raw_ptr()->name_; }
+ virtual RawString* DictionaryName() const { return name(); }
+
+ RawArray* imports() const { return raw_ptr()->imports_; }
+ intptr_t num_imports() const { return raw_ptr()->num_imports_; }
+
+ bool ContainsLibrary(const Library& library) const;
+ RawLibrary* GetLibrary(int index) const;
+ void AddImport(const Namespace& import) const;
+ RawObject* LookupObject(const String& name) const;
+ RawClass* LookupClass(const String& class_name) const;
+
+ bool is_deferred_load() const { return raw_ptr()->is_deferred_load_; }
Ivan Posva 2014/03/27 07:38:48 Maybe just is_deferred?
hausner 2014/03/27 20:45:39 I think in the places where is_deferred_load() is
+ bool is_loaded() const { return raw_ptr()->is_loaded_; }
+ void LoadLibrary() const;
+
+ // Return the list of code objects that were compiled when this
+ // prefix was not yet loaded. These code objects will be thrown
Ivan Posva 2014/03/27 07:38:48 thrown away -> invalidated
hausner 2014/03/27 20:45:39 Done.
+ // away when the prefix is loaded.
+ RawArray* dependent_code() const;
+ void set_dependent_code(const Array& array) const;
+
+ // Add the given code object to the list of dependent ones.
+ void RegisterDependentCode(const Code& code) const;
+ void NukeDependentCode() const;
Ivan Posva 2014/03/27 07:38:48 InvalidateDependentCode
hausner 2014/03/27 20:45:39 Nukular-free zone? Done.
+
+ static intptr_t InstanceSize() {
+ return RoundedAllocationSize(sizeof(RawLibraryPrefix));
+ }
+
+ static RawLibraryPrefix* New(const String& name,
+ const Namespace& import,
+ bool deferred_load);
+
+ private:
+ static const int kInitialSize = 2;
+ static const int kIncrementSize = 2;
+
+ void set_name(const String& value) const;
+ void set_imports(const Array& value) const;
+ void set_num_imports(intptr_t value) const;
+ void set_is_loaded() const;
+
+ static RawLibraryPrefix* New();
+
+ FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Instance);
+ friend class Class;
+};
+
+
// AbstractType is an abstract superclass.
// Subclasses of AbstractType are Type and TypeParameter.
class AbstractType : public Instance {

Powered by Google App Engine
This is Rietveld 408576698