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 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2359 RawObject* Evaluate(const String& expr) const; | 2359 RawObject* Evaluate(const String& expr) const; |
2360 | 2360 |
2361 // Library scope name dictionary. | 2361 // Library scope name dictionary. |
2362 // | 2362 // |
2363 // TODO(turnidge): The Lookup functions are not consistent in how | 2363 // TODO(turnidge): The Lookup functions are not consistent in how |
2364 // they deal with private names. Go through and make them a bit | 2364 // they deal with private names. Go through and make them a bit |
2365 // more regular. | 2365 // more regular. |
2366 void AddClass(const Class& cls) const; | 2366 void AddClass(const Class& cls) const; |
2367 void AddObject(const Object& obj, const String& name) const; | 2367 void AddObject(const Object& obj, const String& name) const; |
2368 void ReplaceObject(const Object& obj, const String& name) const; | 2368 void ReplaceObject(const Object& obj, const String& name) const; |
2369 RawObject* LookupExport(const String& name) const; | 2369 RawObject* LookupReExport(const String& name) const; |
2370 RawObject* LookupObject(const String& name, | 2370 RawObject* LookupObject(const String& name) const; |
2371 String* ambiguity_error_msg) const; | 2371 RawObject* LookupObjectAllowPrivate(const String& name) const; |
2372 RawObject* LookupObjectAllowPrivate(const String& name, | |
2373 String* ambiguity_error_msg) const; | |
2374 RawObject* LookupLocalObjectAllowPrivate(const String& name) const; | 2372 RawObject* LookupLocalObjectAllowPrivate(const String& name) const; |
2375 RawObject* LookupLocalObject(const String& name) const; | 2373 RawObject* LookupLocalObject(const String& name) const; |
2376 RawObject* LookupImportedObject(const String& name, | 2374 RawObject* LookupImportedObject(const String& name) const; |
2377 String* ambiguity_error_msg) const; | 2375 RawClass* LookupClass(const String& name) const; |
2378 RawClass* LookupClass(const String& name, String* ambiguity_error_msg) const; | 2376 RawClass* LookupClassAllowPrivate(const String& name) const; |
2379 RawClass* LookupClassAllowPrivate(const String& name, | |
2380 String* ambiguity_error_msg) const; | |
2381 RawClass* LookupLocalClass(const String& name) const; | 2377 RawClass* LookupLocalClass(const String& name) const; |
2382 RawField* LookupFieldAllowPrivate(const String& name, | 2378 RawField* LookupFieldAllowPrivate(const String& name) const; |
2383 String* ambiguity_error_msg) const; | |
2384 RawField* LookupLocalField(const String& name) const; | 2379 RawField* LookupLocalField(const String& name) const; |
2385 RawFunction* LookupFunctionAllowPrivate(const String& name, | 2380 RawFunction* LookupFunctionAllowPrivate(const String& name) const; |
2386 String* ambiguity_error_msg) const; | |
2387 RawFunction* LookupLocalFunction(const String& name) const; | 2381 RawFunction* LookupLocalFunction(const String& name) const; |
2388 RawLibraryPrefix* LookupLocalLibraryPrefix(const String& name) const; | 2382 RawLibraryPrefix* LookupLocalLibraryPrefix(const String& name) const; |
2389 RawScript* LookupScript(const String& url) const; | 2383 RawScript* LookupScript(const String& url) const; |
2390 RawArray* LoadedScripts() const; | 2384 RawArray* LoadedScripts() const; |
2391 | 2385 |
2392 void AddAnonymousClass(const Class& cls) const; | 2386 void AddAnonymousClass(const Class& cls) const; |
2393 | 2387 |
2394 void AddExport(const Namespace& ns) const; | 2388 void AddExport(const Namespace& ns) const; |
2395 | 2389 |
2396 void AddClassMetadata(const Class& cls, intptr_t token_pos) const; | 2390 void AddClassMetadata(const Class& cls, intptr_t token_pos) const; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2514 public: | 2508 public: |
2515 RawString* name() const { return raw_ptr()->name_; } | 2509 RawString* name() const { return raw_ptr()->name_; } |
2516 virtual RawString* DictionaryName() const { return name(); } | 2510 virtual RawString* DictionaryName() const { return name(); } |
2517 | 2511 |
2518 RawArray* imports() const { return raw_ptr()->imports_; } | 2512 RawArray* imports() const { return raw_ptr()->imports_; } |
2519 intptr_t num_imports() const { return raw_ptr()->num_imports_; } | 2513 intptr_t num_imports() const { return raw_ptr()->num_imports_; } |
2520 | 2514 |
2521 bool ContainsLibrary(const Library& library) const; | 2515 bool ContainsLibrary(const Library& library) const; |
2522 RawLibrary* GetLibrary(int index) const; | 2516 RawLibrary* GetLibrary(int index) const; |
2523 void AddImport(const Namespace& import) const; | 2517 void AddImport(const Namespace& import) const; |
2524 RawClass* LookupClass(const String& class_name, | 2518 RawObject* LookupObject(const String& name) const; |
2525 String* ambiguity_error_msg) const; | 2519 RawClass* LookupClass(const String& class_name) const; |
2526 | 2520 |
2527 static intptr_t InstanceSize() { | 2521 static intptr_t InstanceSize() { |
2528 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); | 2522 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); |
2529 } | 2523 } |
2530 | 2524 |
2531 static RawLibraryPrefix* New(const String& name, const Namespace& import); | 2525 static RawLibraryPrefix* New(const String& name, const Namespace& import); |
2532 | 2526 |
2533 private: | 2527 private: |
2534 static const int kInitialSize = 2; | 2528 static const int kInitialSize = 2; |
2535 static const int kIncrementSize = 2; | 2529 static const int kIncrementSize = 2; |
2536 | 2530 |
2537 void set_name(const String& value) const; | 2531 void set_name(const String& value) const; |
2538 void set_imports(const Array& value) const; | 2532 void set_imports(const Array& value) const; |
2539 void set_num_imports(intptr_t value) const; | 2533 void set_num_imports(intptr_t value) const; |
2540 static RawLibraryPrefix* New(); | 2534 static RawLibraryPrefix* New(); |
2541 | 2535 |
2542 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); | 2536 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); |
2543 friend class Class; | 2537 friend class Class; |
2544 }; | 2538 }; |
2545 | 2539 |
2546 | 2540 |
| 2541 // A Namespace contains the names in a library dictionary, filtered by |
| 2542 // the show/hide combinators. |
2547 class Namespace : public Object { | 2543 class Namespace : public Object { |
2548 public: | 2544 public: |
2549 RawLibrary* library() const { return raw_ptr()->library_; } | 2545 RawLibrary* library() const { return raw_ptr()->library_; } |
2550 RawArray* show_names() const { return raw_ptr()->show_names_; } | 2546 RawArray* show_names() const { return raw_ptr()->show_names_; } |
2551 RawArray* hide_names() const { return raw_ptr()->hide_names_; } | 2547 RawArray* hide_names() const { return raw_ptr()->hide_names_; } |
2552 | 2548 |
2553 static intptr_t InstanceSize() { | 2549 static intptr_t InstanceSize() { |
2554 return RoundedAllocationSize(sizeof(RawNamespace)); | 2550 return RoundedAllocationSize(sizeof(RawNamespace)); |
2555 } | 2551 } |
2556 | 2552 |
(...skipping 3596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6153 | 6149 |
6154 | 6150 |
6155 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6151 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6156 intptr_t index) { | 6152 intptr_t index) { |
6157 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6153 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6158 } | 6154 } |
6159 | 6155 |
6160 } // namespace dart | 6156 } // namespace dart |
6161 | 6157 |
6162 #endif // VM_OBJECT_H_ | 6158 #endif // VM_OBJECT_H_ |
OLD | NEW |