| 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 void SetFields(const Array& value) const; | 594 void SetFields(const Array& value) const; |
| 595 | 595 |
| 596 RawArray* functions() const { return raw_ptr()->functions_; } | 596 RawArray* functions() const { return raw_ptr()->functions_; } |
| 597 void SetFunctions(const Array& value) const; | 597 void SetFunctions(const Array& value) const; |
| 598 | 598 |
| 599 RawFunction* LookupDynamicFunction(const String& name) const; | 599 RawFunction* LookupDynamicFunction(const String& name) const; |
| 600 RawFunction* LookupStaticFunction(const String& name) const; | 600 RawFunction* LookupStaticFunction(const String& name) const; |
| 601 RawFunction* LookupConstructor(const String& name) const; | 601 RawFunction* LookupConstructor(const String& name) const; |
| 602 RawFunction* LookupFactory(const String& name) const; | 602 RawFunction* LookupFactory(const String& name) const; |
| 603 RawFunction* LookupFunction(const String& name) const; | 603 RawFunction* LookupFunction(const String& name) const; |
| 604 | 604 RawFunction* LookupFunctionAtToken(intptr_t token_index) const; |
| 605 RawField* LookupInstanceField(const String& name) const; | 605 RawField* LookupInstanceField(const String& name) const; |
| 606 RawField* LookupStaticField(const String& name) const; | 606 RawField* LookupStaticField(const String& name) const; |
| 607 RawField* LookupField(const String& name) const; | 607 RawField* LookupField(const String& name) const; |
| 608 | 608 |
| 609 RawLibraryPrefix* LookupLibraryPrefix(const String& name) const; | 609 RawLibraryPrefix* LookupLibraryPrefix(const String& name) const; |
| 610 | 610 |
| 611 void InsertCanonicalConstant(intptr_t index, const Instance& constant) const; | 611 void InsertCanonicalConstant(intptr_t index, const Instance& constant) const; |
| 612 | 612 |
| 613 static intptr_t InstanceSize() { | 613 static intptr_t InstanceSize() { |
| 614 return RoundedAllocationSize(sizeof(RawClass)); | 614 return RoundedAllocationSize(sizeof(RawClass)); |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 bool IsFactory() const { | 1245 bool IsFactory() const { |
| 1246 return (kind() == RawFunction::kConstructor) && is_static(); | 1246 return (kind() == RawFunction::kConstructor) && is_static(); |
| 1247 } | 1247 } |
| 1248 bool IsAbstract() const { | 1248 bool IsAbstract() const { |
| 1249 return kind() == RawFunction::kAbstract; | 1249 return kind() == RawFunction::kAbstract; |
| 1250 } | 1250 } |
| 1251 bool IsInFactoryScope() const; | 1251 bool IsInFactoryScope() const; |
| 1252 | 1252 |
| 1253 intptr_t token_index() const { return raw_ptr()->token_index_; } | 1253 intptr_t token_index() const { return raw_ptr()->token_index_; } |
| 1254 | 1254 |
| 1255 intptr_t end_token_index() const { return raw_ptr()->end_token_index_; } |
| 1256 void set_end_token_index(intptr_t value) const { |
| 1257 raw_ptr()->end_token_index_ = value; |
| 1258 } |
| 1259 |
| 1255 static intptr_t num_fixed_parameters_offset() { | 1260 static intptr_t num_fixed_parameters_offset() { |
| 1256 return OFFSET_OF(RawFunction, num_fixed_parameters_); | 1261 return OFFSET_OF(RawFunction, num_fixed_parameters_); |
| 1257 } | 1262 } |
| 1258 intptr_t num_fixed_parameters() const { | 1263 intptr_t num_fixed_parameters() const { |
| 1259 return raw_ptr()->num_fixed_parameters_; | 1264 return raw_ptr()->num_fixed_parameters_; |
| 1260 } | 1265 } |
| 1261 void set_num_fixed_parameters(intptr_t value) const; | 1266 void set_num_fixed_parameters(intptr_t value) const; |
| 1262 | 1267 |
| 1263 static intptr_t num_optional_parameters_offset() { | 1268 static intptr_t num_optional_parameters_offset() { |
| 1264 return OFFSET_OF(RawFunction, num_optional_parameters_); | 1269 return OFFSET_OF(RawFunction, num_optional_parameters_); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 RawString* GetLine(intptr_t line_number) const; | 1546 RawString* GetLine(intptr_t line_number) const; |
| 1542 | 1547 |
| 1543 RawString* GetSnippet(intptr_t from_line, | 1548 RawString* GetSnippet(intptr_t from_line, |
| 1544 intptr_t from_column, | 1549 intptr_t from_column, |
| 1545 intptr_t to_line, | 1550 intptr_t to_line, |
| 1546 intptr_t to_column) const; | 1551 intptr_t to_column) const; |
| 1547 | 1552 |
| 1548 void GetTokenLocation(intptr_t token_index, | 1553 void GetTokenLocation(intptr_t token_index, |
| 1549 intptr_t* line, intptr_t* column) const; | 1554 intptr_t* line, intptr_t* column) const; |
| 1550 | 1555 |
| 1556 intptr_t TokenIndexAtLine(intptr_t line_number) const; |
| 1557 |
| 1551 static intptr_t InstanceSize() { | 1558 static intptr_t InstanceSize() { |
| 1552 return RoundedAllocationSize(sizeof(RawScript)); | 1559 return RoundedAllocationSize(sizeof(RawScript)); |
| 1553 } | 1560 } |
| 1554 | 1561 |
| 1555 static RawScript* New(const String& url, | 1562 static RawScript* New(const String& url, |
| 1556 const String& source, | 1563 const String& source, |
| 1557 RawScript::Kind kind); | 1564 RawScript::Kind kind); |
| 1558 | 1565 |
| 1559 private: | 1566 private: |
| 1560 void set_url(const String& value) const; | 1567 void set_url(const String& value) const; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 | 1637 |
| 1631 static RawLibrary* New(const String& url); | 1638 static RawLibrary* New(const String& url); |
| 1632 | 1639 |
| 1633 // Library scope name dictionary. | 1640 // Library scope name dictionary. |
| 1634 void AddClass(const Class& cls) const; | 1641 void AddClass(const Class& cls) const; |
| 1635 void AddObject(const Object& obj, const String& name) const; | 1642 void AddObject(const Object& obj, const String& name) const; |
| 1636 RawObject* LookupObject(const String& name) const; | 1643 RawObject* LookupObject(const String& name) const; |
| 1637 RawClass* LookupClass(const String& name) const; | 1644 RawClass* LookupClass(const String& name) const; |
| 1638 RawObject* LookupLocalObject(const String& name) const; | 1645 RawObject* LookupLocalObject(const String& name) const; |
| 1639 RawClass* LookupLocalClass(const String& name) const; | 1646 RawClass* LookupLocalClass(const String& name) const; |
| 1647 RawScript* LookupScript(const String& url) const; |
| 1640 | 1648 |
| 1641 void AddAnonymousClass(const Class& cls) const; | 1649 void AddAnonymousClass(const Class& cls) const; |
| 1642 | 1650 |
| 1643 // Library imports. | 1651 // Library imports. |
| 1644 void AddImport(const Library& library) const; | 1652 void AddImport(const Library& library) const; |
| 1645 RawLibrary* LookupImport(const String& url) const; | 1653 RawLibrary* LookupImport(const String& url) const; |
| 1646 | 1654 |
| 1655 RawFunction* LookupFunctionInSource(const String& script_url, |
| 1656 intptr_t line_number) const; |
| 1657 RawFunction* LookupFunctionInScript(const Script& script, |
| 1658 intptr_t token_index) const; |
| 1659 |
| 1647 // Resolving native methods for script loaded in the library. | 1660 // Resolving native methods for script loaded in the library. |
| 1648 Dart_NativeEntryResolver native_entry_resolver() const { | 1661 Dart_NativeEntryResolver native_entry_resolver() const { |
| 1649 return raw_ptr()->native_entry_resolver_; | 1662 return raw_ptr()->native_entry_resolver_; |
| 1650 } | 1663 } |
| 1651 void set_native_entry_resolver(Dart_NativeEntryResolver value) const { | 1664 void set_native_entry_resolver(Dart_NativeEntryResolver value) const { |
| 1652 raw_ptr()->native_entry_resolver_ = value; | 1665 raw_ptr()->native_entry_resolver_ = value; |
| 1653 } | 1666 } |
| 1654 | 1667 |
| 1655 void Register() const; | 1668 void Register() const; |
| 1669 |
| 1670 RawLibrary* next_registered() const { return raw_ptr()->next_registered_; } |
| 1671 |
| 1656 static RawLibrary* LookupLibrary(const String& url); | 1672 static RawLibrary* LookupLibrary(const String& url); |
| 1657 static RawString* CheckForDuplicateDefinition(); | 1673 static RawString* CheckForDuplicateDefinition(); |
| 1658 static bool IsKeyUsed(intptr_t key); | 1674 static bool IsKeyUsed(intptr_t key); |
| 1659 | 1675 |
| 1660 static void InitCoreLibrary(Isolate* isolate); | 1676 static void InitCoreLibrary(Isolate* isolate); |
| 1661 static RawLibrary* CoreLibrary(); | 1677 static RawLibrary* CoreLibrary(); |
| 1662 static RawLibrary* CoreImplLibrary(); | 1678 static RawLibrary* CoreImplLibrary(); |
| 1663 static void InitNativeWrappersLibrary(Isolate* isolate); | 1679 static void InitNativeWrappersLibrary(Isolate* isolate); |
| 1664 static RawLibrary* NativeWrappersLibrary(); | 1680 static RawLibrary* NativeWrappersLibrary(); |
| 1665 | 1681 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1677 void set_num_imports(intptr_t value) const { | 1693 void set_num_imports(intptr_t value) const { |
| 1678 raw_ptr()->num_imports_ = value; | 1694 raw_ptr()->num_imports_ = value; |
| 1679 } | 1695 } |
| 1680 intptr_t num_imported_into() const { return raw_ptr()->num_imported_into_; } | 1696 intptr_t num_imported_into() const { return raw_ptr()->num_imported_into_; } |
| 1681 void set_num_imported_into(intptr_t value) const { | 1697 void set_num_imported_into(intptr_t value) const { |
| 1682 raw_ptr()->num_imported_into_ = value; | 1698 raw_ptr()->num_imported_into_ = value; |
| 1683 } | 1699 } |
| 1684 RawArray* imports() const { return raw_ptr()->imports_; } | 1700 RawArray* imports() const { return raw_ptr()->imports_; } |
| 1685 RawArray* imported_into() const { return raw_ptr()->imported_into_; } | 1701 RawArray* imported_into() const { return raw_ptr()->imported_into_; } |
| 1686 RawArray* dictionary() const { return raw_ptr()->dictionary_; } | 1702 RawArray* dictionary() const { return raw_ptr()->dictionary_; } |
| 1687 RawLibrary* next_registered() const { return raw_ptr()->next_registered_; } | |
| 1688 void InitClassDictionary() const; | 1703 void InitClassDictionary() const; |
| 1689 void InitImportList() const; | 1704 void InitImportList() const; |
| 1690 void InitImportedIntoList() const; | 1705 void InitImportedIntoList() const; |
| 1691 void GrowDictionary(const Array& dict, intptr_t dict_size) const; | 1706 void GrowDictionary(const Array& dict, intptr_t dict_size) const; |
| 1692 static RawLibrary* NewLibraryHelper(const String& url, | 1707 static RawLibrary* NewLibraryHelper(const String& url, |
| 1693 bool import_core_lib); | 1708 bool import_core_lib); |
| 1694 void AddImportedInto(const Library& library) const; | 1709 void AddImportedInto(const Library& library) const; |
| 1695 RawObject* LookupObjectFiltered(const String& name, | 1710 RawObject* LookupObjectFiltered(const String& name, |
| 1696 const Library& filter_lib) const; | 1711 const Library& filter_lib) const; |
| 1697 RawLibrary* LookupObjectInImporter(const String& name) const; | 1712 RawLibrary* LookupObjectInImporter(const String& name) const; |
| 1698 RawString* DuplicateDefineErrorString(const String& entry_name, | 1713 RawString* DuplicateDefineErrorString(const String& entry_name, |
| 1699 const Library& conflicting_lib) const; | 1714 const Library& conflicting_lib) const; |
| 1700 RawString* FindDuplicateDefinition(Library* conflicting_lib) const; | 1715 RawString* FindDuplicateDefinition(Library* conflicting_lib) const; |
| 1701 | 1716 |
| 1702 HEAP_OBJECT_IMPLEMENTATION(Library, Object); | 1717 HEAP_OBJECT_IMPLEMENTATION(Library, Object); |
| 1703 friend class Class; | 1718 friend class Class; |
| 1704 friend class DictionaryIterator; | 1719 friend class DictionaryIterator; |
| 1720 friend class Debugger; |
| 1705 friend class Isolate; | 1721 friend class Isolate; |
| 1706 }; | 1722 }; |
| 1707 | 1723 |
| 1708 | 1724 |
| 1709 class LibraryPrefix : public Object { | 1725 class LibraryPrefix : public Object { |
| 1710 public: | 1726 public: |
| 1711 RawString* name() const { return raw_ptr()->name_; } | 1727 RawString* name() const { return raw_ptr()->name_; } |
| 1712 RawLibrary* library() const { return raw_ptr()->library_; } | 1728 RawLibrary* library() const { return raw_ptr()->library_; } |
| 1713 | 1729 |
| 1714 static intptr_t InstanceSize() { | 1730 static intptr_t InstanceSize() { |
| (...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3449 } | 3465 } |
| 3450 | 3466 |
| 3451 | 3467 |
| 3452 void Context::SetAt(intptr_t index, const Instance& value) const { | 3468 void Context::SetAt(intptr_t index, const Instance& value) const { |
| 3453 StorePointer(InstanceAddr(index), value.raw()); | 3469 StorePointer(InstanceAddr(index), value.raw()); |
| 3454 } | 3470 } |
| 3455 | 3471 |
| 3456 } // namespace dart | 3472 } // namespace dart |
| 3457 | 3473 |
| 3458 #endif // VM_OBJECT_H_ | 3474 #endif // VM_OBJECT_H_ |
| OLD | NEW |