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

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