Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: vm/object.h

Issue 12052033: Added macros OBJECT_IMPLEMENTATION and FINAL_OBJECT_IMPLEMENTATION (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/isolate.cc ('k') | vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 class DeoptInstr; 32 class DeoptInstr;
33 class LocalScope; 33 class LocalScope;
34 class Symbols; 34 class Symbols;
35 35
36 #if defined(DEBUG) 36 #if defined(DEBUG)
37 #define CHECK_HANDLE() CheckHandle(); 37 #define CHECK_HANDLE() CheckHandle();
38 #else 38 #else
39 #define CHECK_HANDLE() 39 #define CHECK_HANDLE()
40 #endif 40 #endif
41 41
42 #define OBJECT_IMPLEMENTATION(object, super) \ 42 #define BASE_OBJECT_IMPLEMENTATION(object, super) \
43 public: /* NOLINT */ \ 43 public: /* NOLINT */ \
44 Raw##object* raw() const { return reinterpret_cast<Raw##object*>(raw_); } \ 44 Raw##object* raw() const { return reinterpret_cast<Raw##object*>(raw_); } \
45 void operator=(Raw##object* value) { \
46 initializeHandle(this, value); \
47 } \
48 bool Is##object() const { return true; } \ 45 bool Is##object() const { return true; } \
49 void operator^=(RawObject* value) { \
50 initializeHandle(this, value); \
51 ASSERT(IsNull() || Is##object()); \
52 } \
53 void operator|=(RawObject* value) { \
54 raw_ = value; \
55 CHECK_HANDLE(); \
56 } \
57 static object& Handle(Isolate* isolate, Raw##object* raw_ptr) { \ 46 static object& Handle(Isolate* isolate, Raw##object* raw_ptr) { \
58 object* obj = \ 47 object* obj = \
59 reinterpret_cast<object*>(VMHandles::AllocateHandle(isolate)); \ 48 reinterpret_cast<object*>(VMHandles::AllocateHandle(isolate)); \
60 initializeHandle(obj, raw_ptr); \ 49 initializeHandle(obj, raw_ptr); \
61 return *obj; \ 50 return *obj; \
62 } \ 51 } \
63 static object& Handle() { \ 52 static object& Handle() { \
64 return Handle(Isolate::Current(), object::null()); \ 53 return Handle(Isolate::Current(), object::null()); \
65 } \ 54 } \
66 static object& Handle(Isolate* isolate) { \ 55 static object& Handle(Isolate* isolate) { \
(...skipping 14 matching lines...) Expand all
81 } \ 70 } \
82 static object& CheckedHandle(RawObject* raw_ptr) { \ 71 static object& CheckedHandle(RawObject* raw_ptr) { \
83 return CheckedHandle(Isolate::Current(), raw_ptr); \ 72 return CheckedHandle(Isolate::Current(), raw_ptr); \
84 } \ 73 } \
85 static object& ZoneHandle(Isolate* isolate, Raw##object* raw_ptr) { \ 74 static object& ZoneHandle(Isolate* isolate, Raw##object* raw_ptr) { \
86 object* obj = reinterpret_cast<object*>( \ 75 object* obj = reinterpret_cast<object*>( \
87 VMHandles::AllocateZoneHandle(isolate)); \ 76 VMHandles::AllocateZoneHandle(isolate)); \
88 initializeHandle(obj, raw_ptr); \ 77 initializeHandle(obj, raw_ptr); \
89 return *obj; \ 78 return *obj; \
90 } \ 79 } \
80 static object* ReadOnlyHandle(Isolate* isolate) { \
81 object* obj = reinterpret_cast<object*>( \
82 Dart::AllocateReadOnlyHandle()); \
83 initializeHandle(obj, object::null()); \
84 return obj; \
85 } \
91 static object& ZoneHandle() { \ 86 static object& ZoneHandle() { \
92 return ZoneHandle(Isolate::Current(), object::null()); \ 87 return ZoneHandle(Isolate::Current(), object::null()); \
93 } \ 88 } \
94 static object& ZoneHandle(Raw##object* raw_ptr) { \ 89 static object& ZoneHandle(Raw##object* raw_ptr) { \
95 return ZoneHandle(Isolate::Current(), raw_ptr); \ 90 return ZoneHandle(Isolate::Current(), raw_ptr); \
96 } \ 91 } \
97 static object& CheckedZoneHandle(Isolate* isolate, RawObject* raw_ptr) { \ 92 static object& CheckedZoneHandle(Isolate* isolate, RawObject* raw_ptr) { \
98 object* obj = reinterpret_cast<object*>( \ 93 object* obj = reinterpret_cast<object*>( \
99 VMHandles::AllocateZoneHandle(isolate)); \ 94 VMHandles::AllocateZoneHandle(isolate)); \
100 initializeHandle(obj, raw_ptr); \ 95 initializeHandle(obj, raw_ptr); \
(...skipping 11 matching lines...) Expand all
112 /* with null, for example Instance::Equals(). */ \ 107 /* with null, for example Instance::Equals(). */ \
113 static const object& Cast(const Object& obj) { \ 108 static const object& Cast(const Object& obj) { \
114 ASSERT(obj.Is##object()); \ 109 ASSERT(obj.Is##object()); \
115 return reinterpret_cast<const object&>(obj); \ 110 return reinterpret_cast<const object&>(obj); \
116 } \ 111 } \
117 static Raw##object* null() { \ 112 static Raw##object* null() { \
118 return reinterpret_cast<Raw##object*>(Object::null()); \ 113 return reinterpret_cast<Raw##object*>(Object::null()); \
119 } \ 114 } \
120 virtual const char* ToCString() const; \ 115 virtual const char* ToCString() const; \
121 static const ClassId kClassId = k##object##Cid; \ 116 static const ClassId kClassId = k##object##Cid; \
122 protected: /* NOLINT */ \
123 object() : super() {} \
124 private: /* NOLINT */ \ 117 private: /* NOLINT */ \
125 /* Initialize the handle based on the raw_ptr in the presence of null. */ \ 118 /* Initialize the handle based on the raw_ptr in the presence of null. */ \
126 static void initializeHandle(object* obj, RawObject* raw_ptr) { \ 119 static void initializeHandle(object* obj, RawObject* raw_ptr) { \
127 if (raw_ptr != Object::null()) { \ 120 if (raw_ptr != Object::null()) { \
128 obj->SetRaw(raw_ptr); \ 121 obj->SetRaw(raw_ptr); \
129 } else { \ 122 } else { \
130 obj->raw_ = Object::null(); \ 123 obj->raw_ = Object::null(); \
131 object fake_object; \ 124 object fake_object; \
132 obj->set_vtable(fake_object.vtable()); \ 125 obj->set_vtable(fake_object.vtable()); \
133 } \ 126 } \
134 } \ 127 } \
135 /* Disallow allocation, copy constructors and override super assignment. */ \ 128 /* Disallow allocation, copy constructors and override super assignment. */ \
136 void* operator new(size_t size); \ 129 void* operator new(size_t size); \
137 object(const object& value); \ 130 object(const object& value); \
138 void operator=(Raw##super* value); \ 131 void operator=(Raw##super* value); \
139 void operator=(const object& value); \ 132 void operator=(const object& value); \
140 void operator=(const super& value); \ 133 void operator=(const super& value); \
141 134
142 #define SNAPSHOT_READER_SUPPORT(object) \ 135 #define SNAPSHOT_READER_SUPPORT(object) \
143 static Raw##object* ReadFrom(SnapshotReader* reader, \ 136 static Raw##object* ReadFrom(SnapshotReader* reader, \
144 intptr_t object_id, \ 137 intptr_t object_id, \
145 intptr_t tags, \ 138 intptr_t tags, \
146 Snapshot::Kind); \ 139 Snapshot::Kind); \
147 friend class SnapshotReader; \ 140 friend class SnapshotReader; \
148 141
142 #define OBJECT_IMPLEMENTATION(object, super) \
143 public: /* NOLINT */ \
144 void operator=(Raw##object* value) { \
145 initializeHandle(this, value); \
146 } \
147 void operator^=(RawObject* value) { \
148 initializeHandle(this, value); \
149 ASSERT(IsNull() || Is##object()); \
150 } \
151 protected: /* NOLINT */ \
152 object() : super() {} \
153 BASE_OBJECT_IMPLEMENTATION(object, super) \
154
149 #define HEAP_OBJECT_IMPLEMENTATION(object, super) \ 155 #define HEAP_OBJECT_IMPLEMENTATION(object, super) \
150 OBJECT_IMPLEMENTATION(object, super); \ 156 OBJECT_IMPLEMENTATION(object, super); \
151 Raw##object* raw_ptr() const { \ 157 Raw##object* raw_ptr() const { \
152 ASSERT(raw() != null()); \ 158 ASSERT(raw() != null()); \
153 return raw()->ptr(); \ 159 return raw()->ptr(); \
154 } \ 160 } \
155 SNAPSHOT_READER_SUPPORT(object) \ 161 SNAPSHOT_READER_SUPPORT(object) \
156 friend class StackFrame; \ 162 friend class StackFrame; \
157 163
164 // This macro is used to denote types that do not have a sub-type.
165 #define FINAL_HEAP_OBJECT_IMPLEMENTATION(object, super) \
166 public: /* NOLINT */ \
167 void operator=(Raw##object* value) { \
168 raw_ = value; \
169 CHECK_HANDLE(); \
170 } \
171 void operator^=(RawObject* value) { \
172 raw_ = value; \
173 CHECK_HANDLE(); \
174 } \
175 private: /* NOLINT */ \
176 object() : super() {} \
177 BASE_OBJECT_IMPLEMENTATION(object, super) \
178 Raw##object* raw_ptr() const { \
179 ASSERT(raw() != null()); \
180 return raw()->ptr(); \
181 } \
182 SNAPSHOT_READER_SUPPORT(object) \
183 friend class StackFrame; \
184
158 class Object { 185 class Object {
159 public: 186 public:
160 virtual ~Object() { } 187 virtual ~Object() { }
161 188
162 RawObject* raw() const { return raw_; } 189 RawObject* raw() const { return raw_; }
163 void operator=(RawObject* value) { 190 void operator=(RawObject* value) {
164 initializeHandle(this, value); 191 initializeHandle(this, value);
165 } 192 }
166 193
167 void set_tags(intptr_t value) const { 194 void set_tags(intptr_t value) const {
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 const Script& script, 880 const Script& script,
854 intptr_t token_pos); 881 intptr_t token_pos);
855 882
856 // Check the subtype or 'more specific' relationship. 883 // Check the subtype or 'more specific' relationship.
857 bool TypeTest(TypeTestKind test_kind, 884 bool TypeTest(TypeTestKind test_kind,
858 const AbstractTypeArguments& type_arguments, 885 const AbstractTypeArguments& type_arguments,
859 const Class& other, 886 const Class& other,
860 const AbstractTypeArguments& other_type_arguments, 887 const AbstractTypeArguments& other_type_arguments,
861 Error* malformed_error) const; 888 Error* malformed_error) const;
862 889
863 HEAP_OBJECT_IMPLEMENTATION(Class, Object); 890 FINAL_HEAP_OBJECT_IMPLEMENTATION(Class, Object);
864 friend class AbstractType; 891 friend class AbstractType;
865 friend class Instance; 892 friend class Instance;
866 friend class Object; 893 friend class Object;
867 friend class Type; 894 friend class Type;
868 }; 895 };
869 896
870 897
871 // Unresolved class is used for storing unresolved names which will be resolved 898 // Unresolved class is used for storing unresolved names which will be resolved
872 // to a class after all classes have been loaded and finalized. 899 // to a class after all classes have been loaded and finalized.
873 class UnresolvedClass : public Object { 900 class UnresolvedClass : public Object {
(...skipping 13 matching lines...) Expand all
887 const String& ident, 914 const String& ident,
888 intptr_t token_pos); 915 intptr_t token_pos);
889 916
890 private: 917 private:
891 void set_library_prefix(const LibraryPrefix& library_prefix) const; 918 void set_library_prefix(const LibraryPrefix& library_prefix) const;
892 void set_ident(const String& ident) const; 919 void set_ident(const String& ident) const;
893 void set_token_pos(intptr_t token_pos) const; 920 void set_token_pos(intptr_t token_pos) const;
894 921
895 static RawUnresolvedClass* New(); 922 static RawUnresolvedClass* New();
896 923
897 HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object); 924 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object);
898 friend class Class; 925 friend class Class;
899 }; 926 };
900 927
901 928
902 // AbstractTypeArguments is an abstract superclass. 929 // AbstractTypeArguments is an abstract superclass.
903 // Subclasses of AbstractTypeArguments are TypeArguments and 930 // Subclasses of AbstractTypeArguments are TypeArguments and
904 // InstantiatedTypeArguments. 931 // InstantiatedTypeArguments.
905 class AbstractTypeArguments : public Object { 932 class AbstractTypeArguments : public Object {
906 public: 933 public:
907 // Returns true if both arguments represent vectors of equal types. 934 // Returns true if both arguments represent vectors of equal types.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 return RoundedAllocationSize(sizeof(RawPatchClass)); 1143 return RoundedAllocationSize(sizeof(RawPatchClass));
1117 } 1144 }
1118 1145
1119 static RawPatchClass* New(const Class& patched_class, const Script& script); 1146 static RawPatchClass* New(const Class& patched_class, const Script& script);
1120 1147
1121 private: 1148 private:
1122 void set_patched_class(const Class& value) const; 1149 void set_patched_class(const Class& value) const;
1123 void set_script(const Script& value) const; 1150 void set_script(const Script& value) const;
1124 static RawPatchClass* New(); 1151 static RawPatchClass* New();
1125 1152
1126 HEAP_OBJECT_IMPLEMENTATION(PatchClass, Object); 1153 FINAL_HEAP_OBJECT_IMPLEMENTATION(PatchClass, Object);
1127 friend class Class; 1154 friend class Class;
1128 }; 1155 };
1129 1156
1130 1157
1131 class Function : public Object { 1158 class Function : public Object {
1132 public: 1159 public:
1133 RawString* name() const { return raw_ptr()->name_; } 1160 RawString* name() const { return raw_ptr()->name_; }
1134 RawString* UserVisibleName() const; 1161 RawString* UserVisibleName() const;
1135 RawString* QualifiedUserVisibleName() const; 1162 RawString* QualifiedUserVisibleName() const;
1136 virtual RawString* DictionaryName() const { return name(); } 1163 virtual RawString* DictionaryName() const { return name(); }
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 // subtyping or 'more specific' relationship between the type of this function 1621 // subtyping or 'more specific' relationship between the type of this function
1595 // and the type of the other function. 1622 // and the type of the other function.
1596 bool TestParameterType(TypeTestKind test_kind, 1623 bool TestParameterType(TypeTestKind test_kind,
1597 intptr_t parameter_position, 1624 intptr_t parameter_position,
1598 intptr_t other_parameter_position, 1625 intptr_t other_parameter_position,
1599 const AbstractTypeArguments& type_arguments, 1626 const AbstractTypeArguments& type_arguments,
1600 const Function& other, 1627 const Function& other,
1601 const AbstractTypeArguments& other_type_arguments, 1628 const AbstractTypeArguments& other_type_arguments,
1602 Error* malformed_error) const; 1629 Error* malformed_error) const;
1603 1630
1604 HEAP_OBJECT_IMPLEMENTATION(Function, Object); 1631 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object);
1605 friend class Class; 1632 friend class Class;
1606 }; 1633 };
1607 1634
1608 1635
1609 class ClosureData: public Object { 1636 class ClosureData: public Object {
1610 public: 1637 public:
1611 static intptr_t InstanceSize() { 1638 static intptr_t InstanceSize() {
1612 return RoundedAllocationSize(sizeof(RawClosureData)); 1639 return RoundedAllocationSize(sizeof(RawClosureData));
1613 } 1640 }
1614 1641
(...skipping 14 matching lines...) Expand all
1629 } 1656 }
1630 void set_implicit_static_closure(const Instance& closure) const; 1657 void set_implicit_static_closure(const Instance& closure) const;
1631 1658
1632 RawCode* closure_allocation_stub() const { 1659 RawCode* closure_allocation_stub() const {
1633 return raw_ptr()->closure_allocation_stub_; 1660 return raw_ptr()->closure_allocation_stub_;
1634 } 1661 }
1635 void set_closure_allocation_stub(const Code& value) const; 1662 void set_closure_allocation_stub(const Code& value) const;
1636 1663
1637 static RawClosureData* New(); 1664 static RawClosureData* New();
1638 1665
1639 HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object); 1666 FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object);
1640 friend class Class; 1667 friend class Class;
1641 friend class Function; 1668 friend class Function;
1642 friend class HeapProfiler; 1669 friend class HeapProfiler;
1643 }; 1670 };
1644 1671
1645 1672
1646 class RedirectionData: public Object { 1673 class RedirectionData: public Object {
1647 public: 1674 public:
1648 static intptr_t InstanceSize() { 1675 static intptr_t InstanceSize() {
1649 return RoundedAllocationSize(sizeof(RawRedirectionData)); 1676 return RoundedAllocationSize(sizeof(RawRedirectionData));
1650 } 1677 }
1651 1678
1652 private: 1679 private:
1653 // The type specifies the class and type arguments of the target constructor. 1680 // The type specifies the class and type arguments of the target constructor.
1654 RawType* type() const { return raw_ptr()->type_; } 1681 RawType* type() const { return raw_ptr()->type_; }
1655 void set_type(const Type& value) const; 1682 void set_type(const Type& value) const;
1656 1683
1657 // The optional identifier specifies a named constructor. 1684 // The optional identifier specifies a named constructor.
1658 RawString* identifier() const { return raw_ptr()->identifier_; } 1685 RawString* identifier() const { return raw_ptr()->identifier_; }
1659 void set_identifier(const String& value) const; 1686 void set_identifier(const String& value) const;
1660 1687
1661 // The resolved constructor or factory target of the redirection. 1688 // The resolved constructor or factory target of the redirection.
1662 RawFunction* target() const { return raw_ptr()->target_; } 1689 RawFunction* target() const { return raw_ptr()->target_; }
1663 void set_target(const Function& value) const; 1690 void set_target(const Function& value) const;
1664 1691
1665 static RawRedirectionData* New(); 1692 static RawRedirectionData* New();
1666 1693
1667 HEAP_OBJECT_IMPLEMENTATION(RedirectionData, Object); 1694 FINAL_HEAP_OBJECT_IMPLEMENTATION(RedirectionData, Object);
1668 friend class Class; 1695 friend class Class;
1669 friend class Function; 1696 friend class Function;
1670 friend class HeapProfiler; 1697 friend class HeapProfiler;
1671 }; 1698 };
1672 1699
1673 1700
1674 class Field : public Object { 1701 class Field : public Object {
1675 public: 1702 public:
1676 RawString* name() const { return raw_ptr()->name_; } 1703 RawString* name() const { return raw_ptr()->name_; }
1677 RawString* UserVisibleName() const; 1704 RawString* UserVisibleName() const;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 StorePointer(&raw_ptr()->owner_, value.raw()); 1778 StorePointer(&raw_ptr()->owner_, value.raw());
1752 } 1779 }
1753 void set_token_pos(intptr_t token_pos) const { 1780 void set_token_pos(intptr_t token_pos) const {
1754 raw_ptr()->token_pos_ = token_pos; 1781 raw_ptr()->token_pos_ = token_pos;
1755 } 1782 }
1756 void set_kind_bits(intptr_t value) const { 1783 void set_kind_bits(intptr_t value) const {
1757 raw_ptr()->kind_bits_ = static_cast<uint8_t>(value); 1784 raw_ptr()->kind_bits_ = static_cast<uint8_t>(value);
1758 } 1785 }
1759 static RawField* New(); 1786 static RawField* New();
1760 1787
1761 HEAP_OBJECT_IMPLEMENTATION(Field, Object); 1788 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object);
1762 friend class Class; 1789 friend class Class;
1763 friend class HeapProfiler; 1790 friend class HeapProfiler;
1764 }; 1791 };
1765 1792
1766 1793
1767 class LiteralToken : public Object { 1794 class LiteralToken : public Object {
1768 public: 1795 public:
1769 Token::Kind kind() const { return raw_ptr()->kind_; } 1796 Token::Kind kind() const { return raw_ptr()->kind_; }
1770 RawString* literal() const { return raw_ptr()->literal_; } 1797 RawString* literal() const { return raw_ptr()->literal_; }
1771 RawObject* value() const { return raw_ptr()->value_; } 1798 RawObject* value() const { return raw_ptr()->value_; }
1772 1799
1773 static intptr_t InstanceSize() { 1800 static intptr_t InstanceSize() {
1774 return RoundedAllocationSize(sizeof(RawLiteralToken)); 1801 return RoundedAllocationSize(sizeof(RawLiteralToken));
1775 } 1802 }
1776 1803
1777 static RawLiteralToken* New(); 1804 static RawLiteralToken* New();
1778 static RawLiteralToken* New(Token::Kind kind, const String& literal); 1805 static RawLiteralToken* New(Token::Kind kind, const String& literal);
1779 1806
1780 private: 1807 private:
1781 void set_kind(Token::Kind kind) const { raw_ptr()->kind_ = kind; } 1808 void set_kind(Token::Kind kind) const { raw_ptr()->kind_ = kind; }
1782 void set_literal(const String& literal) const; 1809 void set_literal(const String& literal) const;
1783 void set_value(const Object& value) const; 1810 void set_value(const Object& value) const;
1784 1811
1785 HEAP_OBJECT_IMPLEMENTATION(LiteralToken, Object); 1812 FINAL_HEAP_OBJECT_IMPLEMENTATION(LiteralToken, Object);
1786 friend class Class; 1813 friend class Class;
1787 }; 1814 };
1788 1815
1789 1816
1790 class TokenStream : public Object { 1817 class TokenStream : public Object {
1791 public: 1818 public:
1792 RawArray* TokenObjects() const; 1819 RawArray* TokenObjects() const;
1793 void SetTokenObjects(const Array& value) const; 1820 void SetTokenObjects(const Array& value) const;
1794 1821
1795 RawExternalUint8Array* GetStream() const; 1822 RawExternalUint8Array* GetStream() const;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 Token::Kind cur_token_kind_; 1880 Token::Kind cur_token_kind_;
1854 intptr_t cur_token_obj_index_; 1881 intptr_t cur_token_obj_index_;
1855 }; 1882 };
1856 1883
1857 private: 1884 private:
1858 void SetPrivateKey(const String& value) const; 1885 void SetPrivateKey(const String& value) const;
1859 1886
1860 static RawTokenStream* New(); 1887 static RawTokenStream* New();
1861 static void DataFinalizer(void *peer); 1888 static void DataFinalizer(void *peer);
1862 1889
1863 HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); 1890 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object);
1864 friend class Class; 1891 friend class Class;
1865 }; 1892 };
1866 1893
1867 1894
1868 class Script : public Object { 1895 class Script : public Object {
1869 public: 1896 public:
1870 RawString* url() const { return raw_ptr()->url_; } 1897 RawString* url() const { return raw_ptr()->url_; }
1871 bool HasSource() const; 1898 bool HasSource() const;
1872 RawString* Source() const; 1899 RawString* Source() const;
1873 RawScript::Kind kind() const { 1900 RawScript::Kind kind() const {
(...skipping 30 matching lines...) Expand all
1904 const String& source, 1931 const String& source,
1905 RawScript::Kind kind); 1932 RawScript::Kind kind);
1906 1933
1907 private: 1934 private:
1908 void set_url(const String& value) const; 1935 void set_url(const String& value) const;
1909 void set_source(const String& value) const; 1936 void set_source(const String& value) const;
1910 void set_kind(RawScript::Kind value) const; 1937 void set_kind(RawScript::Kind value) const;
1911 void set_tokens(const TokenStream& value) const; 1938 void set_tokens(const TokenStream& value) const;
1912 static RawScript* New(); 1939 static RawScript* New();
1913 1940
1914 HEAP_OBJECT_IMPLEMENTATION(Script, Object); 1941 FINAL_HEAP_OBJECT_IMPLEMENTATION(Script, Object);
1915 friend class Class; 1942 friend class Class;
1916 }; 1943 };
1917 1944
1918 1945
1919 class DictionaryIterator : public ValueObject { 1946 class DictionaryIterator : public ValueObject {
1920 public: 1947 public:
1921 explicit DictionaryIterator(const Library& library); 1948 explicit DictionaryIterator(const Library& library);
1922 1949
1923 bool HasNext() const { return next_ix_ < size_; } 1950 bool HasNext() const { return next_ix_ < size_; }
1924 1951
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 bool HasExports() const; 2124 bool HasExports() const;
2098 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } 2125 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; }
2099 RawArray* dictionary() const { return raw_ptr()->dictionary_; } 2126 RawArray* dictionary() const { return raw_ptr()->dictionary_; }
2100 void InitClassDictionary() const; 2127 void InitClassDictionary() const;
2101 void InitImportList() const; 2128 void InitImportList() const;
2102 void GrowDictionary(const Array& dict, intptr_t dict_size) const; 2129 void GrowDictionary(const Array& dict, intptr_t dict_size) const;
2103 static RawLibrary* NewLibraryHelper(const String& url, 2130 static RawLibrary* NewLibraryHelper(const String& url,
2104 bool import_core_lib); 2131 bool import_core_lib);
2105 RawObject* LookupEntry(const String& name, intptr_t *index) const; 2132 RawObject* LookupEntry(const String& name, intptr_t *index) const;
2106 2133
2107 HEAP_OBJECT_IMPLEMENTATION(Library, Object); 2134 FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object);
2108 friend class Class; 2135 friend class Class;
2109 friend class Debugger; 2136 friend class Debugger;
2110 friend class DictionaryIterator; 2137 friend class DictionaryIterator;
2111 friend class Isolate; 2138 friend class Isolate;
2112 friend class Namespace; 2139 friend class Namespace;
2113 }; 2140 };
2114 2141
2115 2142
2116 class LibraryPrefix : public Object { 2143 class LibraryPrefix : public Object {
2117 public: 2144 public:
(...skipping 16 matching lines...) Expand all
2134 2161
2135 private: 2162 private:
2136 static const int kInitialSize = 2; 2163 static const int kInitialSize = 2;
2137 static const int kIncrementSize = 2; 2164 static const int kIncrementSize = 2;
2138 2165
2139 void set_name(const String& value) const; 2166 void set_name(const String& value) const;
2140 void set_imports(const Array& value) const; 2167 void set_imports(const Array& value) const;
2141 void set_num_imports(intptr_t value) const; 2168 void set_num_imports(intptr_t value) const;
2142 static RawLibraryPrefix* New(); 2169 static RawLibraryPrefix* New();
2143 2170
2144 HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); 2171 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object);
2145 friend class Class; 2172 friend class Class;
2146 friend class Isolate; 2173 friend class Isolate;
2147 }; 2174 };
2148 2175
2149 2176
2150 class Namespace : public Object { 2177 class Namespace : public Object {
2151 public: 2178 public:
2152 RawLibrary* library() const { return raw_ptr()->library_; } 2179 RawLibrary* library() const { return raw_ptr()->library_; }
2153 RawArray* show_names() const { return raw_ptr()->show_names_; } 2180 RawArray* show_names() const { return raw_ptr()->show_names_; }
2154 RawArray* hide_names() const { return raw_ptr()->hide_names_; } 2181 RawArray* hide_names() const { return raw_ptr()->hide_names_; }
2155 2182
2156 static intptr_t InstanceSize() { 2183 static intptr_t InstanceSize() {
2157 return RoundedAllocationSize(sizeof(RawNamespace)); 2184 return RoundedAllocationSize(sizeof(RawNamespace));
2158 } 2185 }
2159 2186
2160 bool HidesName(const String& name) const; 2187 bool HidesName(const String& name) const;
2161 RawObject* Lookup(const String& name) const; 2188 RawObject* Lookup(const String& name) const;
2162 2189
2163 static RawNamespace* New(const Library& library, 2190 static RawNamespace* New(const Library& library,
2164 const Array& show_names, 2191 const Array& show_names,
2165 const Array& hide_names); 2192 const Array& hide_names);
2166 private: 2193 private:
2167 static RawNamespace* New(); 2194 static RawNamespace* New();
2168 2195
2169 HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); 2196 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object);
2170 friend class Class; 2197 friend class Class;
2171 }; 2198 };
2172 2199
2173 2200
2174 class Instructions : public Object { 2201 class Instructions : public Object {
2175 public: 2202 public:
2176 intptr_t size() const { return raw_ptr()->size_; } 2203 intptr_t size() const { return raw_ptr()->size_; }
2177 RawCode* code() const { return raw_ptr()->code_; } 2204 RawCode* code() const { return raw_ptr()->code_; }
2178 2205
2179 uword EntryPoint() const { 2206 uword EntryPoint() const {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2215 void set_code(RawCode* code) { 2242 void set_code(RawCode* code) {
2216 raw_ptr()->code_ = code; 2243 raw_ptr()->code_ = code;
2217 } 2244 }
2218 2245
2219 // New is a private method as RawInstruction and RawCode objects should 2246 // New is a private method as RawInstruction and RawCode objects should
2220 // only be created using the Code::FinalizeCode method. This method creates 2247 // only be created using the Code::FinalizeCode method. This method creates
2221 // the RawInstruction and RawCode objects, sets up the pointer offsets 2248 // the RawInstruction and RawCode objects, sets up the pointer offsets
2222 // and links the two in a GC safe manner. 2249 // and links the two in a GC safe manner.
2223 static RawInstructions* New(intptr_t size); 2250 static RawInstructions* New(intptr_t size);
2224 2251
2225 HEAP_OBJECT_IMPLEMENTATION(Instructions, Object); 2252 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object);
2226 friend class Class; 2253 friend class Class;
2227 friend class Code; 2254 friend class Code;
2228 }; 2255 };
2229 2256
2230 2257
2231 class LocalVarDescriptors : public Object { 2258 class LocalVarDescriptors : public Object {
2232 public: 2259 public:
2233 intptr_t Length() const; 2260 intptr_t Length() const;
2234 2261
2235 RawString* GetName(intptr_t var_index) const; 2262 RawString* GetName(intptr_t var_index) const;
(...skipping 15 matching lines...) Expand all
2251 } 2278 }
2252 static intptr_t InstanceSize(intptr_t len) { 2279 static intptr_t InstanceSize(intptr_t len) {
2253 ASSERT(0 <= len && len <= kMaxElements); 2280 ASSERT(0 <= len && len <= kMaxElements);
2254 return RoundedAllocationSize( 2281 return RoundedAllocationSize(
2255 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); 2282 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement));
2256 } 2283 }
2257 2284
2258 static RawLocalVarDescriptors* New(intptr_t num_variables); 2285 static RawLocalVarDescriptors* New(intptr_t num_variables);
2259 2286
2260 private: 2287 private:
2261 HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object); 2288 FINAL_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object);
2262 friend class Class; 2289 friend class Class;
2263 }; 2290 };
2264 2291
2265 2292
2266 class PcDescriptors : public Object { 2293 class PcDescriptors : public Object {
2267 private: 2294 private:
2268 // Describes the layout of PC descriptor data. 2295 // Describes the layout of PC descriptor data.
2269 enum { 2296 enum {
2270 kPcEntry = 0, // PC value of the descriptor, unique. 2297 kPcEntry = 0, // PC value of the descriptor, unique.
2271 kKindEntry = 1, 2298 kKindEntry = 1,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 2376
2350 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { 2377 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const {
2351 ASSERT((index >=0) && (index < Length())); 2378 ASSERT((index >=0) && (index < Length()));
2352 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; 2379 intptr_t data_index = (index * kNumberOfEntries) + entry_offset;
2353 return &raw_ptr()->data_[data_index]; 2380 return &raw_ptr()->data_[data_index];
2354 } 2381 }
2355 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const { 2382 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const {
2356 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset)); 2383 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset));
2357 } 2384 }
2358 2385
2359 HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); 2386 FINAL_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object);
2360 friend class Class; 2387 friend class Class;
2361 }; 2388 };
2362 2389
2363 2390
2364 class Stackmap : public Object { 2391 class Stackmap : public Object {
2365 public: 2392 public:
2366 static const intptr_t kNoMaximum = -1; 2393 static const intptr_t kNoMaximum = -1;
2367 static const intptr_t kNoMinimum = -1; 2394 static const intptr_t kNoMinimum = -1;
2368 2395
2369 bool IsObject(intptr_t index) const { 2396 bool IsObject(intptr_t index) const {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 intptr_t register_bit_count); 2429 intptr_t register_bit_count);
2403 2430
2404 private: 2431 private:
2405 void SetLength(intptr_t length) const { raw_ptr()->length_ = length; } 2432 void SetLength(intptr_t length) const { raw_ptr()->length_ = length; }
2406 2433
2407 bool InRange(intptr_t index) const { return index < Length(); } 2434 bool InRange(intptr_t index) const { return index < Length(); }
2408 2435
2409 bool GetBit(intptr_t bit_index) const; 2436 bool GetBit(intptr_t bit_index) const;
2410 void SetBit(intptr_t bit_index, bool value) const; 2437 void SetBit(intptr_t bit_index, bool value) const;
2411 2438
2412 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); 2439 FINAL_HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object);
2413 friend class BitmapBuilder; 2440 friend class BitmapBuilder;
2414 friend class Class; 2441 friend class Class;
2415 }; 2442 };
2416 2443
2417 2444
2418 class ExceptionHandlers : public Object { 2445 class ExceptionHandlers : public Object {
2419 public: 2446 public:
2420 intptr_t Length() const; 2447 intptr_t Length() const;
2421 2448
2422 void GetHandlerInfo(intptr_t try_index, 2449 void GetHandlerInfo(intptr_t try_index,
(...skipping 25 matching lines...) Expand all
2448 // We would have a VisitPointers function here to traverse the 2475 // We would have a VisitPointers function here to traverse the
2449 // exception handler table to visit objects if any in the table. 2476 // exception handler table to visit objects if any in the table.
2450 2477
2451 private: 2478 private:
2452 // Pick somewhat arbitrary maximum number of exception handlers 2479 // Pick somewhat arbitrary maximum number of exception handlers
2453 // for a function. This value is used to catch potentially 2480 // for a function. This value is used to catch potentially
2454 // malicious code. 2481 // malicious code.
2455 static const intptr_t kMaxHandlers = 1024 * 1024; 2482 static const intptr_t kMaxHandlers = 1024 * 1024;
2456 2483
2457 void set_handled_types_data(const Array& value) const; 2484 void set_handled_types_data(const Array& value) const;
2458 HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object); 2485 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object);
2459 friend class Class; 2486 friend class Class;
2460 }; 2487 };
2461 2488
2462 2489
2463 // Holds deopt information at one deoptimization point. The information 2490 // Holds deopt information at one deoptimization point. The information
2464 // is a list of DeoptInstr objects, specifying transformation information 2491 // is a list of DeoptInstr objects, specifying transformation information
2465 // for each slot in unoptimized frame(s). 2492 // for each slot in unoptimized frame(s).
2466 class DeoptInfo : public Object { 2493 class DeoptInfo : public Object {
2467 private: 2494 private:
2468 // Describes the layout of deopt info data. The index of a deopt-info entry 2495 // Describes the layout of deopt info data. The index of a deopt-info entry
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 2542
2516 private: 2543 private:
2517 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { 2544 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const {
2518 ASSERT((index >=0) && (index < Length())); 2545 ASSERT((index >=0) && (index < Length()));
2519 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; 2546 intptr_t data_index = (index * kNumberOfEntries) + entry_offset;
2520 return &raw_ptr()->data_[data_index]; 2547 return &raw_ptr()->data_[data_index];
2521 } 2548 }
2522 2549
2523 void SetLength(intptr_t value) const; 2550 void SetLength(intptr_t value) const;
2524 2551
2525 HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object); 2552 FINAL_HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object);
2526 friend class Class; 2553 friend class Class;
2527 }; 2554 };
2528 2555
2529 2556
2530 class Code : public Object { 2557 class Code : public Object {
2531 public: 2558 public:
2532 RawInstructions* instructions() const { return raw_ptr()->instructions_; } 2559 RawInstructions* instructions() const { return raw_ptr()->instructions_; }
2533 static intptr_t instructions_offset() { 2560 static intptr_t instructions_offset() {
2534 return OFFSET_OF(RawCode, instructions_); 2561 return OFFSET_OF(RawCode, instructions_);
2535 } 2562 }
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2748 *PointerOffsetAddrAt(index) = offset_in_instructions; 2775 *PointerOffsetAddrAt(index) = offset_in_instructions;
2749 } 2776 }
2750 2777
2751 2778
2752 // New is a private method as RawInstruction and RawCode objects should 2779 // New is a private method as RawInstruction and RawCode objects should
2753 // only be created using the Code::FinalizeCode method. This method creates 2780 // only be created using the Code::FinalizeCode method. This method creates
2754 // the RawInstruction and RawCode objects, sets up the pointer offsets 2781 // the RawInstruction and RawCode objects, sets up the pointer offsets
2755 // and links the two in a GC safe manner. 2782 // and links the two in a GC safe manner.
2756 static RawCode* New(intptr_t pointer_offsets_length); 2783 static RawCode* New(intptr_t pointer_offsets_length);
2757 2784
2758 HEAP_OBJECT_IMPLEMENTATION(Code, Object); 2785 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object);
2759 friend class Class; 2786 friend class Class;
2760 }; 2787 };
2761 2788
2762 2789
2763 class Context : public Object { 2790 class Context : public Object {
2764 public: 2791 public:
2765 RawContext* parent() const { return raw_ptr()->parent_; } 2792 RawContext* parent() const { return raw_ptr()->parent_; }
2766 void set_parent(const Context& parent) const { 2793 void set_parent(const Context& parent) const {
2767 ASSERT(parent.IsNull() || parent.isolate() == Isolate::Current()); 2794 ASSERT(parent.IsNull() || parent.isolate() == Isolate::Current());
2768 StorePointer(&raw_ptr()->parent_, parent.raw()); 2795 StorePointer(&raw_ptr()->parent_, parent.raw());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 } 2836 }
2810 2837
2811 void set_isolate(Isolate* isolate) const { 2838 void set_isolate(Isolate* isolate) const {
2812 raw_ptr()->isolate_ = isolate; 2839 raw_ptr()->isolate_ = isolate;
2813 } 2840 }
2814 2841
2815 void set_num_variables(intptr_t num_variables) const { 2842 void set_num_variables(intptr_t num_variables) const {
2816 raw_ptr()->num_variables_ = num_variables; 2843 raw_ptr()->num_variables_ = num_variables;
2817 } 2844 }
2818 2845
2819 HEAP_OBJECT_IMPLEMENTATION(Context, Object); 2846 FINAL_HEAP_OBJECT_IMPLEMENTATION(Context, Object);
2820 friend class Class; 2847 friend class Class;
2821 }; 2848 };
2822 2849
2823 2850
2824 // The ContextScope class makes it possible to delay the compilation of a local 2851 // The ContextScope class makes it possible to delay the compilation of a local
2825 // function until it is invoked. A ContextScope instance collects the local 2852 // function until it is invoked. A ContextScope instance collects the local
2826 // variables that are referenced by the local function to be compiled and that 2853 // variables that are referenced by the local function to be compiled and that
2827 // belong to the outer scopes, that is, to the local scopes of (possibly nested) 2854 // belong to the outer scopes, that is, to the local scopes of (possibly nested)
2828 // functions enclosing the local function. Each captured variable is represented 2855 // functions enclosing the local function. Each captured variable is represented
2829 // by its token position in the source, its name, its type, its allocation index 2856 // by its token position in the source, its name, its type, its allocation index
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2881 } 2908 }
2882 2909
2883 RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const { 2910 RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const {
2884 ASSERT((index >= 0) && (index < num_variables())); 2911 ASSERT((index >= 0) && (index < num_variables()));
2885 uword raw_addr = reinterpret_cast<uword>(raw_ptr()); 2912 uword raw_addr = reinterpret_cast<uword>(raw_ptr());
2886 raw_addr += sizeof(RawContextScope) + 2913 raw_addr += sizeof(RawContextScope) +
2887 (index * sizeof(RawContextScope::VariableDesc)); 2914 (index * sizeof(RawContextScope::VariableDesc));
2888 return reinterpret_cast<RawContextScope::VariableDesc*>(raw_addr); 2915 return reinterpret_cast<RawContextScope::VariableDesc*>(raw_addr);
2889 } 2916 }
2890 2917
2891 HEAP_OBJECT_IMPLEMENTATION(ContextScope, Object); 2918 FINAL_HEAP_OBJECT_IMPLEMENTATION(ContextScope, Object);
2892 friend class Class; 2919 friend class Class;
2893 }; 2920 };
2894 2921
2895 2922
2896 // Object holding information about an IC: test classes and their 2923 // Object holding information about an IC: test classes and their
2897 // corresponding targets. 2924 // corresponding targets.
2898 class ICData : public Object { 2925 class ICData : public Object {
2899 public: 2926 public:
2900 RawFunction* function() const { 2927 RawFunction* function() const {
2901 return raw_ptr()->function_; 2928 return raw_ptr()->function_;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 void set_ic_data(const Array& value) const; 3045 void set_ic_data(const Array& value) const;
3019 3046
3020 #if defined(DEBUG) 3047 #if defined(DEBUG)
3021 // Used in asserts to verify that a check is not added twice. 3048 // Used in asserts to verify that a check is not added twice.
3022 bool HasCheck(const GrowableArray<intptr_t>& cids) const; 3049 bool HasCheck(const GrowableArray<intptr_t>& cids) const;
3023 #endif // DEBUG 3050 #endif // DEBUG
3024 3051
3025 intptr_t TestEntryLength() const; 3052 intptr_t TestEntryLength() const;
3026 void WriteSentinel() const; 3053 void WriteSentinel() const;
3027 3054
3028 HEAP_OBJECT_IMPLEMENTATION(ICData, Object); 3055 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object);
3029 friend class Class; 3056 friend class Class;
3030 }; 3057 };
3031 3058
3032 3059
3033 class MegamorphicCache : public Object { 3060 class MegamorphicCache : public Object {
3034 public: 3061 public:
3035 static const int kInitialCapacity = 16; 3062 static const int kInitialCapacity = 16;
3036 static const double kLoadFactor; 3063 static const double kLoadFactor;
3037 3064
3038 RawArray* buckets() const; 3065 RawArray* buckets() const;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3072 3099
3073 static inline void SetEntry(const Array& array, 3100 static inline void SetEntry(const Array& array,
3074 intptr_t index, 3101 intptr_t index,
3075 const Smi& class_id, 3102 const Smi& class_id,
3076 const Function& target); 3103 const Function& target);
3077 3104
3078 static inline RawObject* GetClassId(const Array& array, intptr_t index); 3105 static inline RawObject* GetClassId(const Array& array, intptr_t index);
3079 static inline RawObject* GetTargetFunction(const Array& array, 3106 static inline RawObject* GetTargetFunction(const Array& array,
3080 intptr_t index); 3107 intptr_t index);
3081 3108
3082 HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache, Object); 3109 FINAL_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache, Object);
3083 }; 3110 };
3084 3111
3085 3112
3086 class SubtypeTestCache : public Object { 3113 class SubtypeTestCache : public Object {
3087 public: 3114 public:
3088 enum Entries { 3115 enum Entries {
3089 kInstanceClassId = 0, 3116 kInstanceClassId = 0,
3090 kInstanceTypeArguments = 1, 3117 kInstanceTypeArguments = 1,
3091 kInstantiatorTypeArguments = 2, 3118 kInstantiatorTypeArguments = 2,
3092 kTestResult = 3, 3119 kTestResult = 3,
(...skipping 23 matching lines...) Expand all
3116 3143
3117 private: 3144 private:
3118 RawArray* cache() const { 3145 RawArray* cache() const {
3119 return raw_ptr()->cache_; 3146 return raw_ptr()->cache_;
3120 } 3147 }
3121 3148
3122 void set_cache(const Array& value) const; 3149 void set_cache(const Array& value) const;
3123 3150
3124 intptr_t TestEntryLength() const; 3151 intptr_t TestEntryLength() const;
3125 3152
3126 HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache, Object); 3153 FINAL_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache, Object);
3127 friend class Class; 3154 friend class Class;
3128 }; 3155 };
3129 3156
3130 3157
3131 class Error : public Object { 3158 class Error : public Object {
3132 public: 3159 public:
3133 virtual const char* ToErrorCString() const; 3160 virtual const char* ToErrorCString() const;
3134 3161
3135 private: 3162 private:
3136 HEAP_OBJECT_IMPLEMENTATION(Error, Object); 3163 HEAP_OBJECT_IMPLEMENTATION(Error, Object);
(...skipping 13 matching lines...) Expand all
3150 3177
3151 static RawApiError* New(const String& message, 3178 static RawApiError* New(const String& message,
3152 Heap::Space space = Heap::kNew); 3179 Heap::Space space = Heap::kNew);
3153 3180
3154 virtual const char* ToErrorCString() const; 3181 virtual const char* ToErrorCString() const;
3155 3182
3156 private: 3183 private:
3157 void set_message(const String& message) const; 3184 void set_message(const String& message) const;
3158 static RawApiError* New(); 3185 static RawApiError* New();
3159 3186
3160 HEAP_OBJECT_IMPLEMENTATION(ApiError, Error); 3187 FINAL_HEAP_OBJECT_IMPLEMENTATION(ApiError, Error);
3161 friend class Class; 3188 friend class Class;
3162 }; 3189 };
3163 3190
3164 3191
3165 class LanguageError : public Error { 3192 class LanguageError : public Error {
3166 public: 3193 public:
3167 RawString* message() const { return raw_ptr()->message_; } 3194 RawString* message() const { return raw_ptr()->message_; }
3168 static intptr_t message_offset() { 3195 static intptr_t message_offset() {
3169 return OFFSET_OF(RawLanguageError, message_); 3196 return OFFSET_OF(RawLanguageError, message_);
3170 } 3197 }
3171 3198
3172 static intptr_t InstanceSize() { 3199 static intptr_t InstanceSize() {
3173 return RoundedAllocationSize(sizeof(RawLanguageError)); 3200 return RoundedAllocationSize(sizeof(RawLanguageError));
3174 } 3201 }
3175 3202
3176 static RawLanguageError* New(const String& message, 3203 static RawLanguageError* New(const String& message,
3177 Heap::Space space = Heap::kNew); 3204 Heap::Space space = Heap::kNew);
3178 3205
3179 virtual const char* ToErrorCString() const; 3206 virtual const char* ToErrorCString() const;
3180 3207
3181 private: 3208 private:
3182 void set_message(const String& message) const; 3209 void set_message(const String& message) const;
3183 static RawLanguageError* New(); 3210 static RawLanguageError* New();
3184 3211
3185 HEAP_OBJECT_IMPLEMENTATION(LanguageError, Error); 3212 FINAL_HEAP_OBJECT_IMPLEMENTATION(LanguageError, Error);
3186 friend class Class; 3213 friend class Class;
3187 }; 3214 };
3188 3215
3189 3216
3190 class UnhandledException : public Error { 3217 class UnhandledException : public Error {
3191 public: 3218 public:
3192 RawInstance* exception() const { return raw_ptr()->exception_; } 3219 RawInstance* exception() const { return raw_ptr()->exception_; }
3193 static intptr_t exception_offset() { 3220 static intptr_t exception_offset() {
3194 return OFFSET_OF(RawUnhandledException, exception_); 3221 return OFFSET_OF(RawUnhandledException, exception_);
3195 } 3222 }
(...skipping 10 matching lines...) Expand all
3206 static RawUnhandledException* New(const Instance& exception, 3233 static RawUnhandledException* New(const Instance& exception,
3207 const Instance& stacktrace, 3234 const Instance& stacktrace,
3208 Heap::Space space = Heap::kNew); 3235 Heap::Space space = Heap::kNew);
3209 3236
3210 virtual const char* ToErrorCString() const; 3237 virtual const char* ToErrorCString() const;
3211 3238
3212 private: 3239 private:
3213 void set_exception(const Instance& exception) const; 3240 void set_exception(const Instance& exception) const;
3214 void set_stacktrace(const Instance& stacktrace) const; 3241 void set_stacktrace(const Instance& stacktrace) const;
3215 3242
3216 HEAP_OBJECT_IMPLEMENTATION(UnhandledException, Error); 3243 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnhandledException, Error);
3217 friend class Class; 3244 friend class Class;
3218 }; 3245 };
3219 3246
3220 3247
3221 class UnwindError : public Error { 3248 class UnwindError : public Error {
3222 public: 3249 public:
3223 RawString* message() const { return raw_ptr()->message_; } 3250 RawString* message() const { return raw_ptr()->message_; }
3224 static intptr_t message_offset() { 3251 static intptr_t message_offset() {
3225 return OFFSET_OF(RawUnwindError, message_); 3252 return OFFSET_OF(RawUnwindError, message_);
3226 } 3253 }
3227 3254
3228 static intptr_t InstanceSize() { 3255 static intptr_t InstanceSize() {
3229 return RoundedAllocationSize(sizeof(RawUnwindError)); 3256 return RoundedAllocationSize(sizeof(RawUnwindError));
3230 } 3257 }
3231 3258
3232 static RawUnwindError* New(const String& message, 3259 static RawUnwindError* New(const String& message,
3233 Heap::Space space = Heap::kNew); 3260 Heap::Space space = Heap::kNew);
3234 3261
3235 virtual const char* ToErrorCString() const; 3262 virtual const char* ToErrorCString() const;
3236 3263
3237 private: 3264 private:
3238 void set_message(const String& message) const; 3265 void set_message(const String& message) const;
3239 3266
3240 HEAP_OBJECT_IMPLEMENTATION(UnwindError, Error); 3267 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnwindError, Error);
3241 friend class Class; 3268 friend class Class;
3242 }; 3269 };
3243 3270
3244 3271
3245 // Instance is the base class for all instance objects (aka the Object class 3272 // Instance is the base class for all instance objects (aka the Object class
3246 // in Dart source code. 3273 // in Dart source code.
3247 class Instance : public Object { 3274 class Instance : public Object {
3248 public: 3275 public:
3249 virtual bool Equals(const Instance& other) const; 3276 virtual bool Equals(const Instance& other) const;
3250 virtual RawInstance* Canonicalize() const; 3277 virtual RawInstance* Canonicalize() const;
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
3729 static RawMint* New(int64_t value, Heap::Space space = Heap::kNew); 3756 static RawMint* New(int64_t value, Heap::Space space = Heap::kNew);
3730 static RawMint* NewCanonical(int64_t value); 3757 static RawMint* NewCanonical(int64_t value);
3731 3758
3732 static intptr_t InstanceSize() { 3759 static intptr_t InstanceSize() {
3733 return RoundedAllocationSize(sizeof(RawMint)); 3760 return RoundedAllocationSize(sizeof(RawMint));
3734 } 3761 }
3735 3762
3736 private: 3763 private:
3737 void set_value(int64_t value) const; 3764 void set_value(int64_t value) const;
3738 3765
3739 HEAP_OBJECT_IMPLEMENTATION(Mint, Integer); 3766 FINAL_HEAP_OBJECT_IMPLEMENTATION(Mint, Integer);
3740 friend class Class; 3767 friend class Class;
3741 }; 3768 };
3742 3769
3743 3770
3744 class Bigint : public Integer { 3771 class Bigint : public Integer {
3745 private: 3772 private:
3746 typedef uint32_t Chunk; 3773 typedef uint32_t Chunk;
3747 typedef uint64_t DoubleChunk; 3774 typedef uint64_t DoubleChunk;
3748 static const int kChunkSize = sizeof(Chunk); 3775 static const int kChunkSize = sizeof(Chunk);
3749 3776
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
3810 3837
3811 Chunk* ChunkAddr(intptr_t index) const { 3838 Chunk* ChunkAddr(intptr_t index) const {
3812 ASSERT(0 <= index); 3839 ASSERT(0 <= index);
3813 ASSERT(index < Length()); 3840 ASSERT(index < Length());
3814 uword digits_start = reinterpret_cast<uword>(raw_ptr()) + sizeof(RawBigint); 3841 uword digits_start = reinterpret_cast<uword>(raw_ptr()) + sizeof(RawBigint);
3815 return &(reinterpret_cast<Chunk*>(digits_start)[index]); 3842 return &(reinterpret_cast<Chunk*>(digits_start)[index]);
3816 } 3843 }
3817 3844
3818 static RawBigint* Allocate(intptr_t length, Heap::Space space = Heap::kNew); 3845 static RawBigint* Allocate(intptr_t length, Heap::Space space = Heap::kNew);
3819 3846
3820 HEAP_OBJECT_IMPLEMENTATION(Bigint, Integer); 3847 FINAL_HEAP_OBJECT_IMPLEMENTATION(Bigint, Integer);
3821 friend class BigintOperations; 3848 friend class BigintOperations;
3822 friend class Class; 3849 friend class Class;
3823 }; 3850 };
3824 3851
3825 3852
3826 // Class Double represents class Double in corelib_impl, which implements 3853 // Class Double represents class Double in corelib_impl, which implements
3827 // abstract class double in corelib. 3854 // abstract class double in corelib.
3828 class Double : public Number { 3855 class Double : public Number {
3829 public: 3856 public:
3830 double value() const { 3857 double value() const {
(...skipping 17 matching lines...) Expand all
3848 3875
3849 static intptr_t InstanceSize() { 3876 static intptr_t InstanceSize() {
3850 return RoundedAllocationSize(sizeof(RawDouble)); 3877 return RoundedAllocationSize(sizeof(RawDouble));
3851 } 3878 }
3852 3879
3853 static intptr_t value_offset() { return OFFSET_OF(RawDouble, value_); } 3880 static intptr_t value_offset() { return OFFSET_OF(RawDouble, value_); }
3854 3881
3855 private: 3882 private:
3856 void set_value(double value) const; 3883 void set_value(double value) const;
3857 3884
3858 HEAP_OBJECT_IMPLEMENTATION(Double, Number); 3885 FINAL_HEAP_OBJECT_IMPLEMENTATION(Double, Number);
3859 friend class Class; 3886 friend class Class;
3860 }; 3887 };
3861 3888
3862 3889
3863 // String may not be '\0' terminated. 3890 // String may not be '\0' terminated.
3864 class String : public Instance { 3891 class String : public Instance {
3865 public: 3892 public:
3866 // We use 30 bits for the hash code so that we consistently use a 3893 // We use 30 bits for the hash code so that we consistently use a
3867 // 32bit Smi representation for the hash code on all architectures. 3894 // 32bit Smi representation for the hash code on all architectures.
3868 static const intptr_t kHashBits = 30; 3895 static const intptr_t kHashBits = 30;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 } 4128 }
4102 4129
4103 template<typename HandleType, typename ElementType, typename CallbackType> 4130 template<typename HandleType, typename ElementType, typename CallbackType>
4104 static void ReadFromImpl(SnapshotReader* reader, 4131 static void ReadFromImpl(SnapshotReader* reader,
4105 String* str_obj, 4132 String* str_obj,
4106 intptr_t len, 4133 intptr_t len,
4107 intptr_t tags, 4134 intptr_t tags,
4108 CallbackType new_symbol, 4135 CallbackType new_symbol,
4109 Snapshot::Kind kind); 4136 Snapshot::Kind kind);
4110 4137
4111 HEAP_OBJECT_IMPLEMENTATION(String, Instance); 4138 FINAL_HEAP_OBJECT_IMPLEMENTATION(String, Instance);
4112 4139
4113 friend class Class; 4140 friend class Class;
4114 friend class Symbols; 4141 friend class Symbols;
4115 friend class OneByteString; 4142 friend class OneByteString;
4116 friend class TwoByteString; 4143 friend class TwoByteString;
4117 friend class ExternalOneByteString; 4144 friend class ExternalOneByteString;
4118 friend class ExternalTwoByteString; 4145 friend class ExternalTwoByteString;
4119 }; 4146 };
4120 4147
4121 4148
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
4463 static RawBool* Get(bool value) { 4490 static RawBool* Get(bool value) {
4464 return value ? Bool::True().raw() : Bool::False().raw(); 4491 return value ? Bool::True().raw() : Bool::False().raw();
4465 } 4492 }
4466 4493
4467 private: 4494 private:
4468 void set_value(bool value) const { raw_ptr()->value_ = value; } 4495 void set_value(bool value) const { raw_ptr()->value_ = value; }
4469 4496
4470 // New should only be called to initialize the two legal bool values. 4497 // New should only be called to initialize the two legal bool values.
4471 static RawBool* New(bool value); 4498 static RawBool* New(bool value);
4472 4499
4473 HEAP_OBJECT_IMPLEMENTATION(Bool, Instance); 4500 FINAL_HEAP_OBJECT_IMPLEMENTATION(Bool, Instance);
4474 friend class Class; 4501 friend class Class;
4475 friend class Object; // To initialize the true and false values. 4502 friend class Object; // To initialize the true and false values.
4476 }; 4503 };
4477 4504
4478 4505
4479 class Array : public Instance { 4506 class Array : public Instance {
4480 public: 4507 public:
4481 intptr_t Length() const { 4508 intptr_t Length() const {
4482 ASSERT(!IsNull()); 4509 ASSERT(!IsNull());
4483 return Smi::Value(raw_ptr()->length_); 4510 return Smi::Value(raw_ptr()->length_);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
4567 friend class Class; 4594 friend class Class;
4568 friend class String; 4595 friend class String;
4569 }; 4596 };
4570 4597
4571 4598
4572 class ImmutableArray : public Array { 4599 class ImmutableArray : public Array {
4573 public: 4600 public:
4574 static RawImmutableArray* New(intptr_t len, Heap::Space space = Heap::kNew); 4601 static RawImmutableArray* New(intptr_t len, Heap::Space space = Heap::kNew);
4575 4602
4576 private: 4603 private:
4577 HEAP_OBJECT_IMPLEMENTATION(ImmutableArray, Array); 4604 FINAL_HEAP_OBJECT_IMPLEMENTATION(ImmutableArray, Array);
4578 friend class Class; 4605 friend class Class;
4579 }; 4606 };
4580 4607
4581 4608
4582 class GrowableObjectArray : public Instance { 4609 class GrowableObjectArray : public Instance {
4583 public: 4610 public:
4584 intptr_t Capacity() const { 4611 intptr_t Capacity() const {
4585 NoGCScope no_gc; 4612 NoGCScope no_gc;
4586 ASSERT(!IsNull()); 4613 ASSERT(!IsNull());
4587 return Smi::Value(DataArray()->length_); 4614 return Smi::Value(DataArray()->length_);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
4676 // Filter stores based on source and target. 4703 // Filter stores based on source and target.
4677 if (!value->IsHeapObject()) return; 4704 if (!value->IsHeapObject()) return;
4678 if (value->IsNewObject() && data()->IsOldObject()) { 4705 if (value->IsNewObject() && data()->IsOldObject()) {
4679 uword ptr = reinterpret_cast<uword>(addr); 4706 uword ptr = reinterpret_cast<uword>(addr);
4680 Isolate::Current()->store_buffer()->AddPointer(ptr); 4707 Isolate::Current()->store_buffer()->AddPointer(ptr);
4681 } 4708 }
4682 } 4709 }
4683 4710
4684 static const int kDefaultInitialCapacity = 4; 4711 static const int kDefaultInitialCapacity = 4;
4685 4712
4686 HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance); 4713 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance);
4687 friend class Array; 4714 friend class Array;
4688 friend class Class; 4715 friend class Class;
4689 }; 4716 };
4690 4717
4691 4718
4692 class ByteArray : public Instance { 4719 class ByteArray : public Instance {
4693 public: 4720 public:
4694 intptr_t Length() const { 4721 intptr_t Length() const {
4695 ASSERT(!IsNull()); 4722 ASSERT(!IsNull());
4696 return Smi::Value(raw_ptr()->length_); 4723 return Smi::Value(raw_ptr()->length_);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
4795 static RawInt8Array* New(const int8_t* data, 4822 static RawInt8Array* New(const int8_t* data,
4796 intptr_t len, 4823 intptr_t len,
4797 Heap::Space space = Heap::kNew); 4824 Heap::Space space = Heap::kNew);
4798 4825
4799 private: 4826 private:
4800 uint8_t* ByteAddr(intptr_t byte_offset) const { 4827 uint8_t* ByteAddr(intptr_t byte_offset) const {
4801 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4828 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4802 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 4829 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4803 } 4830 }
4804 4831
4805 HEAP_OBJECT_IMPLEMENTATION(Int8Array, ByteArray); 4832 FINAL_HEAP_OBJECT_IMPLEMENTATION(Int8Array, ByteArray);
4806 friend class ByteArray; 4833 friend class ByteArray;
4807 friend class Class; 4834 friend class Class;
4808 }; 4835 };
4809 4836
4810 4837
4811 class Uint8Array : public ByteArray { 4838 class Uint8Array : public ByteArray {
4812 public: 4839 public:
4813 intptr_t ByteLength() const { 4840 intptr_t ByteLength() const {
4814 return Length(); 4841 return Length();
4815 } 4842 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4847 static RawUint8Array* New(const uint8_t* data, 4874 static RawUint8Array* New(const uint8_t* data,
4848 intptr_t len, 4875 intptr_t len,
4849 Heap::Space space = Heap::kNew); 4876 Heap::Space space = Heap::kNew);
4850 4877
4851 private: 4878 private:
4852 uint8_t* ByteAddr(intptr_t byte_offset) const { 4879 uint8_t* ByteAddr(intptr_t byte_offset) const {
4853 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4880 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4854 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 4881 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4855 } 4882 }
4856 4883
4857 HEAP_OBJECT_IMPLEMENTATION(Uint8Array, ByteArray); 4884 FINAL_HEAP_OBJECT_IMPLEMENTATION(Uint8Array, ByteArray);
4858 friend class ByteArray; 4885 friend class ByteArray;
4859 friend class Class; 4886 friend class Class;
4860 }; 4887 };
4861 4888
4862 4889
4863 class Uint8ClampedArray : public ByteArray { 4890 class Uint8ClampedArray : public ByteArray {
4864 public: 4891 public:
4865 intptr_t ByteLength() const { 4892 intptr_t ByteLength() const {
4866 return Length(); 4893 return Length();
4867 } 4894 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
4900 static RawUint8ClampedArray* New(const uint8_t* data, 4927 static RawUint8ClampedArray* New(const uint8_t* data,
4901 intptr_t len, 4928 intptr_t len,
4902 Heap::Space space = Heap::kNew); 4929 Heap::Space space = Heap::kNew);
4903 4930
4904 private: 4931 private:
4905 uint8_t* ByteAddr(intptr_t byte_offset) const { 4932 uint8_t* ByteAddr(intptr_t byte_offset) const {
4906 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4933 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4907 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 4934 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4908 } 4935 }
4909 4936
4910 HEAP_OBJECT_IMPLEMENTATION(Uint8ClampedArray, ByteArray); 4937 FINAL_HEAP_OBJECT_IMPLEMENTATION(Uint8ClampedArray, ByteArray);
4911 friend class ByteArray; 4938 friend class ByteArray;
4912 friend class Class; 4939 friend class Class;
4913 }; 4940 };
4914 4941
4915 4942
4916 class Int16Array : public ByteArray { 4943 class Int16Array : public ByteArray {
4917 public: 4944 public:
4918 intptr_t ByteLength() const { 4945 intptr_t ByteLength() const {
4919 return Length() * kBytesPerElement; 4946 return Length() * kBytesPerElement;
4920 } 4947 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4952 static RawInt16Array* New(const int16_t* data, 4979 static RawInt16Array* New(const int16_t* data,
4953 intptr_t len, 4980 intptr_t len,
4954 Heap::Space space = Heap::kNew); 4981 Heap::Space space = Heap::kNew);
4955 4982
4956 private: 4983 private:
4957 uint8_t* ByteAddr(intptr_t byte_offset) const { 4984 uint8_t* ByteAddr(intptr_t byte_offset) const {
4958 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 4985 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
4959 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 4986 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
4960 } 4987 }
4961 4988
4962 HEAP_OBJECT_IMPLEMENTATION(Int16Array, ByteArray); 4989 FINAL_HEAP_OBJECT_IMPLEMENTATION(Int16Array, ByteArray);
4963 friend class ByteArray; 4990 friend class ByteArray;
4964 friend class Class; 4991 friend class Class;
4965 }; 4992 };
4966 4993
4967 4994
4968 class Uint16Array : public ByteArray { 4995 class Uint16Array : public ByteArray {
4969 public: 4996 public:
4970 intptr_t ByteLength() const { 4997 intptr_t ByteLength() const {
4971 return Length() * kBytesPerElement; 4998 return Length() * kBytesPerElement;
4972 } 4999 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5004 static RawUint16Array* New(const uint16_t* data, 5031 static RawUint16Array* New(const uint16_t* data,
5005 intptr_t len, 5032 intptr_t len,
5006 Heap::Space space = Heap::kNew); 5033 Heap::Space space = Heap::kNew);
5007 5034
5008 private: 5035 private:
5009 uint8_t* ByteAddr(intptr_t byte_offset) const { 5036 uint8_t* ByteAddr(intptr_t byte_offset) const {
5010 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5037 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5011 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 5038 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
5012 } 5039 }
5013 5040
5014 HEAP_OBJECT_IMPLEMENTATION(Uint16Array, ByteArray); 5041 FINAL_HEAP_OBJECT_IMPLEMENTATION(Uint16Array, ByteArray);
5015 friend class ByteArray; 5042 friend class ByteArray;
5016 friend class Class; 5043 friend class Class;
5017 }; 5044 };
5018 5045
5019 5046
5020 class Int32Array : public ByteArray { 5047 class Int32Array : public ByteArray {
5021 public: 5048 public:
5022 intptr_t ByteLength() const { 5049 intptr_t ByteLength() const {
5023 return Length() * kBytesPerElement; 5050 return Length() * kBytesPerElement;
5024 } 5051 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5056 static RawInt32Array* New(const int32_t* data, 5083 static RawInt32Array* New(const int32_t* data,
5057 intptr_t len, 5084 intptr_t len,
5058 Heap::Space space = Heap::kNew); 5085 Heap::Space space = Heap::kNew);
5059 5086
5060 private: 5087 private:
5061 uint8_t* ByteAddr(intptr_t byte_offset) const { 5088 uint8_t* ByteAddr(intptr_t byte_offset) const {
5062 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5089 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5063 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 5090 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
5064 } 5091 }
5065 5092
5066 HEAP_OBJECT_IMPLEMENTATION(Int32Array, ByteArray); 5093 FINAL_HEAP_OBJECT_IMPLEMENTATION(Int32Array, ByteArray);
5067 friend class ByteArray; 5094 friend class ByteArray;
5068 friend class Class; 5095 friend class Class;
5069 }; 5096 };
5070 5097
5071 5098
5072 class Uint32Array : public ByteArray { 5099 class Uint32Array : public ByteArray {
5073 public: 5100 public:
5074 intptr_t ByteLength() const { 5101 intptr_t ByteLength() const {
5075 return Length() * kBytesPerElement; 5102 return Length() * kBytesPerElement;
5076 } 5103 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5108 static RawUint32Array* New(const uint32_t* data, 5135 static RawUint32Array* New(const uint32_t* data,
5109 intptr_t len, 5136 intptr_t len,
5110 Heap::Space space = Heap::kNew); 5137 Heap::Space space = Heap::kNew);
5111 5138
5112 private: 5139 private:
5113 uint8_t* ByteAddr(intptr_t byte_offset) const { 5140 uint8_t* ByteAddr(intptr_t byte_offset) const {
5114 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5141 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5115 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 5142 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
5116 } 5143 }
5117 5144
5118 HEAP_OBJECT_IMPLEMENTATION(Uint32Array, ByteArray); 5145 FINAL_HEAP_OBJECT_IMPLEMENTATION(Uint32Array, ByteArray);
5119 friend class ByteArray; 5146 friend class ByteArray;
5120 friend class Class; 5147 friend class Class;
5121 }; 5148 };
5122 5149
5123 5150
5124 class Int64Array : public ByteArray { 5151 class Int64Array : public ByteArray {
5125 public: 5152 public:
5126 intptr_t ByteLength() const { 5153 intptr_t ByteLength() const {
5127 return Length() * kBytesPerElement; 5154 return Length() * kBytesPerElement;
5128 } 5155 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5160 static RawInt64Array* New(const int64_t* data, 5187 static RawInt64Array* New(const int64_t* data,
5161 intptr_t len, 5188 intptr_t len,
5162 Heap::Space space = Heap::kNew); 5189 Heap::Space space = Heap::kNew);
5163 5190
5164 private: 5191 private:
5165 uint8_t* ByteAddr(intptr_t byte_offset) const { 5192 uint8_t* ByteAddr(intptr_t byte_offset) const {
5166 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5193 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5167 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 5194 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
5168 } 5195 }
5169 5196
5170 HEAP_OBJECT_IMPLEMENTATION(Int64Array, ByteArray); 5197 FINAL_HEAP_OBJECT_IMPLEMENTATION(Int64Array, ByteArray);
5171 friend class ByteArray; 5198 friend class ByteArray;
5172 friend class Class; 5199 friend class Class;
5173 }; 5200 };
5174 5201
5175 5202
5176 class Uint64Array : public ByteArray { 5203 class Uint64Array : public ByteArray {
5177 public: 5204 public:
5178 intptr_t ByteLength() const { 5205 intptr_t ByteLength() const {
5179 return Length() * sizeof(uint64_t); 5206 return Length() * sizeof(uint64_t);
5180 } 5207 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5212 static RawUint64Array* New(const uint64_t* data, 5239 static RawUint64Array* New(const uint64_t* data,
5213 intptr_t len, 5240 intptr_t len,
5214 Heap::Space space = Heap::kNew); 5241 Heap::Space space = Heap::kNew);
5215 5242
5216 private: 5243 private:
5217 uint8_t* ByteAddr(intptr_t byte_offset) const { 5244 uint8_t* ByteAddr(intptr_t byte_offset) const {
5218 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5245 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5219 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 5246 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
5220 } 5247 }
5221 5248
5222 HEAP_OBJECT_IMPLEMENTATION(Uint64Array, ByteArray); 5249 FINAL_HEAP_OBJECT_IMPLEMENTATION(Uint64Array, ByteArray);
5223 friend class ByteArray; 5250 friend class ByteArray;
5224 friend class Class; 5251 friend class Class;
5225 }; 5252 };
5226 5253
5227 5254
5228 class Float32Array : public ByteArray { 5255 class Float32Array : public ByteArray {
5229 public: 5256 public:
5230 intptr_t ByteLength() const { 5257 intptr_t ByteLength() const {
5231 return Length() * kBytesPerElement; 5258 return Length() * kBytesPerElement;
5232 } 5259 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5264 static RawFloat32Array* New(const float* data, 5291 static RawFloat32Array* New(const float* data,
5265 intptr_t len, 5292 intptr_t len,
5266 Heap::Space space = Heap::kNew); 5293 Heap::Space space = Heap::kNew);
5267 5294
5268 private: 5295 private:
5269 uint8_t* ByteAddr(intptr_t byte_offset) const { 5296 uint8_t* ByteAddr(intptr_t byte_offset) const {
5270 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5297 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5271 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 5298 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
5272 } 5299 }
5273 5300
5274 HEAP_OBJECT_IMPLEMENTATION(Float32Array, ByteArray); 5301 FINAL_HEAP_OBJECT_IMPLEMENTATION(Float32Array, ByteArray);
5275 friend class ByteArray; 5302 friend class ByteArray;
5276 friend class Class; 5303 friend class Class;
5277 }; 5304 };
5278 5305
5279 5306
5280 class Float64Array : public ByteArray { 5307 class Float64Array : public ByteArray {
5281 public: 5308 public:
5282 intptr_t ByteLength() const { 5309 intptr_t ByteLength() const {
5283 return Length() * kBytesPerElement; 5310 return Length() * kBytesPerElement;
5284 } 5311 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5316 static RawFloat64Array* New(const double* data, 5343 static RawFloat64Array* New(const double* data,
5317 intptr_t len, 5344 intptr_t len,
5318 Heap::Space space = Heap::kNew); 5345 Heap::Space space = Heap::kNew);
5319 5346
5320 private: 5347 private:
5321 uint8_t* ByteAddr(intptr_t byte_offset) const { 5348 uint8_t* ByteAddr(intptr_t byte_offset) const {
5322 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5349 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5323 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset; 5350 return reinterpret_cast<uint8_t*>(&raw_ptr()->data_) + byte_offset;
5324 } 5351 }
5325 5352
5326 HEAP_OBJECT_IMPLEMENTATION(Float64Array, ByteArray); 5353 FINAL_HEAP_OBJECT_IMPLEMENTATION(Float64Array, ByteArray);
5327 friend class ByteArray; 5354 friend class ByteArray;
5328 friend class Class; 5355 friend class Class;
5329 }; 5356 };
5330 5357
5331 5358
5332 class ExternalInt8Array : public ByteArray { 5359 class ExternalInt8Array : public ByteArray {
5333 public: 5360 public:
5334 intptr_t ByteLength() const { 5361 intptr_t ByteLength() const {
5335 return Length() * kBytesPerElement; 5362 return Length() * kBytesPerElement;
5336 } 5363 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5374 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5401 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5375 uint8_t* data = 5402 uint8_t* data =
5376 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 5403 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
5377 return data + byte_offset; 5404 return data + byte_offset;
5378 } 5405 }
5379 5406
5380 void SetExternalData(ExternalByteArrayData<int8_t>* data) { 5407 void SetExternalData(ExternalByteArrayData<int8_t>* data) {
5381 raw_ptr()->external_data_ = data; 5408 raw_ptr()->external_data_ = data;
5382 } 5409 }
5383 5410
5384 HEAP_OBJECT_IMPLEMENTATION(ExternalInt8Array, ByteArray); 5411 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalInt8Array, ByteArray);
5385 friend class ByteArray; 5412 friend class ByteArray;
5386 friend class Class; 5413 friend class Class;
5387 }; 5414 };
5388 5415
5389 5416
5390 class ExternalUint8Array : public ByteArray { 5417 class ExternalUint8Array : public ByteArray {
5391 public: 5418 public:
5392 intptr_t ByteLength() const { 5419 intptr_t ByteLength() const {
5393 return Length() * kBytesPerElement; 5420 return Length() * kBytesPerElement;
5394 } 5421 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
5452 5479
5453 class ExternalUint8ClampedArray : public ExternalUint8Array { 5480 class ExternalUint8ClampedArray : public ExternalUint8Array {
5454 public: 5481 public:
5455 static RawExternalUint8ClampedArray* New(uint8_t* data, 5482 static RawExternalUint8ClampedArray* New(uint8_t* data,
5456 intptr_t len, 5483 intptr_t len,
5457 void* peer, 5484 void* peer,
5458 Dart_PeerFinalizer callback, 5485 Dart_PeerFinalizer callback,
5459 Heap::Space space = Heap::kNew); 5486 Heap::Space space = Heap::kNew);
5460 5487
5461 private: 5488 private:
5462 HEAP_OBJECT_IMPLEMENTATION(ExternalUint8ClampedArray, ExternalUint8Array); 5489 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalUint8ClampedArray,
5490 ExternalUint8Array);
5463 friend class Class; 5491 friend class Class;
5464 }; 5492 };
5465 5493
5466 5494
5467 class ExternalInt16Array : public ByteArray { 5495 class ExternalInt16Array : public ByteArray {
5468 public: 5496 public:
5469 intptr_t ByteLength() const { 5497 intptr_t ByteLength() const {
5470 return Length() * kBytesPerElement; 5498 return Length() * kBytesPerElement;
5471 } 5499 }
5472 5500
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
5509 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5537 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5510 uint8_t* data = 5538 uint8_t* data =
5511 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 5539 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
5512 return data + byte_offset; 5540 return data + byte_offset;
5513 } 5541 }
5514 5542
5515 void SetExternalData(ExternalByteArrayData<int16_t>* data) { 5543 void SetExternalData(ExternalByteArrayData<int16_t>* data) {
5516 raw_ptr()->external_data_ = data; 5544 raw_ptr()->external_data_ = data;
5517 } 5545 }
5518 5546
5519 HEAP_OBJECT_IMPLEMENTATION(ExternalInt16Array, ByteArray); 5547 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalInt16Array, ByteArray);
5520 friend class ByteArray; 5548 friend class ByteArray;
5521 friend class Class; 5549 friend class Class;
5522 }; 5550 };
5523 5551
5524 5552
5525 class ExternalUint16Array : public ByteArray { 5553 class ExternalUint16Array : public ByteArray {
5526 public: 5554 public:
5527 intptr_t ByteLength() const { 5555 intptr_t ByteLength() const {
5528 return Length() * kBytesPerElement; 5556 return Length() * kBytesPerElement;
5529 } 5557 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5567 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5595 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5568 uint8_t* data = 5596 uint8_t* data =
5569 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 5597 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
5570 return data + byte_offset; 5598 return data + byte_offset;
5571 } 5599 }
5572 5600
5573 void SetExternalData(ExternalByteArrayData<uint16_t>* data) { 5601 void SetExternalData(ExternalByteArrayData<uint16_t>* data) {
5574 raw_ptr()->external_data_ = data; 5602 raw_ptr()->external_data_ = data;
5575 } 5603 }
5576 5604
5577 HEAP_OBJECT_IMPLEMENTATION(ExternalUint16Array, ByteArray); 5605 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalUint16Array, ByteArray);
5578 friend class ByteArray; 5606 friend class ByteArray;
5579 friend class Class; 5607 friend class Class;
5580 }; 5608 };
5581 5609
5582 5610
5583 class ExternalInt32Array : public ByteArray { 5611 class ExternalInt32Array : public ByteArray {
5584 public: 5612 public:
5585 intptr_t ByteLength() const { 5613 intptr_t ByteLength() const {
5586 return Length() * kBytesPerElement; 5614 return Length() * kBytesPerElement;
5587 } 5615 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5625 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5653 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5626 uint8_t* data = 5654 uint8_t* data =
5627 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 5655 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
5628 return data + byte_offset; 5656 return data + byte_offset;
5629 } 5657 }
5630 5658
5631 void SetExternalData(ExternalByteArrayData<int32_t>* data) { 5659 void SetExternalData(ExternalByteArrayData<int32_t>* data) {
5632 raw_ptr()->external_data_ = data; 5660 raw_ptr()->external_data_ = data;
5633 } 5661 }
5634 5662
5635 HEAP_OBJECT_IMPLEMENTATION(ExternalInt32Array, ByteArray); 5663 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalInt32Array, ByteArray);
5636 friend class ByteArray; 5664 friend class ByteArray;
5637 friend class Class; 5665 friend class Class;
5638 }; 5666 };
5639 5667
5640 5668
5641 class ExternalUint32Array : public ByteArray { 5669 class ExternalUint32Array : public ByteArray {
5642 public: 5670 public:
5643 intptr_t ByteLength() const { 5671 intptr_t ByteLength() const {
5644 return Length() * kBytesPerElement; 5672 return Length() * kBytesPerElement;
5645 } 5673 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5683 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5711 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5684 uint8_t* data = 5712 uint8_t* data =
5685 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 5713 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
5686 return data + byte_offset; 5714 return data + byte_offset;
5687 } 5715 }
5688 5716
5689 void SetExternalData(ExternalByteArrayData<uint32_t>* data) { 5717 void SetExternalData(ExternalByteArrayData<uint32_t>* data) {
5690 raw_ptr()->external_data_ = data; 5718 raw_ptr()->external_data_ = data;
5691 } 5719 }
5692 5720
5693 HEAP_OBJECT_IMPLEMENTATION(ExternalUint32Array, ByteArray); 5721 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalUint32Array, ByteArray);
5694 friend class ByteArray; 5722 friend class ByteArray;
5695 friend class Class; 5723 friend class Class;
5696 }; 5724 };
5697 5725
5698 5726
5699 class ExternalInt64Array : public ByteArray { 5727 class ExternalInt64Array : public ByteArray {
5700 public: 5728 public:
5701 intptr_t ByteLength() const { 5729 intptr_t ByteLength() const {
5702 return Length() * kBytesPerElement; 5730 return Length() * kBytesPerElement;
5703 } 5731 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5741 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5769 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5742 uint8_t* data = 5770 uint8_t* data =
5743 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 5771 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
5744 return data + byte_offset; 5772 return data + byte_offset;
5745 } 5773 }
5746 5774
5747 void SetExternalData(ExternalByteArrayData<int64_t>* data) { 5775 void SetExternalData(ExternalByteArrayData<int64_t>* data) {
5748 raw_ptr()->external_data_ = data; 5776 raw_ptr()->external_data_ = data;
5749 } 5777 }
5750 5778
5751 HEAP_OBJECT_IMPLEMENTATION(ExternalInt64Array, ByteArray); 5779 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalInt64Array, ByteArray);
5752 friend class ByteArray; 5780 friend class ByteArray;
5753 friend class Class; 5781 friend class Class;
5754 }; 5782 };
5755 5783
5756 5784
5757 class ExternalUint64Array : public ByteArray { 5785 class ExternalUint64Array : public ByteArray {
5758 public: 5786 public:
5759 intptr_t ByteLength() const { 5787 intptr_t ByteLength() const {
5760 return Length() * kBytesPerElement; 5788 return Length() * kBytesPerElement;
5761 } 5789 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5799 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5827 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5800 uint8_t* data = 5828 uint8_t* data =
5801 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 5829 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
5802 return data + byte_offset; 5830 return data + byte_offset;
5803 } 5831 }
5804 5832
5805 void SetExternalData(ExternalByteArrayData<uint64_t>* data) { 5833 void SetExternalData(ExternalByteArrayData<uint64_t>* data) {
5806 raw_ptr()->external_data_ = data; 5834 raw_ptr()->external_data_ = data;
5807 } 5835 }
5808 5836
5809 HEAP_OBJECT_IMPLEMENTATION(ExternalUint64Array, ByteArray); 5837 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalUint64Array, ByteArray);
5810 friend class ByteArray; 5838 friend class ByteArray;
5811 friend class Class; 5839 friend class Class;
5812 }; 5840 };
5813 5841
5814 5842
5815 class ExternalFloat32Array : public ByteArray { 5843 class ExternalFloat32Array : public ByteArray {
5816 public: 5844 public:
5817 intptr_t ByteLength() const { 5845 intptr_t ByteLength() const {
5818 return Length() * kBytesPerElement; 5846 return Length() * kBytesPerElement;
5819 } 5847 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5857 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5885 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5858 uint8_t* data = 5886 uint8_t* data =
5859 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 5887 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
5860 return data + byte_offset; 5888 return data + byte_offset;
5861 } 5889 }
5862 5890
5863 void SetExternalData(ExternalByteArrayData<float>* data) { 5891 void SetExternalData(ExternalByteArrayData<float>* data) {
5864 raw_ptr()->external_data_ = data; 5892 raw_ptr()->external_data_ = data;
5865 } 5893 }
5866 5894
5867 HEAP_OBJECT_IMPLEMENTATION(ExternalFloat32Array, ByteArray); 5895 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat32Array, ByteArray);
5868 friend class ByteArray; 5896 friend class ByteArray;
5869 friend class Class; 5897 friend class Class;
5870 }; 5898 };
5871 5899
5872 5900
5873 class ExternalFloat64Array : public ByteArray { 5901 class ExternalFloat64Array : public ByteArray {
5874 public: 5902 public:
5875 intptr_t ByteLength() const { 5903 intptr_t ByteLength() const {
5876 return Length() * kBytesPerElement; 5904 return Length() * kBytesPerElement;
5877 } 5905 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
5915 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength())); 5943 ASSERT((byte_offset >= 0) && (byte_offset < ByteLength()));
5916 uint8_t* data = 5944 uint8_t* data =
5917 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data()); 5945 reinterpret_cast<uint8_t*>(raw_ptr()->external_data_->data());
5918 return data + byte_offset; 5946 return data + byte_offset;
5919 } 5947 }
5920 5948
5921 void SetExternalData(ExternalByteArrayData<double>* data) { 5949 void SetExternalData(ExternalByteArrayData<double>* data) {
5922 raw_ptr()->external_data_ = data; 5950 raw_ptr()->external_data_ = data;
5923 } 5951 }
5924 5952
5925 HEAP_OBJECT_IMPLEMENTATION(ExternalFloat64Array, ByteArray); 5953 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalFloat64Array, ByteArray);
5926 friend class ByteArray; 5954 friend class ByteArray;
5927 friend class Class; 5955 friend class Class;
5928 }; 5956 };
5929 5957
5930 5958
5931 // DartFunction represents the abstract Dart class 'Function'. 5959 // DartFunction represents the abstract Dart class 'Function'.
5932 class DartFunction : public Instance { 5960 class DartFunction : public Instance {
5933 private: 5961 private:
5934 HEAP_OBJECT_IMPLEMENTATION(DartFunction, Instance); 5962 FINAL_HEAP_OBJECT_IMPLEMENTATION(DartFunction, Instance);
5935 friend class Class; 5963 friend class Class;
5936 friend class Instance; 5964 friend class Instance;
5937 }; 5965 };
5938 5966
5939 5967
5940 class Closure : public AllStatic { 5968 class Closure : public AllStatic {
5941 public: 5969 public:
5942 static RawFunction* function(const Instance& closure) { 5970 static RawFunction* function(const Instance& closure) {
5943 return *FunctionAddr(closure); 5971 return *FunctionAddr(closure);
5944 } 5972 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
6029 const GrowableObjectArray& pc_offset_list, 6057 const GrowableObjectArray& pc_offset_list,
6030 Heap::Space space = Heap::kNew); 6058 Heap::Space space = Heap::kNew);
6031 6059
6032 const char* ToCStringInternal(bool verbose) const; 6060 const char* ToCStringInternal(bool verbose) const;
6033 6061
6034 private: 6062 private:
6035 void set_function_array(const Array& function_array) const; 6063 void set_function_array(const Array& function_array) const;
6036 void set_code_array(const Array& code_array) const; 6064 void set_code_array(const Array& code_array) const;
6037 void set_pc_offset_array(const Array& pc_offset_array) const; 6065 void set_pc_offset_array(const Array& pc_offset_array) const;
6038 6066
6039 HEAP_OBJECT_IMPLEMENTATION(Stacktrace, Instance); 6067 FINAL_HEAP_OBJECT_IMPLEMENTATION(Stacktrace, Instance);
6040 friend class Class; 6068 friend class Class;
6041 }; 6069 };
6042 6070
6043 6071
6044 // Internal JavaScript regular expression object. 6072 // Internal JavaScript regular expression object.
6045 class JSRegExp : public Instance { 6073 class JSRegExp : public Instance {
6046 public: 6074 public:
6047 // Meaning of RegExType: 6075 // Meaning of RegExType:
6048 // kUninitialized: the type of th regexp has not been initialized yet. 6076 // kUninitialized: the type of th regexp has not been initialized yet.
6049 // kSimple: A simple pattern to match against, using string indexOf operation. 6077 // kSimple: A simple pattern to match against, using string indexOf operation.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
6109 private: 6137 private:
6110 void set_type(RegExType type) const { raw_ptr()->type_ = type; } 6138 void set_type(RegExType type) const { raw_ptr()->type_ = type; }
6111 void set_flags(intptr_t value) const { raw_ptr()->flags_ = value; } 6139 void set_flags(intptr_t value) const { raw_ptr()->flags_ = value; }
6112 6140
6113 void SetLength(intptr_t value) const { 6141 void SetLength(intptr_t value) const {
6114 // This is only safe because we create a new Smi, which does not cause 6142 // This is only safe because we create a new Smi, which does not cause
6115 // heap allocation. 6143 // heap allocation.
6116 raw_ptr()->data_length_ = Smi::New(value); 6144 raw_ptr()->data_length_ = Smi::New(value);
6117 } 6145 }
6118 6146
6119 HEAP_OBJECT_IMPLEMENTATION(JSRegExp, Instance); 6147 FINAL_HEAP_OBJECT_IMPLEMENTATION(JSRegExp, Instance);
6120 friend class Class; 6148 friend class Class;
6121 }; 6149 };
6122 6150
6123 6151
6124 class WeakProperty : public Instance { 6152 class WeakProperty : public Instance {
6125 public: 6153 public:
6126 RawObject* key() const { 6154 RawObject* key() const {
6127 return raw_ptr()->key_; 6155 return raw_ptr()->key_;
6128 } 6156 }
6129 6157
(...skipping 14 matching lines...) Expand all
6144 static intptr_t InstanceSize() { 6172 static intptr_t InstanceSize() {
6145 return RoundedAllocationSize(sizeof(RawWeakProperty)); 6173 return RoundedAllocationSize(sizeof(RawWeakProperty));
6146 } 6174 }
6147 6175
6148 static void Clear(RawWeakProperty* raw_weak) { 6176 static void Clear(RawWeakProperty* raw_weak) {
6149 raw_weak->ptr()->key_ = Object::null(); 6177 raw_weak->ptr()->key_ = Object::null();
6150 raw_weak->ptr()->value_ = Object::null(); 6178 raw_weak->ptr()->value_ = Object::null();
6151 } 6179 }
6152 6180
6153 private: 6181 private:
6154 HEAP_OBJECT_IMPLEMENTATION(WeakProperty, Instance); 6182 FINAL_HEAP_OBJECT_IMPLEMENTATION(WeakProperty, Instance);
6155 friend class Class; 6183 friend class Class;
6156 }; 6184 };
6157 6185
6158 6186
6159 // Breaking cycles and loops. 6187 // Breaking cycles and loops.
6160 RawClass* Object::clazz() const { 6188 RawClass* Object::clazz() const {
6161 uword raw_value = reinterpret_cast<uword>(raw_); 6189 uword raw_value = reinterpret_cast<uword>(raw_);
6162 if ((raw_value & kSmiTagMask) == kSmiTag) { 6190 if ((raw_value & kSmiTagMask) == kSmiTag) {
6163 return Smi::Class(); 6191 return Smi::Class();
6164 } 6192 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
6275 6303
6276 6304
6277 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6305 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6278 intptr_t index) { 6306 intptr_t index) {
6279 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6307 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6280 } 6308 }
6281 6309
6282 } // namespace dart 6310 } // namespace dart
6283 6311
6284 #endif // VM_OBJECT_H_ 6312 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « vm/isolate.cc ('k') | vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698