| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 265 } |
| 266 static RawClass* patch_class_class() { return patch_class_class_; } | 266 static RawClass* patch_class_class() { return patch_class_class_; } |
| 267 static RawClass* function_class() { return function_class_; } | 267 static RawClass* function_class() { return function_class_; } |
| 268 static RawClass* closure_data_class() { return closure_data_class_; } | 268 static RawClass* closure_data_class() { return closure_data_class_; } |
| 269 static RawClass* field_class() { return field_class_; } | 269 static RawClass* field_class() { return field_class_; } |
| 270 static RawClass* literal_token_class() { return literal_token_class_; } | 270 static RawClass* literal_token_class() { return literal_token_class_; } |
| 271 static RawClass* token_stream_class() { return token_stream_class_; } | 271 static RawClass* token_stream_class() { return token_stream_class_; } |
| 272 static RawClass* script_class() { return script_class_; } | 272 static RawClass* script_class() { return script_class_; } |
| 273 static RawClass* library_class() { return library_class_; } | 273 static RawClass* library_class() { return library_class_; } |
| 274 static RawClass* library_prefix_class() { return library_prefix_class_; } | 274 static RawClass* library_prefix_class() { return library_prefix_class_; } |
| 275 static RawClass* namespace_class() { return namespace_class_; } |
| 275 static RawClass* code_class() { return code_class_; } | 276 static RawClass* code_class() { return code_class_; } |
| 276 static RawClass* instructions_class() { return instructions_class_; } | 277 static RawClass* instructions_class() { return instructions_class_; } |
| 277 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } | 278 static RawClass* pc_descriptors_class() { return pc_descriptors_class_; } |
| 278 static RawClass* stackmap_class() { return stackmap_class_; } | 279 static RawClass* stackmap_class() { return stackmap_class_; } |
| 279 static RawClass* var_descriptors_class() { return var_descriptors_class_; } | 280 static RawClass* var_descriptors_class() { return var_descriptors_class_; } |
| 280 static RawClass* exception_handlers_class() { | 281 static RawClass* exception_handlers_class() { |
| 281 return exception_handlers_class_; | 282 return exception_handlers_class_; |
| 282 } | 283 } |
| 283 static RawClass* deopt_info_class() { return deopt_info_class_; } | 284 static RawClass* deopt_info_class() { return deopt_info_class_; } |
| 284 static RawClass* context_class() { return context_class_; } | 285 static RawClass* context_class() { return context_class_; } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 static RawClass* instantiated_type_arguments_class_; // Class of Inst..ments. | 397 static RawClass* instantiated_type_arguments_class_; // Class of Inst..ments. |
| 397 static RawClass* patch_class_class_; // Class of the PatchClass vm object. | 398 static RawClass* patch_class_class_; // Class of the PatchClass vm object. |
| 398 static RawClass* function_class_; // Class of the Function vm object. | 399 static RawClass* function_class_; // Class of the Function vm object. |
| 399 static RawClass* closure_data_class_; // Class of ClosureData vm obj. | 400 static RawClass* closure_data_class_; // Class of ClosureData vm obj. |
| 400 static RawClass* field_class_; // Class of the Field vm object. | 401 static RawClass* field_class_; // Class of the Field vm object. |
| 401 static RawClass* literal_token_class_; // Class of LiteralToken vm object. | 402 static RawClass* literal_token_class_; // Class of LiteralToken vm object. |
| 402 static RawClass* token_stream_class_; // Class of the TokenStream vm object. | 403 static RawClass* token_stream_class_; // Class of the TokenStream vm object. |
| 403 static RawClass* script_class_; // Class of the Script vm object. | 404 static RawClass* script_class_; // Class of the Script vm object. |
| 404 static RawClass* library_class_; // Class of the Library vm object. | 405 static RawClass* library_class_; // Class of the Library vm object. |
| 405 static RawClass* library_prefix_class_; // Class of Library prefix vm object. | 406 static RawClass* library_prefix_class_; // Class of Library prefix vm object. |
| 407 static RawClass* namespace_class_; // Class of Namespace vm object. |
| 406 static RawClass* code_class_; // Class of the Code vm object. | 408 static RawClass* code_class_; // Class of the Code vm object. |
| 407 static RawClass* instructions_class_; // Class of the Instructions vm object. | 409 static RawClass* instructions_class_; // Class of the Instructions vm object. |
| 408 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. | 410 static RawClass* pc_descriptors_class_; // Class of PcDescriptors vm object. |
| 409 static RawClass* stackmap_class_; // Class of Stackmap vm object. | 411 static RawClass* stackmap_class_; // Class of Stackmap vm object. |
| 410 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. | 412 static RawClass* var_descriptors_class_; // Class of LocalVarDescriptors. |
| 411 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. | 413 static RawClass* exception_handlers_class_; // Class of ExceptionHandlers. |
| 412 static RawClass* deopt_info_class_; // Class of DeoptInfo. | 414 static RawClass* deopt_info_class_; // Class of DeoptInfo. |
| 413 static RawClass* context_class_; // Class of the Context vm object. | 415 static RawClass* context_class_; // Class of the Context vm object. |
| 414 static RawClass* context_scope_class_; // Class of ContextScope vm object. | 416 static RawClass* context_scope_class_; // Class of ContextScope vm object. |
| 415 static RawClass* icdata_class_; // Class of ICData. | 417 static RawClass* icdata_class_; // Class of ICData. |
| (...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 RawField* LookupLocalField(const String& name) const; | 2096 RawField* LookupLocalField(const String& name) const; |
| 2095 RawFunction* LookupFunctionAllowPrivate(const String& name) const; | 2097 RawFunction* LookupFunctionAllowPrivate(const String& name) const; |
| 2096 RawFunction* LookupLocalFunction(const String& name) const; | 2098 RawFunction* LookupLocalFunction(const String& name) const; |
| 2097 RawLibraryPrefix* LookupLocalLibraryPrefix(const String& name) const; | 2099 RawLibraryPrefix* LookupLocalLibraryPrefix(const String& name) const; |
| 2098 RawScript* LookupScript(const String& url) const; | 2100 RawScript* LookupScript(const String& url) const; |
| 2099 RawArray* LoadedScripts() const; | 2101 RawArray* LoadedScripts() const; |
| 2100 | 2102 |
| 2101 void AddAnonymousClass(const Class& cls) const; | 2103 void AddAnonymousClass(const Class& cls) const; |
| 2102 | 2104 |
| 2103 // Library imports. | 2105 // Library imports. |
| 2104 void AddImport(const Library& library) const; | 2106 void AddImport(const Namespace& ns) const; |
| 2105 RawLibrary* LookupImport(const String& url) const; | 2107 RawLibrary* LookupImport(const String& url) const; |
| 2106 intptr_t num_imports() const { return raw_ptr()->num_imports_; } | 2108 intptr_t num_imports() const { return raw_ptr()->num_imports_; } |
| 2107 RawLibrary* ImportAt(intptr_t index) const; | 2109 RawNamespace* ImportAt(intptr_t index) const; |
| 2108 RawLibraryPrefix* ImportPrefixAt(intptr_t index) const; | 2110 RawLibrary* ImportLibraryAt(intptr_t index) const; |
| 2109 bool ImportsCorelib() const; | 2111 bool ImportsCorelib() const; |
| 2110 | 2112 |
| 2111 RawFunction* LookupFunctionInSource(const String& script_url, | 2113 RawFunction* LookupFunctionInSource(const String& script_url, |
| 2112 intptr_t line_number) const; | 2114 intptr_t line_number) const; |
| 2113 RawFunction* LookupFunctionInScript(const Script& script, | 2115 RawFunction* LookupFunctionInScript(const Script& script, |
| 2114 intptr_t token_pos) const; | 2116 intptr_t token_pos) const; |
| 2115 | 2117 |
| 2116 // Resolving native methods for script loaded in the library. | 2118 // Resolving native methods for script loaded in the library. |
| 2117 Dart_NativeEntryResolver native_entry_resolver() const { | 2119 Dart_NativeEntryResolver native_entry_resolver() const { |
| 2118 return raw_ptr()->native_entry_resolver_; | 2120 return raw_ptr()->native_entry_resolver_; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2181 void GrowDictionary(const Array& dict, intptr_t dict_size) const; | 2183 void GrowDictionary(const Array& dict, intptr_t dict_size) const; |
| 2182 static RawLibrary* NewLibraryHelper(const String& url, | 2184 static RawLibrary* NewLibraryHelper(const String& url, |
| 2183 bool import_core_lib); | 2185 bool import_core_lib); |
| 2184 RawObject* LookupEntry(const String& name, intptr_t *index) const; | 2186 RawObject* LookupEntry(const String& name, intptr_t *index) const; |
| 2185 | 2187 |
| 2186 HEAP_OBJECT_IMPLEMENTATION(Library, Object); | 2188 HEAP_OBJECT_IMPLEMENTATION(Library, Object); |
| 2187 friend class Class; | 2189 friend class Class; |
| 2188 friend class Debugger; | 2190 friend class Debugger; |
| 2189 friend class DictionaryIterator; | 2191 friend class DictionaryIterator; |
| 2190 friend class Isolate; | 2192 friend class Isolate; |
| 2193 friend class Namespace; |
| 2191 }; | 2194 }; |
| 2192 | 2195 |
| 2193 | 2196 |
| 2194 class LibraryPrefix : public Object { | 2197 class LibraryPrefix : public Object { |
| 2195 public: | 2198 public: |
| 2196 RawString* name() const { return raw_ptr()->name_; } | 2199 RawString* name() const { return raw_ptr()->name_; } |
| 2197 virtual RawString* DictionaryName() const { return name(); } | 2200 virtual RawString* DictionaryName() const { return name(); } |
| 2198 | 2201 |
| 2199 RawArray* libraries() const { return raw_ptr()->libraries_; } | 2202 RawArray* imports() const { return raw_ptr()->imports_; } |
| 2200 intptr_t num_libs() const { return raw_ptr()->num_libs_; } | 2203 intptr_t num_imports() const { return raw_ptr()->num_imports_; } |
| 2201 | 2204 |
| 2202 bool ContainsLibrary(const Library& library) const; | 2205 bool ContainsLibrary(const Library& library) const; |
| 2203 RawLibrary* GetLibrary(int index) const; | 2206 RawLibrary* GetLibrary(int index) const; |
| 2204 void AddLibrary(const Library& library) const; | 2207 void AddImport(const Namespace& import) const; |
| 2205 RawClass* LookupLocalClass(const String& class_name) const; | 2208 RawClass* LookupLocalClass(const String& class_name) const; |
| 2206 | 2209 |
| 2207 static intptr_t InstanceSize() { | 2210 static intptr_t InstanceSize() { |
| 2208 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); | 2211 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); |
| 2209 } | 2212 } |
| 2210 | 2213 |
| 2211 static RawLibraryPrefix* New(const String& name, const Library& lib); | 2214 static RawLibraryPrefix* New(const String& name, const Namespace& import); |
| 2212 | 2215 |
| 2213 private: | 2216 private: |
| 2214 static const int kInitialSize = 2; | 2217 static const int kInitialSize = 2; |
| 2215 static const int kIncrementSize = 2; | 2218 static const int kIncrementSize = 2; |
| 2216 | 2219 |
| 2217 void set_name(const String& value) const; | 2220 void set_name(const String& value) const; |
| 2218 void set_libraries(const Array& value) const; | 2221 void set_imports(const Array& value) const; |
| 2219 void set_num_libs(intptr_t value) const; | 2222 void set_num_imports(intptr_t value) const; |
| 2220 static RawLibraryPrefix* New(); | 2223 static RawLibraryPrefix* New(); |
| 2221 | 2224 |
| 2222 HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); | 2225 HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); |
| 2223 friend class Class; | 2226 friend class Class; |
| 2224 friend class Isolate; | 2227 friend class Isolate; |
| 2225 }; | 2228 }; |
| 2226 | 2229 |
| 2227 | 2230 |
| 2231 class Namespace : public Object { |
| 2232 public: |
| 2233 RawLibrary* library() const { return raw_ptr()->library_; } |
| 2234 RawArray* show_names() const { return raw_ptr()->show_names_; } |
| 2235 RawArray* hide_names() const { return raw_ptr()->hide_names_; } |
| 2236 |
| 2237 static intptr_t InstanceSize() { |
| 2238 return RoundedAllocationSize(sizeof(RawNamespace)); |
| 2239 } |
| 2240 |
| 2241 bool HidesName(const String& name) const; |
| 2242 RawObject* Lookup(const String& name) const; |
| 2243 |
| 2244 static RawNamespace* New(const Library& library, |
| 2245 const Array& show_names, |
| 2246 const Array& hide_names); |
| 2247 private: |
| 2248 static RawNamespace* New(); |
| 2249 |
| 2250 HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); |
| 2251 friend class Class; |
| 2252 }; |
| 2253 |
| 2254 |
| 2228 class Instructions : public Object { | 2255 class Instructions : public Object { |
| 2229 public: | 2256 public: |
| 2230 intptr_t size() const { return raw_ptr()->size_; } | 2257 intptr_t size() const { return raw_ptr()->size_; } |
| 2231 RawCode* code() const { return raw_ptr()->code_; } | 2258 RawCode* code() const { return raw_ptr()->code_; } |
| 2232 | 2259 |
| 2233 uword EntryPoint() const { | 2260 uword EntryPoint() const { |
| 2234 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); | 2261 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); |
| 2235 } | 2262 } |
| 2236 | 2263 |
| 2237 static const intptr_t kMaxElements = (kIntptrMax - | 2264 static const intptr_t kMaxElements = (kIntptrMax - |
| (...skipping 3415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5653 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5680 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5654 return false; | 5681 return false; |
| 5655 } | 5682 } |
| 5656 } | 5683 } |
| 5657 return true; | 5684 return true; |
| 5658 } | 5685 } |
| 5659 | 5686 |
| 5660 } // namespace dart | 5687 } // namespace dart |
| 5661 | 5688 |
| 5662 #endif // VM_OBJECT_H_ | 5689 #endif // VM_OBJECT_H_ |
| OLD | NEW |