| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2056 | 2056 |
| 2057 void Register() const; | 2057 void Register() const; |
| 2058 | 2058 |
| 2059 bool IsDebuggable() const { | 2059 bool IsDebuggable() const { |
| 2060 return raw_ptr()->debuggable_; | 2060 return raw_ptr()->debuggable_; |
| 2061 } | 2061 } |
| 2062 void set_debuggable(bool value) const { | 2062 void set_debuggable(bool value) const { |
| 2063 raw_ptr()->debuggable_ = value; | 2063 raw_ptr()->debuggable_ = value; |
| 2064 } | 2064 } |
| 2065 | 2065 |
| 2066 RawString* DuplicateDefineErrorString(const String& entry_name, | |
| 2067 const Library& conflicting_lib) const; | |
| 2068 static RawLibrary* LookupLibrary(const String& url); | 2066 static RawLibrary* LookupLibrary(const String& url); |
| 2069 static RawLibrary* GetLibrary(intptr_t index); | 2067 static RawLibrary* GetLibrary(intptr_t index); |
| 2070 static RawString* CheckForDuplicateDefinition(); | |
| 2071 static bool IsKeyUsed(intptr_t key); | 2068 static bool IsKeyUsed(intptr_t key); |
| 2072 | 2069 |
| 2073 static void InitCoreLibrary(Isolate* isolate); | 2070 static void InitCoreLibrary(Isolate* isolate); |
| 2074 static void InitMathLibrary(Isolate* isolate); | 2071 static void InitMathLibrary(Isolate* isolate); |
| 2075 static void InitIsolateLibrary(Isolate* isolate); | 2072 static void InitIsolateLibrary(Isolate* isolate); |
| 2076 static void InitMirrorsLibrary(Isolate* isolate); | 2073 static void InitMirrorsLibrary(Isolate* isolate); |
| 2077 static RawLibrary* CoreLibrary(); | 2074 static RawLibrary* CoreLibrary(); |
| 2078 static RawLibrary* CoreImplLibrary(); | 2075 static RawLibrary* CoreImplLibrary(); |
| 2079 static RawLibrary* MathLibrary(); | 2076 static RawLibrary* MathLibrary(); |
| 2080 static RawLibrary* IsolateLibrary(); | 2077 static RawLibrary* IsolateLibrary(); |
| 2081 static RawLibrary* MirrorsLibrary(); | 2078 static RawLibrary* MirrorsLibrary(); |
| 2082 static void InitNativeWrappersLibrary(Isolate* isolate); | 2079 static void InitNativeWrappersLibrary(Isolate* isolate); |
| 2083 static RawLibrary* NativeWrappersLibrary(); | 2080 static RawLibrary* NativeWrappersLibrary(); |
| 2084 | 2081 |
| 2085 // Eagerly compile all classes and functions in the library. | 2082 // Eagerly compile all classes and functions in the library. |
| 2086 static RawError* CompileAll(); | 2083 static RawError* CompileAll(); |
| 2087 | 2084 |
| 2088 private: | 2085 private: |
| 2089 static const int kInitialImportsCapacity = 4; | 2086 static const int kInitialImportsCapacity = 4; |
| 2090 static const int kImportsCapacityIncrement = 8; | 2087 static const int kImportsCapacityIncrement = 8; |
| 2091 static const int kInitialImportedIntoCapacity = 1; | |
| 2092 static const int kImportedIntoCapacityIncrement = 2; | |
| 2093 static RawLibrary* New(); | 2088 static RawLibrary* New(); |
| 2094 | 2089 |
| 2095 void set_num_imports(intptr_t value) const { | 2090 void set_num_imports(intptr_t value) const { |
| 2096 raw_ptr()->num_imports_ = value; | 2091 raw_ptr()->num_imports_ = value; |
| 2097 } | 2092 } |
| 2098 intptr_t num_imported_into() const { return raw_ptr()->num_imported_into_; } | |
| 2099 void set_num_imported_into(intptr_t value) const { | |
| 2100 raw_ptr()->num_imported_into_ = value; | |
| 2101 } | |
| 2102 RawArray* imports() const { return raw_ptr()->imports_; } | 2093 RawArray* imports() const { return raw_ptr()->imports_; } |
| 2103 RawArray* imported_into() const { return raw_ptr()->imported_into_; } | |
| 2104 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } | 2094 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } |
| 2105 RawArray* dictionary() const { return raw_ptr()->dictionary_; } | 2095 RawArray* dictionary() const { return raw_ptr()->dictionary_; } |
| 2106 void InitClassDictionary() const; | 2096 void InitClassDictionary() const; |
| 2107 void InitImportList() const; | 2097 void InitImportList() const; |
| 2108 void InitImportedIntoList() const; | |
| 2109 void GrowDictionary(const Array& dict, intptr_t dict_size) const; | 2098 void GrowDictionary(const Array& dict, intptr_t dict_size) const; |
| 2110 static RawLibrary* NewLibraryHelper(const String& url, | 2099 static RawLibrary* NewLibraryHelper(const String& url, |
| 2111 bool import_core_lib); | 2100 bool import_core_lib); |
| 2112 void AddImportedInto(const Library& library) const; | |
| 2113 RawObject* LookupEntry(const String& name, intptr_t *index) const; | 2101 RawObject* LookupEntry(const String& name, intptr_t *index) const; |
| 2114 RawObject* LookupObjectFiltered(const String& name, | |
| 2115 const Library& filter_lib) const; | |
| 2116 RawLibrary* LookupObjectInImporter(const String& name) const; | |
| 2117 RawString* FindDuplicateDefinition() const; | |
| 2118 | 2102 |
| 2119 HEAP_OBJECT_IMPLEMENTATION(Library, Object); | 2103 HEAP_OBJECT_IMPLEMENTATION(Library, Object); |
| 2120 friend class Class; | 2104 friend class Class; |
| 2121 friend class Debugger; | 2105 friend class Debugger; |
| 2122 friend class DictionaryIterator; | 2106 friend class DictionaryIterator; |
| 2123 friend class Isolate; | 2107 friend class Isolate; |
| 2124 }; | 2108 }; |
| 2125 | 2109 |
| 2126 | 2110 |
| 2127 class LibraryPrefix : public Object { | 2111 class LibraryPrefix : public Object { |
| 2128 public: | 2112 public: |
| 2129 RawString* name() const { return raw_ptr()->name_; } | 2113 RawString* name() const { return raw_ptr()->name_; } |
| 2130 RawArray* libraries() const { return raw_ptr()->libraries_; } | 2114 RawArray* libraries() const { return raw_ptr()->libraries_; } |
| 2131 intptr_t num_libs() const { return raw_ptr()->num_libs_; } | 2115 intptr_t num_libs() const { return raw_ptr()->num_libs_; } |
| 2132 | 2116 |
| 2133 bool ContainsLibrary(const Library& library) const; | 2117 bool ContainsLibrary(const Library& library) const; |
| 2134 RawLibrary* GetLibrary(int index) const; | 2118 RawLibrary* GetLibrary(int index) const; |
| 2135 void AddLibrary(const Library& library) const; | 2119 void AddLibrary(const Library& library) const; |
| 2136 RawClass* LookupLocalClass(const String& class_name) const; | 2120 RawClass* LookupLocalClass(const String& class_name) const; |
| 2137 RawString* CheckForDuplicateDefinition() const; | |
| 2138 | 2121 |
| 2139 static intptr_t InstanceSize() { | 2122 static intptr_t InstanceSize() { |
| 2140 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); | 2123 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); |
| 2141 } | 2124 } |
| 2142 | 2125 |
| 2143 static RawLibraryPrefix* New(const String& name, const Library& lib); | 2126 static RawLibraryPrefix* New(const String& name, const Library& lib); |
| 2144 | 2127 |
| 2145 private: | 2128 private: |
| 2146 static const int kInitialSize = 2; | 2129 static const int kInitialSize = 2; |
| 2147 static const int kIncrementSize = 2; | 2130 static const int kIncrementSize = 2; |
| (...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5550 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5533 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5551 return false; | 5534 return false; |
| 5552 } | 5535 } |
| 5553 } | 5536 } |
| 5554 return true; | 5537 return true; |
| 5555 } | 5538 } |
| 5556 | 5539 |
| 5557 } // namespace dart | 5540 } // namespace dart |
| 5558 | 5541 |
| 5559 #endif // VM_OBJECT_H_ | 5542 #endif // VM_OBJECT_H_ |
| OLD | NEW |