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 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2586 class Library : public Object { | 2586 class Library : public Object { |
2587 public: | 2587 public: |
2588 RawString* name() const { return raw_ptr()->name_; } | 2588 RawString* name() const { return raw_ptr()->name_; } |
2589 void SetName(const String& name) const; | 2589 void SetName(const String& name) const; |
2590 | 2590 |
2591 RawString* url() const { return raw_ptr()->url_; } | 2591 RawString* url() const { return raw_ptr()->url_; } |
2592 RawString* private_key() const { return raw_ptr()->private_key_; } | 2592 RawString* private_key() const { return raw_ptr()->private_key_; } |
2593 bool LoadNotStarted() const { | 2593 bool LoadNotStarted() const { |
2594 return raw_ptr()->load_state_ == RawLibrary::kAllocated; | 2594 return raw_ptr()->load_state_ == RawLibrary::kAllocated; |
2595 } | 2595 } |
| 2596 bool LoadRequested() const { |
| 2597 return raw_ptr()->load_state_ == RawLibrary::kLoadRequested; |
| 2598 } |
2596 bool LoadInProgress() const { | 2599 bool LoadInProgress() const { |
2597 return raw_ptr()->load_state_ == RawLibrary::kLoadInProgress; | 2600 return raw_ptr()->load_state_ == RawLibrary::kLoadInProgress; |
2598 } | 2601 } |
| 2602 void SetLoadRequested() const; |
2599 void SetLoadInProgress() const; | 2603 void SetLoadInProgress() const; |
2600 bool Loaded() const { return raw_ptr()->load_state_ == RawLibrary::kLoaded; } | 2604 bool Loaded() const { return raw_ptr()->load_state_ == RawLibrary::kLoaded; } |
2601 void SetLoaded() const; | 2605 void SetLoaded() const; |
2602 bool LoadError() const { | 2606 bool LoadError() const { |
2603 return raw_ptr()->load_state_ == RawLibrary::kLoadError; | 2607 return raw_ptr()->load_state_ == RawLibrary::kLoadError; |
2604 } | 2608 } |
2605 void SetLoadError() const; | 2609 void SetLoadError() const; |
2606 | 2610 |
2607 static intptr_t InstanceSize() { | 2611 static intptr_t InstanceSize() { |
2608 return RoundedAllocationSize(sizeof(RawLibrary)); | 2612 return RoundedAllocationSize(sizeof(RawLibrary)); |
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4287 }; | 4291 }; |
4288 | 4292 |
4289 | 4293 |
4290 class LibraryPrefix : public Instance { | 4294 class LibraryPrefix : public Instance { |
4291 public: | 4295 public: |
4292 RawString* name() const { return raw_ptr()->name_; } | 4296 RawString* name() const { return raw_ptr()->name_; } |
4293 virtual RawString* DictionaryName() const { return name(); } | 4297 virtual RawString* DictionaryName() const { return name(); } |
4294 | 4298 |
4295 RawArray* imports() const { return raw_ptr()->imports_; } | 4299 RawArray* imports() const { return raw_ptr()->imports_; } |
4296 intptr_t num_imports() const { return raw_ptr()->num_imports_; } | 4300 intptr_t num_imports() const { return raw_ptr()->num_imports_; } |
| 4301 RawLibrary* importer() const { return raw_ptr()->importer_; } |
4297 | 4302 |
4298 bool ContainsLibrary(const Library& library) const; | 4303 bool ContainsLibrary(const Library& library) const; |
4299 RawLibrary* GetLibrary(int index) const; | 4304 RawLibrary* GetLibrary(int index) const; |
4300 void AddImport(const Namespace& import) const; | 4305 void AddImport(const Namespace& import) const; |
4301 RawObject* LookupObject(const String& name) const; | 4306 RawObject* LookupObject(const String& name) const; |
4302 RawClass* LookupClass(const String& class_name) const; | 4307 RawClass* LookupClass(const String& class_name) const; |
4303 | 4308 |
4304 bool is_deferred_load() const { return raw_ptr()->is_deferred_load_; } | 4309 bool is_deferred_load() const { return raw_ptr()->is_deferred_load_; } |
4305 bool is_loaded() const { return raw_ptr()->is_loaded_; } | 4310 bool is_loaded() const { return raw_ptr()->is_loaded_; } |
4306 void LoadLibrary() const; | 4311 bool LoadLibrary() const; |
4307 | 4312 |
4308 // Return the list of code objects that were compiled when this | 4313 // Return the list of code objects that were compiled when this |
4309 // prefix was not yet loaded. These code objects will be invalidated | 4314 // prefix was not yet loaded. These code objects will be invalidated |
4310 // when the prefix is loaded. | 4315 // when the prefix is loaded. |
4311 RawArray* dependent_code() const; | 4316 RawArray* dependent_code() const; |
4312 void set_dependent_code(const Array& array) const; | 4317 void set_dependent_code(const Array& array) const; |
4313 | 4318 |
4314 // Add the given code object to the list of dependent ones. | 4319 // Add the given code object to the list of dependent ones. |
4315 void RegisterDependentCode(const Code& code) const; | 4320 void RegisterDependentCode(const Code& code) const; |
4316 void InvalidateDependentCode() const; | 4321 void InvalidateDependentCode() const; |
4317 | 4322 |
4318 static intptr_t InstanceSize() { | 4323 static intptr_t InstanceSize() { |
4319 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); | 4324 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); |
4320 } | 4325 } |
4321 | 4326 |
4322 static RawLibraryPrefix* New(const String& name, | 4327 static RawLibraryPrefix* New(const String& name, |
4323 const Namespace& import, | 4328 const Namespace& import, |
4324 bool deferred_load); | 4329 bool deferred_load, |
| 4330 const Library& importer); |
4325 | 4331 |
4326 private: | 4332 private: |
4327 static const int kInitialSize = 2; | 4333 static const int kInitialSize = 2; |
4328 static const int kIncrementSize = 2; | 4334 static const int kIncrementSize = 2; |
4329 | 4335 |
4330 void set_name(const String& value) const; | 4336 void set_name(const String& value) const; |
4331 void set_imports(const Array& value) const; | 4337 void set_imports(const Array& value) const; |
4332 void set_num_imports(intptr_t value) const; | 4338 void set_num_imports(intptr_t value) const; |
| 4339 void set_importer(const Library& value) const; |
4333 void set_is_loaded() const; | 4340 void set_is_loaded() const; |
4334 | 4341 |
4335 static RawLibraryPrefix* New(); | 4342 static RawLibraryPrefix* New(); |
4336 | 4343 |
4337 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Instance); | 4344 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Instance); |
4338 friend class Class; | 4345 friend class Class; |
4339 }; | 4346 }; |
4340 | 4347 |
4341 | 4348 |
4342 // AbstractType is an abstract superclass. | 4349 // AbstractType is an abstract superclass. |
(...skipping 2765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7108 | 7115 |
7109 | 7116 |
7110 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7117 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7111 intptr_t index) { | 7118 intptr_t index) { |
7112 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7119 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7113 } | 7120 } |
7114 | 7121 |
7115 } // namespace dart | 7122 } // namespace dart |
7116 | 7123 |
7117 #endif // VM_OBJECT_H_ | 7124 #endif // VM_OBJECT_H_ |
OLD | NEW |