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

Side by Side Diff: runtime/vm/object.h

Issue 56033002: Compute next field offset correctly. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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
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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 if (value->IsNewObject() && raw()->IsOldObject() && 521 if (value->IsNewObject() && raw()->IsOldObject() &&
522 !raw()->IsRemembered()) { 522 !raw()->IsRemembered()) {
523 raw()->SetRememberedBit(); 523 raw()->SetRememberedBit();
524 Isolate::Current()->store_buffer()->AddObject(raw()); 524 Isolate::Current()->store_buffer()->AddObject(raw());
525 } 525 }
526 } 526 }
527 527
528 RawObject* raw_; // The raw object reference. 528 RawObject* raw_; // The raw object reference.
529 529
530 private: 530 private:
531 static intptr_t NextFieldOffset() {
532 // Indicates this class cannot be extended by dart code.
533 return -kWordSize;
534 }
535
531 static void InitializeObject(uword address, intptr_t id, intptr_t size); 536 static void InitializeObject(uword address, intptr_t id, intptr_t size);
532 537
533 static void RegisterClass(const Class& cls, 538 static void RegisterClass(const Class& cls,
534 const String& name, 539 const String& name,
535 const Library& lib); 540 const Library& lib);
536 static void RegisterPrivateClass(const Class& cls, 541 static void RegisterPrivateClass(const Class& cls,
537 const String& name, 542 const String& name,
538 const Library& lib); 543 const Library& lib);
539 544
540 /* Initialize the handle based on the raw_ptr in the presence of null. */ 545 /* Initialize the handle based on the raw_ptr in the presence of null. */
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 653 }
649 654
650 intptr_t next_field_offset() const { 655 intptr_t next_field_offset() const {
651 return raw_ptr()->next_field_offset_in_words_ * kWordSize; 656 return raw_ptr()->next_field_offset_in_words_ * kWordSize;
652 } 657 }
653 void set_next_field_offset(intptr_t value_in_bytes) const { 658 void set_next_field_offset(intptr_t value_in_bytes) const {
654 ASSERT(kWordSize != 0); 659 ASSERT(kWordSize != 0);
655 set_next_field_offset_in_words(value_in_bytes / kWordSize); 660 set_next_field_offset_in_words(value_in_bytes / kWordSize);
656 } 661 }
657 void set_next_field_offset_in_words(intptr_t value) const { 662 void set_next_field_offset_in_words(intptr_t value) const {
658 ASSERT((Utils::IsAligned((value * kWordSize), kObjectAlignment) && 663 ASSERT((value == -1) ||
664 (Utils::IsAligned((value * kWordSize), kObjectAlignment) &&
659 (value == raw_ptr()->instance_size_in_words_)) || 665 (value == raw_ptr()->instance_size_in_words_)) ||
660 (!Utils::IsAligned((value * kWordSize), kObjectAlignment) && 666 (!Utils::IsAligned((value * kWordSize), kObjectAlignment) &&
661 ((value + 1) == raw_ptr()->instance_size_in_words_))); 667 ((value + 1) == raw_ptr()->instance_size_in_words_)));
662 raw_ptr()->next_field_offset_in_words_ = value; 668 raw_ptr()->next_field_offset_in_words_ = value;
663 } 669 }
664 670
665 cpp_vtable handle_vtable() const { return raw_ptr()->handle_vtable_; } 671 cpp_vtable handle_vtable() const { return raw_ptr()->handle_vtable_; }
666 void set_handle_vtable(cpp_vtable value) const { 672 void set_handle_vtable(cpp_vtable value) const {
667 raw_ptr()->handle_vtable_ = value; 673 raw_ptr()->handle_vtable_ = value;
668 } 674 }
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 void set_constants(const Array& value) const; 1082 void set_constants(const Array& value) const;
1077 1083
1078 void set_canonical_types(const Array& value) const; 1084 void set_canonical_types(const Array& value) const;
1079 RawArray* canonical_types() const; 1085 RawArray* canonical_types() const;
1080 1086
1081 RawArray* invocation_dispatcher_cache() const; 1087 RawArray* invocation_dispatcher_cache() const;
1082 void set_invocation_dispatcher_cache(const Array& cache) const; 1088 void set_invocation_dispatcher_cache(const Array& cache) const;
1083 RawFunction* CreateInvocationDispatcher(const String& target_name, 1089 RawFunction* CreateInvocationDispatcher(const String& target_name,
1084 const Array& args_desc, 1090 const Array& args_desc,
1085 RawFunction::Kind kind) const; 1091 RawFunction::Kind kind) const;
1092
1093 static intptr_t NextFieldOffset() {
1094 // Indicates this class cannot be extended by dart code.
1095 return -kWordSize;
1096 }
1097
1086 void CalculateFieldOffsets() const; 1098 void CalculateFieldOffsets() const;
1087 1099
1088 // Initial value for the cached number of type arguments. 1100 // Initial value for the cached number of type arguments.
1089 static const intptr_t kUnknownNumTypeArguments = -1; 1101 static const intptr_t kUnknownNumTypeArguments = -1;
1090 1102
1091 int16_t num_type_arguments() const { 1103 int16_t num_type_arguments() const {
1092 return raw_ptr()->num_type_arguments_; 1104 return raw_ptr()->num_type_arguments_;
1093 } 1105 }
1094 void set_num_type_arguments(intptr_t value) const; 1106 void set_num_type_arguments(intptr_t value) const;
1095 1107
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 return raw_ptr()->library_prefix_; 1149 return raw_ptr()->library_prefix_;
1138 } 1150 }
1139 RawString* ident() const { return raw_ptr()->ident_; } 1151 RawString* ident() const { return raw_ptr()->ident_; }
1140 intptr_t token_pos() const { return raw_ptr()->token_pos_; } 1152 intptr_t token_pos() const { return raw_ptr()->token_pos_; }
1141 1153
1142 RawString* Name() const; 1154 RawString* Name() const;
1143 1155
1144 static intptr_t InstanceSize() { 1156 static intptr_t InstanceSize() {
1145 return RoundedAllocationSize(sizeof(RawUnresolvedClass)); 1157 return RoundedAllocationSize(sizeof(RawUnresolvedClass));
1146 } 1158 }
1159
1147 static RawUnresolvedClass* New(const LibraryPrefix& library_prefix, 1160 static RawUnresolvedClass* New(const LibraryPrefix& library_prefix,
1148 const String& ident, 1161 const String& ident,
1149 intptr_t token_pos); 1162 intptr_t token_pos);
1150 1163
1151 private: 1164 private:
1152 void set_library_prefix(const LibraryPrefix& library_prefix) const; 1165 void set_library_prefix(const LibraryPrefix& library_prefix) const;
1153 void set_ident(const String& ident) const; 1166 void set_ident(const String& ident) const;
1154 void set_token_pos(intptr_t token_pos) const; 1167 void set_token_pos(intptr_t token_pos) const;
1155 1168
1169 static intptr_t NextFieldOffset() {
Ivan Posva 2013/11/03 16:08:51 We should maybe roll this into FINAL_HEAP_OBJECT_I
siva 2013/11/04 16:05:01 Rolled it into FINAL_HEAP_OBJECT_IMPLEMENTATION an
1170 // Indicates this class cannot be extended by dart code.
1171 return -kWordSize;
1172 }
1173
1156 static RawUnresolvedClass* New(); 1174 static RawUnresolvedClass* New();
1157 1175
1158 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object); 1176 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object);
1159 friend class Class; 1177 friend class Class;
1160 }; 1178 };
1161 1179
1162 1180
1163 // AbstractTypeArguments is an abstract superclass. 1181 // AbstractTypeArguments is an abstract superclass.
1164 // Subclasses of AbstractTypeArguments are TypeArguments and 1182 // Subclasses of AbstractTypeArguments are TypeArguments and
1165 // InstantiatedTypeArguments. 1183 // InstantiatedTypeArguments.
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 return RoundedAllocationSize( 1333 return RoundedAllocationSize(
1316 sizeof(RawTypeArguments) + (len * kBytesPerElement)); 1334 sizeof(RawTypeArguments) + (len * kBytesPerElement));
1317 } 1335 }
1318 1336
1319 static RawTypeArguments* New(intptr_t len, Heap::Space space = Heap::kOld); 1337 static RawTypeArguments* New(intptr_t len, Heap::Space space = Heap::kOld);
1320 1338
1321 private: 1339 private:
1322 RawAbstractType** TypeAddr(intptr_t index) const; 1340 RawAbstractType** TypeAddr(intptr_t index) const;
1323 void SetLength(intptr_t value) const; 1341 void SetLength(intptr_t value) const;
1324 1342
1343 static intptr_t NextFieldOffset() {
1344 // Indicates this class cannot be extended by dart code.
1345 return -kWordSize;
1346 }
1347
1325 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeArguments, AbstractTypeArguments); 1348 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeArguments, AbstractTypeArguments);
1326 friend class Class; 1349 friend class Class;
1327 }; 1350 };
1328 1351
1329 1352
1330 // An instance of InstantiatedTypeArguments is never encountered at compile 1353 // An instance of InstantiatedTypeArguments is never encountered at compile
1331 // time, but only at run time, when type parameters can be matched to actual 1354 // time, but only at run time, when type parameters can be matched to actual
1332 // types. 1355 // types.
1333 // An instance of InstantiatedTypeArguments consists of a pair of 1356 // An instance of InstantiatedTypeArguments consists of a pair of
1334 // AbstractTypeArguments objects. The first type argument vector is 1357 // AbstractTypeArguments objects. The first type argument vector is
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 1400
1378 static RawInstantiatedTypeArguments* New( 1401 static RawInstantiatedTypeArguments* New(
1379 const AbstractTypeArguments& uninstantiated_type_arguments, 1402 const AbstractTypeArguments& uninstantiated_type_arguments,
1380 const AbstractTypeArguments& instantiator_type_arguments); 1403 const AbstractTypeArguments& instantiator_type_arguments);
1381 1404
1382 private: 1405 private:
1383 void set_uninstantiated_type_arguments( 1406 void set_uninstantiated_type_arguments(
1384 const AbstractTypeArguments& value) const; 1407 const AbstractTypeArguments& value) const;
1385 void set_instantiator_type_arguments( 1408 void set_instantiator_type_arguments(
1386 const AbstractTypeArguments& value) const; 1409 const AbstractTypeArguments& value) const;
1410
1411 static intptr_t NextFieldOffset() {
1412 // Indicates this class cannot be extended by dart code.
1413 return -kWordSize;
1414 }
1415
1387 static RawInstantiatedTypeArguments* New(); 1416 static RawInstantiatedTypeArguments* New();
1388 1417
1389 FINAL_HEAP_OBJECT_IMPLEMENTATION(InstantiatedTypeArguments, 1418 FINAL_HEAP_OBJECT_IMPLEMENTATION(InstantiatedTypeArguments,
1390 AbstractTypeArguments); 1419 AbstractTypeArguments);
1391 friend class Class; 1420 friend class Class;
1392 }; 1421 };
1393 1422
1394 1423
1395 class PatchClass : public Object { 1424 class PatchClass : public Object {
1396 public: 1425 public:
1397 RawClass* patched_class() const { return raw_ptr()->patched_class_; } 1426 RawClass* patched_class() const { return raw_ptr()->patched_class_; }
1398 RawClass* source_class() const { return raw_ptr()->source_class_; } 1427 RawClass* source_class() const { return raw_ptr()->source_class_; }
1399 RawScript* Script() const; 1428 RawScript* Script() const;
1400 1429
1401 static intptr_t InstanceSize() { 1430 static intptr_t InstanceSize() {
1402 return RoundedAllocationSize(sizeof(RawPatchClass)); 1431 return RoundedAllocationSize(sizeof(RawPatchClass));
1403 } 1432 }
1404 1433
1405 static RawPatchClass* New(const Class& patched_class, 1434 static RawPatchClass* New(const Class& patched_class,
1406 const Class& source_class); 1435 const Class& source_class);
1407 1436
1408 private: 1437 private:
1409 void set_patched_class(const Class& value) const; 1438 void set_patched_class(const Class& value) const;
1410 void set_source_class(const Class& value) const; 1439 void set_source_class(const Class& value) const;
1440
1441 static intptr_t NextFieldOffset() {
1442 // Indicates this class cannot be extended by dart code.
1443 return -kWordSize;
1444 }
1445
1411 static RawPatchClass* New(); 1446 static RawPatchClass* New();
1412 1447
1413 FINAL_HEAP_OBJECT_IMPLEMENTATION(PatchClass, Object); 1448 FINAL_HEAP_OBJECT_IMPLEMENTATION(PatchClass, Object);
1414 friend class Class; 1449 friend class Class;
1415 }; 1450 };
1416 1451
1417 1452
1418 class Function : public Object { 1453 class Function : public Object {
1419 public: 1454 public:
1420 RawString* name() const { return raw_ptr()->name_; } 1455 RawString* name() const { return raw_ptr()->name_; }
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 // Returns true if this function represents a local function. 1884 // Returns true if this function represents a local function.
1850 bool IsLocalFunction() const { 1885 bool IsLocalFunction() const {
1851 return parent_function() != Function::null(); 1886 return parent_function() != Function::null();
1852 } 1887 }
1853 1888
1854 // Returns true if this function represents a signature function without code. 1889 // Returns true if this function represents a signature function without code.
1855 bool IsSignatureFunction() const { 1890 bool IsSignatureFunction() const {
1856 return kind() == RawFunction::kSignatureFunction; 1891 return kind() == RawFunction::kSignatureFunction;
1857 } 1892 }
1858 1893
1859
1860 static intptr_t InstanceSize() { 1894 static intptr_t InstanceSize() {
1861 return RoundedAllocationSize(sizeof(RawFunction)); 1895 return RoundedAllocationSize(sizeof(RawFunction));
1862 } 1896 }
1863 1897
1864 static RawFunction* New(const String& name, 1898 static RawFunction* New(const String& name,
1865 RawFunction::Kind kind, 1899 RawFunction::Kind kind,
1866 bool is_static, 1900 bool is_static,
1867 bool is_const, 1901 bool is_const,
1868 bool is_abstract, 1902 bool is_abstract,
1869 bool is_external, 1903 bool is_external,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 void set_is_external(bool value) const; 1973 void set_is_external(bool value) const;
1940 void set_parent_function(const Function& value) const; 1974 void set_parent_function(const Function& value) const;
1941 void set_owner(const Object& value) const; 1975 void set_owner(const Object& value) const;
1942 RawFunction* implicit_closure_function() const; 1976 RawFunction* implicit_closure_function() const;
1943 void set_implicit_closure_function(const Function& value) const; 1977 void set_implicit_closure_function(const Function& value) const;
1944 RawInstance* implicit_static_closure() const; 1978 RawInstance* implicit_static_closure() const;
1945 void set_implicit_static_closure(const Instance& closure) const; 1979 void set_implicit_static_closure(const Instance& closure) const;
1946 void set_num_optional_parameters(intptr_t value) const; // Encoded value. 1980 void set_num_optional_parameters(intptr_t value) const; // Encoded value.
1947 void set_kind_tag(intptr_t value) const; 1981 void set_kind_tag(intptr_t value) const;
1948 void set_data(const Object& value) const; 1982 void set_data(const Object& value) const;
1983
1984 static intptr_t NextFieldOffset() {
1985 // Indicates this class cannot be extended by dart code.
1986 return -kWordSize;
1987 }
1988
1949 static RawFunction* New(); 1989 static RawFunction* New();
1950 1990
1951 void BuildSignatureParameters(bool instantiate, 1991 void BuildSignatureParameters(bool instantiate,
1952 NameVisibility name_visibility, 1992 NameVisibility name_visibility,
1953 const AbstractTypeArguments& instantiator, 1993 const AbstractTypeArguments& instantiator,
1954 const GrowableObjectArray& pieces) const; 1994 const GrowableObjectArray& pieces) const;
1955 RawString* BuildSignature(bool instantiate, 1995 RawString* BuildSignature(bool instantiate,
1956 NameVisibility name_visibility, 1996 NameVisibility name_visibility,
1957 const AbstractTypeArguments& instantiator) const; 1997 const AbstractTypeArguments& instantiator) const;
1958 1998
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2000 RawInstance* implicit_static_closure() const { 2040 RawInstance* implicit_static_closure() const {
2001 return raw_ptr()->closure_; 2041 return raw_ptr()->closure_;
2002 } 2042 }
2003 void set_implicit_static_closure(const Instance& closure) const; 2043 void set_implicit_static_closure(const Instance& closure) const;
2004 2044
2005 RawCode* closure_allocation_stub() const { 2045 RawCode* closure_allocation_stub() const {
2006 return raw_ptr()->closure_allocation_stub_; 2046 return raw_ptr()->closure_allocation_stub_;
2007 } 2047 }
2008 void set_closure_allocation_stub(const Code& value) const; 2048 void set_closure_allocation_stub(const Code& value) const;
2009 2049
2050 static intptr_t NextFieldOffset() {
2051 // Indicates this class cannot be extended by dart code.
2052 return -kWordSize;
2053 }
2054
2010 static RawClosureData* New(); 2055 static RawClosureData* New();
2011 2056
2012 FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object); 2057 FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object);
2013 friend class Class; 2058 friend class Class;
2014 friend class Function; 2059 friend class Function;
2015 friend class HeapProfiler; 2060 friend class HeapProfiler;
2016 }; 2061 };
2017 2062
2018 2063
2019 class RedirectionData: public Object { 2064 class RedirectionData: public Object {
2020 public: 2065 public:
2021 static intptr_t InstanceSize() { 2066 static intptr_t InstanceSize() {
2022 return RoundedAllocationSize(sizeof(RawRedirectionData)); 2067 return RoundedAllocationSize(sizeof(RawRedirectionData));
2023 } 2068 }
2024 2069
2025 private: 2070 private:
2026 // The type specifies the class and type arguments of the target constructor. 2071 // The type specifies the class and type arguments of the target constructor.
2027 RawType* type() const { return raw_ptr()->type_; } 2072 RawType* type() const { return raw_ptr()->type_; }
2028 void set_type(const Type& value) const; 2073 void set_type(const Type& value) const;
2029 2074
2030 // The optional identifier specifies a named constructor. 2075 // The optional identifier specifies a named constructor.
2031 RawString* identifier() const { return raw_ptr()->identifier_; } 2076 RawString* identifier() const { return raw_ptr()->identifier_; }
2032 void set_identifier(const String& value) const; 2077 void set_identifier(const String& value) const;
2033 2078
2034 // The resolved constructor or factory target of the redirection. 2079 // The resolved constructor or factory target of the redirection.
2035 RawFunction* target() const { return raw_ptr()->target_; } 2080 RawFunction* target() const { return raw_ptr()->target_; }
2036 void set_target(const Function& value) const; 2081 void set_target(const Function& value) const;
2037 2082
2083 static intptr_t NextFieldOffset() {
2084 // Indicates this class cannot be extended by dart code.
2085 return -kWordSize;
2086 }
2087
2038 static RawRedirectionData* New(); 2088 static RawRedirectionData* New();
2039 2089
2040 FINAL_HEAP_OBJECT_IMPLEMENTATION(RedirectionData, Object); 2090 FINAL_HEAP_OBJECT_IMPLEMENTATION(RedirectionData, Object);
2041 friend class Class; 2091 friend class Class;
2042 friend class Function; 2092 friend class Function;
2043 friend class HeapProfiler; 2093 friend class HeapProfiler;
2044 }; 2094 };
2045 2095
2046 2096
2047 class Field : public Object { 2097 class Field : public Object {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2205 } 2255 }
2206 void set_owner(const Object& value) const { 2256 void set_owner(const Object& value) const {
2207 StorePointer(&raw_ptr()->owner_, value.raw()); 2257 StorePointer(&raw_ptr()->owner_, value.raw());
2208 } 2258 }
2209 void set_token_pos(intptr_t token_pos) const { 2259 void set_token_pos(intptr_t token_pos) const {
2210 raw_ptr()->token_pos_ = token_pos; 2260 raw_ptr()->token_pos_ = token_pos;
2211 } 2261 }
2212 void set_kind_bits(intptr_t value) const { 2262 void set_kind_bits(intptr_t value) const {
2213 raw_ptr()->kind_bits_ = static_cast<uint8_t>(value); 2263 raw_ptr()->kind_bits_ = static_cast<uint8_t>(value);
2214 } 2264 }
2265
2266 static intptr_t NextFieldOffset() {
2267 // Indicates this class cannot be extended by dart code.
2268 return -kWordSize;
2269 }
2270
2215 static RawField* New(); 2271 static RawField* New();
2216 2272
2217 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object); 2273 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object);
2218 friend class Class; 2274 friend class Class;
2219 friend class HeapProfiler; 2275 friend class HeapProfiler;
2220 }; 2276 };
2221 2277
2222 2278
2223 class LiteralToken : public Object { 2279 class LiteralToken : public Object {
2224 public: 2280 public:
2225 Token::Kind kind() const { return raw_ptr()->kind_; } 2281 Token::Kind kind() const { return raw_ptr()->kind_; }
2226 RawString* literal() const { return raw_ptr()->literal_; } 2282 RawString* literal() const { return raw_ptr()->literal_; }
2227 RawObject* value() const { return raw_ptr()->value_; } 2283 RawObject* value() const { return raw_ptr()->value_; }
2228 2284
2229 static intptr_t InstanceSize() { 2285 static intptr_t InstanceSize() {
2230 return RoundedAllocationSize(sizeof(RawLiteralToken)); 2286 return RoundedAllocationSize(sizeof(RawLiteralToken));
2231 } 2287 }
2232 2288
2233 static RawLiteralToken* New(); 2289 static RawLiteralToken* New();
2234 static RawLiteralToken* New(Token::Kind kind, const String& literal); 2290 static RawLiteralToken* New(Token::Kind kind, const String& literal);
2235 2291
2236 private: 2292 private:
2237 void set_kind(Token::Kind kind) const { raw_ptr()->kind_ = kind; } 2293 void set_kind(Token::Kind kind) const { raw_ptr()->kind_ = kind; }
2238 void set_literal(const String& literal) const; 2294 void set_literal(const String& literal) const;
2239 void set_value(const Object& value) const; 2295 void set_value(const Object& value) const;
2240 2296
2297 static intptr_t NextFieldOffset() {
2298 // Indicates this class cannot be extended by dart code.
2299 return -kWordSize;
2300 }
2301
2241 FINAL_HEAP_OBJECT_IMPLEMENTATION(LiteralToken, Object); 2302 FINAL_HEAP_OBJECT_IMPLEMENTATION(LiteralToken, Object);
2242 friend class Class; 2303 friend class Class;
2243 }; 2304 };
2244 2305
2245 2306
2246 class TokenStream : public Object { 2307 class TokenStream : public Object {
2247 public: 2308 public:
2248 RawArray* TokenObjects() const; 2309 RawArray* TokenObjects() const;
2249 void SetTokenObjects(const Array& value) const; 2310 void SetTokenObjects(const Array& value) const;
2250 2311
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 Object& obj_; 2375 Object& obj_;
2315 intptr_t cur_token_pos_; 2376 intptr_t cur_token_pos_;
2316 Token::Kind cur_token_kind_; 2377 Token::Kind cur_token_kind_;
2317 intptr_t cur_token_obj_index_; 2378 intptr_t cur_token_obj_index_;
2318 Iterator::StreamType stream_type_; 2379 Iterator::StreamType stream_type_;
2319 }; 2380 };
2320 2381
2321 private: 2382 private:
2322 void SetPrivateKey(const String& value) const; 2383 void SetPrivateKey(const String& value) const;
2323 2384
2385 static intptr_t NextFieldOffset() {
2386 // Indicates this class cannot be extended by dart code.
2387 return -kWordSize;
2388 }
2389
2324 static RawTokenStream* New(); 2390 static RawTokenStream* New();
2325 static void DataFinalizer(Dart_WeakPersistentHandle handle, void *peer); 2391 static void DataFinalizer(Dart_WeakPersistentHandle handle, void *peer);
2326 2392
2327 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); 2393 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object);
2328 friend class Class; 2394 friend class Class;
2329 }; 2395 };
2330 2396
2331 2397
2332 class Script : public Object { 2398 class Script : public Object {
2333 public: 2399 public:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 2437
2372 static RawScript* New(const String& url, 2438 static RawScript* New(const String& url,
2373 const String& source, 2439 const String& source,
2374 RawScript::Kind kind); 2440 RawScript::Kind kind);
2375 2441
2376 private: 2442 private:
2377 void set_url(const String& value) const; 2443 void set_url(const String& value) const;
2378 void set_source(const String& value) const; 2444 void set_source(const String& value) const;
2379 void set_kind(RawScript::Kind value) const; 2445 void set_kind(RawScript::Kind value) const;
2380 void set_tokens(const TokenStream& value) const; 2446 void set_tokens(const TokenStream& value) const;
2447
2448 static intptr_t NextFieldOffset() {
2449 // Indicates this class cannot be extended by dart code.
2450 return -kWordSize;
2451 }
2452
2381 static RawScript* New(); 2453 static RawScript* New();
2382 2454
2383 FINAL_HEAP_OBJECT_IMPLEMENTATION(Script, Object); 2455 FINAL_HEAP_OBJECT_IMPLEMENTATION(Script, Object);
2384 friend class Class; 2456 friend class Class;
2385 }; 2457 };
2386 2458
2387 2459
2388 class DictionaryIterator : public ValueObject { 2460 class DictionaryIterator : public ValueObject {
2389 public: 2461 public:
2390 explicit DictionaryIterator(const Library& library); 2462 explicit DictionaryIterator(const Library& library);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 2657
2586 2658
2587 // Return Function::null() if function does not exist in libs. 2659 // Return Function::null() if function does not exist in libs.
2588 static RawFunction* GetFunction(const GrowableArray<Library*>& libs, 2660 static RawFunction* GetFunction(const GrowableArray<Library*>& libs,
2589 const char* class_name, 2661 const char* class_name,
2590 const char* function_name); 2662 const char* function_name);
2591 2663
2592 private: 2664 private:
2593 static const int kInitialImportsCapacity = 4; 2665 static const int kInitialImportsCapacity = 4;
2594 static const int kImportsCapacityIncrement = 8; 2666 static const int kImportsCapacityIncrement = 8;
2667
2668 static intptr_t NextFieldOffset() {
2669 // Indicates this class cannot be extended by dart code.
2670 return -kWordSize;
2671 }
2672
2595 static RawLibrary* New(); 2673 static RawLibrary* New();
2596 2674
2597 void set_num_imports(intptr_t value) const { 2675 void set_num_imports(intptr_t value) const {
2598 raw_ptr()->num_imports_ = value; 2676 raw_ptr()->num_imports_ = value;
2599 } 2677 }
2600 RawArray* imports() const { return raw_ptr()->imports_; } 2678 RawArray* imports() const { return raw_ptr()->imports_; }
2601 RawArray* exports() const { return raw_ptr()->exports_; } 2679 RawArray* exports() const { return raw_ptr()->exports_; }
2602 bool HasExports() const; 2680 bool HasExports() const;
2603 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } 2681 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; }
2604 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } 2682 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2647 2725
2648 static RawLibraryPrefix* New(const String& name, const Namespace& import); 2726 static RawLibraryPrefix* New(const String& name, const Namespace& import);
2649 2727
2650 private: 2728 private:
2651 static const int kInitialSize = 2; 2729 static const int kInitialSize = 2;
2652 static const int kIncrementSize = 2; 2730 static const int kIncrementSize = 2;
2653 2731
2654 void set_name(const String& value) const; 2732 void set_name(const String& value) const;
2655 void set_imports(const Array& value) const; 2733 void set_imports(const Array& value) const;
2656 void set_num_imports(intptr_t value) const; 2734 void set_num_imports(intptr_t value) const;
2735
2736 static intptr_t NextFieldOffset() {
2737 // Indicates this class cannot be extended by dart code.
2738 return -kWordSize;
2739 }
2740
2657 static RawLibraryPrefix* New(); 2741 static RawLibraryPrefix* New();
2658 2742
2659 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); 2743 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object);
2660 friend class Class; 2744 friend class Class;
2661 }; 2745 };
2662 2746
2663 2747
2664 // A Namespace contains the names in a library dictionary, filtered by 2748 // A Namespace contains the names in a library dictionary, filtered by
2665 // the show/hide combinators. 2749 // the show/hide combinators.
2666 class Namespace : public Object { 2750 class Namespace : public Object {
2667 public: 2751 public:
2668 RawLibrary* library() const { return raw_ptr()->library_; } 2752 RawLibrary* library() const { return raw_ptr()->library_; }
2669 RawArray* show_names() const { return raw_ptr()->show_names_; } 2753 RawArray* show_names() const { return raw_ptr()->show_names_; }
2670 RawArray* hide_names() const { return raw_ptr()->hide_names_; } 2754 RawArray* hide_names() const { return raw_ptr()->hide_names_; }
2671 2755
2672 static intptr_t InstanceSize() { 2756 static intptr_t InstanceSize() {
2673 return RoundedAllocationSize(sizeof(RawNamespace)); 2757 return RoundedAllocationSize(sizeof(RawNamespace));
2674 } 2758 }
2675 2759
2676 bool HidesName(const String& name) const; 2760 bool HidesName(const String& name) const;
2677 RawObject* Lookup(const String& name) const; 2761 RawObject* Lookup(const String& name) const;
2678 2762
2679 static RawNamespace* New(const Library& library, 2763 static RawNamespace* New(const Library& library,
2680 const Array& show_names, 2764 const Array& show_names,
2681 const Array& hide_names); 2765 const Array& hide_names);
2766
2682 private: 2767 private:
2768 static intptr_t NextFieldOffset() {
2769 // Indicates this class cannot be extended by dart code.
2770 return -kWordSize;
2771 }
2772
2683 static RawNamespace* New(); 2773 static RawNamespace* New();
2684 2774
2685 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); 2775 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object);
2686 friend class Class; 2776 friend class Class;
2687 }; 2777 };
2688 2778
2689 2779
2690 class Instructions : public Object { 2780 class Instructions : public Object {
2691 public: 2781 public:
2692 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). 2782 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize().
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 void set_size(intptr_t size) const { 2825 void set_size(intptr_t size) const {
2736 raw_ptr()->size_ = size; 2826 raw_ptr()->size_ = size;
2737 } 2827 }
2738 void set_code(RawCode* code) const { 2828 void set_code(RawCode* code) const {
2739 raw_ptr()->code_ = code; 2829 raw_ptr()->code_ = code;
2740 } 2830 }
2741 void set_object_pool(RawArray* object_pool) const { 2831 void set_object_pool(RawArray* object_pool) const {
2742 StorePointer(&raw_ptr()->object_pool_, object_pool); 2832 StorePointer(&raw_ptr()->object_pool_, object_pool);
2743 } 2833 }
2744 2834
2835 static intptr_t NextFieldOffset() {
2836 // Indicates this class cannot be extended by dart code.
2837 return -kWordSize;
2838 }
2839
2745 // New is a private method as RawInstruction and RawCode objects should 2840 // New is a private method as RawInstruction and RawCode objects should
2746 // only be created using the Code::FinalizeCode method. This method creates 2841 // only be created using the Code::FinalizeCode method. This method creates
2747 // the RawInstruction and RawCode objects, sets up the pointer offsets 2842 // the RawInstruction and RawCode objects, sets up the pointer offsets
2748 // and links the two in a GC safe manner. 2843 // and links the two in a GC safe manner.
2749 static RawInstructions* New(intptr_t size); 2844 static RawInstructions* New(intptr_t size);
2750 2845
2751 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object); 2846 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object);
2752 friend class Class; 2847 friend class Class;
2753 friend class Code; 2848 friend class Code;
2754 }; 2849 };
(...skipping 22 matching lines...) Expand all
2777 } 2872 }
2778 static intptr_t InstanceSize(intptr_t len) { 2873 static intptr_t InstanceSize(intptr_t len) {
2779 ASSERT(0 <= len && len <= kMaxElements); 2874 ASSERT(0 <= len && len <= kMaxElements);
2780 return RoundedAllocationSize( 2875 return RoundedAllocationSize(
2781 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); 2876 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement));
2782 } 2877 }
2783 2878
2784 static RawLocalVarDescriptors* New(intptr_t num_variables); 2879 static RawLocalVarDescriptors* New(intptr_t num_variables);
2785 2880
2786 private: 2881 private:
2882 static intptr_t NextFieldOffset() {
2883 // Indicates this class cannot be extended by dart code.
2884 return -kWordSize;
2885 }
2886
2787 FINAL_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object); 2887 FINAL_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object);
2788 friend class Class; 2888 friend class Class;
2789 }; 2889 };
2790 2890
2791 2891
2792 class PcDescriptors : public Object { 2892 class PcDescriptors : public Object {
2793 private: 2893 private:
2794 // Describes the layout of PC descriptor data. 2894 // Describes the layout of PC descriptor data.
2795 enum { 2895 enum {
2796 kPcEntry = 0, // PC value of the descriptor, unique. 2896 kPcEntry = 0, // PC value of the descriptor, unique.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
2878 2978
2879 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { 2979 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const {
2880 ASSERT((index >=0) && (index < Length())); 2980 ASSERT((index >=0) && (index < Length()));
2881 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; 2981 intptr_t data_index = (index * kNumberOfEntries) + entry_offset;
2882 return &raw_ptr()->data_[data_index]; 2982 return &raw_ptr()->data_[data_index];
2883 } 2983 }
2884 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const { 2984 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const {
2885 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset)); 2985 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset));
2886 } 2986 }
2887 2987
2988 static intptr_t NextFieldOffset() {
2989 // Indicates this class cannot be extended by dart code.
2990 return -kWordSize;
2991 }
2992
2888 FINAL_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); 2993 FINAL_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object);
2889 friend class Class; 2994 friend class Class;
2890 }; 2995 };
2891 2996
2892 2997
2893 class Stackmap : public Object { 2998 class Stackmap : public Object {
2894 public: 2999 public:
2895 static const intptr_t kNoMaximum = -1; 3000 static const intptr_t kNoMaximum = -1;
2896 static const intptr_t kNoMinimum = -1; 3001 static const intptr_t kNoMinimum = -1;
2897 3002
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2931 intptr_t register_bit_count); 3036 intptr_t register_bit_count);
2932 3037
2933 private: 3038 private:
2934 void SetLength(intptr_t length) const { raw_ptr()->length_ = length; } 3039 void SetLength(intptr_t length) const { raw_ptr()->length_ = length; }
2935 3040
2936 bool InRange(intptr_t index) const { return index < Length(); } 3041 bool InRange(intptr_t index) const { return index < Length(); }
2937 3042
2938 bool GetBit(intptr_t bit_index) const; 3043 bool GetBit(intptr_t bit_index) const;
2939 void SetBit(intptr_t bit_index, bool value) const; 3044 void SetBit(intptr_t bit_index, bool value) const;
2940 3045
3046 static intptr_t NextFieldOffset() {
3047 // Indicates this class cannot be extended by dart code.
3048 return -kWordSize;
3049 }
3050
2941 FINAL_HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); 3051 FINAL_HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object);
2942 friend class BitmapBuilder; 3052 friend class BitmapBuilder;
2943 friend class Class; 3053 friend class Class;
2944 }; 3054 };
2945 3055
2946 3056
2947 class ExceptionHandlers : public Object { 3057 class ExceptionHandlers : public Object {
2948 public: 3058 public:
2949 intptr_t Length() const; 3059 intptr_t Length() const;
2950 3060
(...skipping 30 matching lines...) Expand all
2981 // We would have a VisitPointers function here to traverse the 3091 // We would have a VisitPointers function here to traverse the
2982 // exception handler table to visit objects if any in the table. 3092 // exception handler table to visit objects if any in the table.
2983 3093
2984 private: 3094 private:
2985 // Pick somewhat arbitrary maximum number of exception handlers 3095 // Pick somewhat arbitrary maximum number of exception handlers
2986 // for a function. This value is used to catch potentially 3096 // for a function. This value is used to catch potentially
2987 // malicious code. 3097 // malicious code.
2988 static const intptr_t kMaxHandlers = 1024 * 1024; 3098 static const intptr_t kMaxHandlers = 1024 * 1024;
2989 3099
2990 void set_handled_types_data(const Array& value) const; 3100 void set_handled_types_data(const Array& value) const;
3101
3102 static intptr_t NextFieldOffset() {
3103 // Indicates this class cannot be extended by dart code.
3104 return -kWordSize;
3105 }
3106
2991 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object); 3107 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object);
2992 friend class Class; 3108 friend class Class;
2993 }; 3109 };
2994 3110
2995 3111
2996 // Holds deopt information at one deoptimization point. The information consists 3112 // Holds deopt information at one deoptimization point. The information consists
2997 // of two parts: 3113 // of two parts:
2998 // - first a prefix consiting of kMaterializeObject instructions describing 3114 // - first a prefix consiting of kMaterializeObject instructions describing
2999 // objects which had their allocation removed as part of AllocationSinking 3115 // objects which had their allocation removed as part of AllocationSinking
3000 // pass and have to be materialized; 3116 // pass and have to be materialized;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
3066 3182
3067 private: 3183 private:
3068 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { 3184 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const {
3069 ASSERT((index >=0) && (index < Length())); 3185 ASSERT((index >=0) && (index < Length()));
3070 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; 3186 intptr_t data_index = (index * kNumberOfEntries) + entry_offset;
3071 return &raw_ptr()->data_[data_index]; 3187 return &raw_ptr()->data_[data_index];
3072 } 3188 }
3073 3189
3074 void SetLength(intptr_t value) const; 3190 void SetLength(intptr_t value) const;
3075 3191
3192 static intptr_t NextFieldOffset() {
3193 // Indicates this class cannot be extended by dart code.
3194 return -kWordSize;
3195 }
3196
3076 FINAL_HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object); 3197 FINAL_HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object);
3077 friend class Class; 3198 friend class Class;
3078 }; 3199 };
3079 3200
3080 3201
3081 class Code : public Object { 3202 class Code : public Object {
3082 public: 3203 public:
3083 RawInstructions* instructions() const { return raw_ptr()->instructions_; } 3204 RawInstructions* instructions() const { return raw_ptr()->instructions_; }
3084 static intptr_t instructions_offset() { 3205 static intptr_t instructions_offset() {
3085 return OFFSET_OF(RawCode, instructions_); 3206 return OFFSET_OF(RawCode, instructions_);
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
3312 ASSERT(index < pointer_offsets_length()); 3433 ASSERT(index < pointer_offsets_length());
3313 // TODO(iposva): Unit test is missing for this functionality. 3434 // TODO(iposva): Unit test is missing for this functionality.
3314 return &raw_ptr()->data_[index]; 3435 return &raw_ptr()->data_[index];
3315 } 3436 }
3316 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { 3437 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) {
3317 *PointerOffsetAddrAt(index) = offset_in_instructions; 3438 *PointerOffsetAddrAt(index) = offset_in_instructions;
3318 } 3439 }
3319 3440
3320 intptr_t BinarySearchInSCallTable(uword pc) const; 3441 intptr_t BinarySearchInSCallTable(uword pc) const;
3321 3442
3443 static intptr_t NextFieldOffset() {
3444 // Indicates this class cannot be extended by dart code.
3445 return -kWordSize;
3446 }
3447
3322 // New is a private method as RawInstruction and RawCode objects should 3448 // New is a private method as RawInstruction and RawCode objects should
3323 // only be created using the Code::FinalizeCode method. This method creates 3449 // only be created using the Code::FinalizeCode method. This method creates
3324 // the RawInstruction and RawCode objects, sets up the pointer offsets 3450 // the RawInstruction and RawCode objects, sets up the pointer offsets
3325 // and links the two in a GC safe manner. 3451 // and links the two in a GC safe manner.
3326 static RawCode* New(intptr_t pointer_offsets_length); 3452 static RawCode* New(intptr_t pointer_offsets_length);
3327 3453
3328 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object); 3454 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object);
3329 friend class Class; 3455 friend class Class;
3330 }; 3456 };
3331 3457
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
3379 } 3505 }
3380 3506
3381 void set_isolate(Isolate* isolate) const { 3507 void set_isolate(Isolate* isolate) const {
3382 raw_ptr()->isolate_ = isolate; 3508 raw_ptr()->isolate_ = isolate;
3383 } 3509 }
3384 3510
3385 void set_num_variables(intptr_t num_variables) const { 3511 void set_num_variables(intptr_t num_variables) const {
3386 raw_ptr()->num_variables_ = num_variables; 3512 raw_ptr()->num_variables_ = num_variables;
3387 } 3513 }
3388 3514
3515 static intptr_t NextFieldOffset() {
3516 // Indicates this class cannot be extended by dart code.
3517 return -kWordSize;
3518 }
3519
3389 FINAL_HEAP_OBJECT_IMPLEMENTATION(Context, Object); 3520 FINAL_HEAP_OBJECT_IMPLEMENTATION(Context, Object);
3390 friend class Class; 3521 friend class Class;
3391 }; 3522 };
3392 3523
3393 3524
3394 // The ContextScope class makes it possible to delay the compilation of a local 3525 // The ContextScope class makes it possible to delay the compilation of a local
3395 // function until it is invoked. A ContextScope instance collects the local 3526 // function until it is invoked. A ContextScope instance collects the local
3396 // variables that are referenced by the local function to be compiled and that 3527 // variables that are referenced by the local function to be compiled and that
3397 // belong to the outer scopes, that is, to the local scopes of (possibly nested) 3528 // belong to the outer scopes, that is, to the local scopes of (possibly nested)
3398 // functions enclosing the local function. Each captured variable is represented 3529 // functions enclosing the local function. Each captured variable is represented
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3451 } 3582 }
3452 3583
3453 RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const { 3584 RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const {
3454 ASSERT((index >= 0) && (index < num_variables())); 3585 ASSERT((index >= 0) && (index < num_variables()));
3455 uword raw_addr = reinterpret_cast<uword>(raw_ptr()); 3586 uword raw_addr = reinterpret_cast<uword>(raw_ptr());
3456 raw_addr += sizeof(RawContextScope) + 3587 raw_addr += sizeof(RawContextScope) +
3457 (index * sizeof(RawContextScope::VariableDesc)); 3588 (index * sizeof(RawContextScope::VariableDesc));
3458 return reinterpret_cast<RawContextScope::VariableDesc*>(raw_addr); 3589 return reinterpret_cast<RawContextScope::VariableDesc*>(raw_addr);
3459 } 3590 }
3460 3591
3592 static intptr_t NextFieldOffset() {
3593 // Indicates this class cannot be extended by dart code.
3594 return -kWordSize;
3595 }
3596
3461 FINAL_HEAP_OBJECT_IMPLEMENTATION(ContextScope, Object); 3597 FINAL_HEAP_OBJECT_IMPLEMENTATION(ContextScope, Object);
3462 friend class Class; 3598 friend class Class;
3463 }; 3599 };
3464 3600
3465 3601
3466 // Object holding information about an IC: test classes and their 3602 // Object holding information about an IC: test classes and their
3467 // corresponding targets. 3603 // corresponding targets.
3468 class ICData : public Object { 3604 class ICData : public Object {
3469 public: 3605 public:
3470 RawFunction* function() const { 3606 RawFunction* function() const {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3608 void set_ic_data(const Array& value) const; 3744 void set_ic_data(const Array& value) const;
3609 3745
3610 #if defined(DEBUG) 3746 #if defined(DEBUG)
3611 // Used in asserts to verify that a check is not added twice. 3747 // Used in asserts to verify that a check is not added twice.
3612 bool HasCheck(const GrowableArray<intptr_t>& cids) const; 3748 bool HasCheck(const GrowableArray<intptr_t>& cids) const;
3613 #endif // DEBUG 3749 #endif // DEBUG
3614 3750
3615 intptr_t TestEntryLength() const; 3751 intptr_t TestEntryLength() const;
3616 void WriteSentinel(const Array& data) const; 3752 void WriteSentinel(const Array& data) const;
3617 3753
3754 static intptr_t NextFieldOffset() {
3755 // Indicates this class cannot be extended by dart code.
3756 return -kWordSize;
3757 }
3758
3618 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object); 3759 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object);
3619 friend class Class; 3760 friend class Class;
3620 }; 3761 };
3621 3762
3622 3763
3623 class MegamorphicCache : public Object { 3764 class MegamorphicCache : public Object {
3624 public: 3765 public:
3625 static const int kInitialCapacity = 16; 3766 static const int kInitialCapacity = 16;
3626 static const double kLoadFactor; 3767 static const double kLoadFactor;
3627 3768
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3662 3803
3663 static inline void SetEntry(const Array& array, 3804 static inline void SetEntry(const Array& array,
3664 intptr_t index, 3805 intptr_t index,
3665 const Smi& class_id, 3806 const Smi& class_id,
3666 const Function& target); 3807 const Function& target);
3667 3808
3668 static inline RawObject* GetClassId(const Array& array, intptr_t index); 3809 static inline RawObject* GetClassId(const Array& array, intptr_t index);
3669 static inline RawObject* GetTargetFunction(const Array& array, 3810 static inline RawObject* GetTargetFunction(const Array& array,
3670 intptr_t index); 3811 intptr_t index);
3671 3812
3813 static intptr_t NextFieldOffset() {
3814 // Indicates this class cannot be extended by dart code.
3815 return -kWordSize;
3816 }
3817
3672 FINAL_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache, Object); 3818 FINAL_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache, Object);
3673 }; 3819 };
3674 3820
3675 3821
3676 class SubtypeTestCache : public Object { 3822 class SubtypeTestCache : public Object {
3677 public: 3823 public:
3678 enum Entries { 3824 enum Entries {
3679 kInstanceClassId = 0, 3825 kInstanceClassId = 0,
3680 kInstanceTypeArguments = 1, 3826 kInstanceTypeArguments = 1,
3681 kInstantiatorTypeArguments = 2, 3827 kInstantiatorTypeArguments = 2,
(...skipping 24 matching lines...) Expand all
3706 3852
3707 private: 3853 private:
3708 RawArray* cache() const { 3854 RawArray* cache() const {
3709 return raw_ptr()->cache_; 3855 return raw_ptr()->cache_;
3710 } 3856 }
3711 3857
3712 void set_cache(const Array& value) const; 3858 void set_cache(const Array& value) const;
3713 3859
3714 intptr_t TestEntryLength() const; 3860 intptr_t TestEntryLength() const;
3715 3861
3862 static intptr_t NextFieldOffset() {
3863 // Indicates this class cannot be extended by dart code.
3864 return -kWordSize;
3865 }
3866
3716 FINAL_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache, Object); 3867 FINAL_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache, Object);
3717 friend class Class; 3868 friend class Class;
3718 }; 3869 };
3719 3870
3720 3871
3721 class Error : public Object { 3872 class Error : public Object {
3722 public: 3873 public:
3723 virtual const char* ToErrorCString() const; 3874 virtual const char* ToErrorCString() const;
3724 3875
3725 private: 3876 private:
(...skipping 12 matching lines...) Expand all
3738 return RoundedAllocationSize(sizeof(RawApiError)); 3889 return RoundedAllocationSize(sizeof(RawApiError));
3739 } 3890 }
3740 3891
3741 static RawApiError* New(const String& message, 3892 static RawApiError* New(const String& message,
3742 Heap::Space space = Heap::kNew); 3893 Heap::Space space = Heap::kNew);
3743 3894
3744 virtual const char* ToErrorCString() const; 3895 virtual const char* ToErrorCString() const;
3745 3896
3746 private: 3897 private:
3747 void set_message(const String& message) const; 3898 void set_message(const String& message) const;
3899
3900 static intptr_t NextFieldOffset() {
3901 // Indicates this class cannot be extended by dart code.
3902 return -kWordSize;
3903 }
3904
3748 static RawApiError* New(); 3905 static RawApiError* New();
3749 3906
3750 FINAL_HEAP_OBJECT_IMPLEMENTATION(ApiError, Error); 3907 FINAL_HEAP_OBJECT_IMPLEMENTATION(ApiError, Error);
3751 friend class Class; 3908 friend class Class;
3752 }; 3909 };
3753 3910
3754 3911
3755 class LanguageError : public Error { 3912 class LanguageError : public Error {
3756 public: 3913 public:
3757 RawString* message() const { return raw_ptr()->message_; } 3914 RawString* message() const { return raw_ptr()->message_; }
3758 static intptr_t message_offset() { 3915 static intptr_t message_offset() {
3759 return OFFSET_OF(RawLanguageError, message_); 3916 return OFFSET_OF(RawLanguageError, message_);
3760 } 3917 }
3761 3918
3762 static intptr_t InstanceSize() { 3919 static intptr_t InstanceSize() {
3763 return RoundedAllocationSize(sizeof(RawLanguageError)); 3920 return RoundedAllocationSize(sizeof(RawLanguageError));
3764 } 3921 }
3765 3922
3766 static RawLanguageError* New(const String& message, 3923 static RawLanguageError* New(const String& message,
3767 Heap::Space space = Heap::kNew); 3924 Heap::Space space = Heap::kNew);
3768 3925
3769 virtual const char* ToErrorCString() const; 3926 virtual const char* ToErrorCString() const;
3770 3927
3771 private: 3928 private:
3772 void set_message(const String& message) const; 3929 void set_message(const String& message) const;
3930
3931 static intptr_t NextFieldOffset() {
3932 // Indicates this class cannot be extended by dart code.
3933 return -kWordSize;
3934 }
3935
3773 static RawLanguageError* New(); 3936 static RawLanguageError* New();
3774 3937
3775 FINAL_HEAP_OBJECT_IMPLEMENTATION(LanguageError, Error); 3938 FINAL_HEAP_OBJECT_IMPLEMENTATION(LanguageError, Error);
3776 friend class Class; 3939 friend class Class;
3777 }; 3940 };
3778 3941
3779 3942
3780 class UnhandledException : public Error { 3943 class UnhandledException : public Error {
3781 public: 3944 public:
3782 RawInstance* exception() const { return raw_ptr()->exception_; } 3945 RawInstance* exception() const { return raw_ptr()->exception_; }
(...skipping 13 matching lines...) Expand all
3796 static RawUnhandledException* New(const Instance& exception, 3959 static RawUnhandledException* New(const Instance& exception,
3797 const Instance& stacktrace, 3960 const Instance& stacktrace,
3798 Heap::Space space = Heap::kNew); 3961 Heap::Space space = Heap::kNew);
3799 3962
3800 virtual const char* ToErrorCString() const; 3963 virtual const char* ToErrorCString() const;
3801 3964
3802 private: 3965 private:
3803 void set_exception(const Instance& exception) const; 3966 void set_exception(const Instance& exception) const;
3804 void set_stacktrace(const Instance& stacktrace) const; 3967 void set_stacktrace(const Instance& stacktrace) const;
3805 3968
3969 static intptr_t NextFieldOffset() {
3970 // Indicates this class cannot be extended by dart code.
3971 return -kWordSize;
3972 }
3973
3806 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnhandledException, Error); 3974 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnhandledException, Error);
3807 friend class Class; 3975 friend class Class;
3808 }; 3976 };
3809 3977
3810 3978
3811 class UnwindError : public Error { 3979 class UnwindError : public Error {
3812 public: 3980 public:
3813 RawString* message() const { return raw_ptr()->message_; } 3981 RawString* message() const { return raw_ptr()->message_; }
3814 static intptr_t message_offset() { 3982 static intptr_t message_offset() {
3815 return OFFSET_OF(RawUnwindError, message_); 3983 return OFFSET_OF(RawUnwindError, message_);
3816 } 3984 }
3817 3985
3818 static intptr_t InstanceSize() { 3986 static intptr_t InstanceSize() {
3819 return RoundedAllocationSize(sizeof(RawUnwindError)); 3987 return RoundedAllocationSize(sizeof(RawUnwindError));
3820 } 3988 }
3821 3989
3822 static RawUnwindError* New(const String& message, 3990 static RawUnwindError* New(const String& message,
3823 Heap::Space space = Heap::kNew); 3991 Heap::Space space = Heap::kNew);
3824 3992
3825 virtual const char* ToErrorCString() const; 3993 virtual const char* ToErrorCString() const;
3826 3994
3827 private: 3995 private:
3828 void set_message(const String& message) const; 3996 void set_message(const String& message) const;
3829 3997
3998 static intptr_t NextFieldOffset() {
3999 // Indicates this class cannot be extended by dart code.
4000 return -kWordSize;
4001 }
4002
3830 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnwindError, Error); 4003 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnwindError, Error);
3831 friend class Class; 4004 friend class Class;
3832 }; 4005 };
3833 4006
3834 4007
3835 // Instance is the base class for all instance objects (aka the Object class 4008 // Instance is the base class for all instance objects (aka the Object class
3836 // in Dart source code. 4009 // in Dart source code.
3837 class Instance : public Object { 4010 class Instance : public Object {
3838 public: 4011 public:
3839 virtual bool Equals(const Instance& other) const; 4012 virtual bool Equals(const Instance& other) const;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3906 return FieldAddrAtOffset(field.Offset()); 4079 return FieldAddrAtOffset(field.Offset());
3907 } 4080 }
3908 RawObject** NativeFieldsAddr() const { 4081 RawObject** NativeFieldsAddr() const {
3909 return FieldAddrAtOffset(sizeof(RawObject)); 4082 return FieldAddrAtOffset(sizeof(RawObject));
3910 } 4083 }
3911 void SetFieldAtOffset(intptr_t offset, const Object& value) const { 4084 void SetFieldAtOffset(intptr_t offset, const Object& value) const {
3912 StorePointer(FieldAddrAtOffset(offset), value.raw()); 4085 StorePointer(FieldAddrAtOffset(offset), value.raw());
3913 } 4086 }
3914 bool IsValidFieldOffset(int offset) const; 4087 bool IsValidFieldOffset(int offset) const;
3915 4088
4089 static intptr_t NextFieldOffset() {
4090 return sizeof(RawInstance);
4091 }
4092
3916 // TODO(iposva): Determine if this gets in the way of Smi. 4093 // TODO(iposva): Determine if this gets in the way of Smi.
3917 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); 4094 HEAP_OBJECT_IMPLEMENTATION(Instance, Object);
3918 friend class Class; 4095 friend class Class;
3919 friend class Closure; 4096 friend class Closure;
4097 friend class SnapshotWriter;
4098 friend class StubCode;
3920 friend class TypedDataView; 4099 friend class TypedDataView;
3921 }; 4100 };
3922 4101
3923 4102
3924 // AbstractType is an abstract superclass. 4103 // AbstractType is an abstract superclass.
3925 // Subclasses of AbstractType are Type and TypeParameter. 4104 // Subclasses of AbstractType are Type and TypeParameter.
3926 class AbstractType : public Instance { 4105 class AbstractType : public Instance {
3927 public: 4106 public:
3928 virtual bool IsFinalized() const; 4107 virtual bool IsFinalized() const;
3929 virtual bool IsBeingFinalized() const; 4108 virtual bool IsBeingFinalized() const;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
4149 4328
4150 static RawType* New(const Object& clazz, 4329 static RawType* New(const Object& clazz,
4151 const AbstractTypeArguments& arguments, 4330 const AbstractTypeArguments& arguments,
4152 intptr_t token_pos, 4331 intptr_t token_pos,
4153 Heap::Space space = Heap::kOld); 4332 Heap::Space space = Heap::kOld);
4154 4333
4155 private: 4334 private:
4156 void set_token_pos(intptr_t token_pos) const; 4335 void set_token_pos(intptr_t token_pos) const;
4157 void set_type_state(int8_t state) const; 4336 void set_type_state(int8_t state) const;
4158 4337
4338 static intptr_t NextFieldOffset() {
4339 return sizeof(RawType);
4340 }
4341
4159 static RawType* New(Heap::Space space = Heap::kOld); 4342 static RawType* New(Heap::Space space = Heap::kOld);
4160 4343
4161 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType); 4344 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType);
4162 friend class Class; 4345 friend class Class;
4163 }; 4346 };
4164 4347
4165 4348
4166 // A TypeParameter represents a type parameter of a parameterized class. 4349 // A TypeParameter represents a type parameter of a parameterized class.
4167 // It specifies its index (and its name for debugging purposes), as well as its 4350 // It specifies its index (and its name for debugging purposes), as well as its
4168 // upper bound. 4351 // upper bound.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
4218 intptr_t index, 4401 intptr_t index,
4219 const String& name, 4402 const String& name,
4220 const AbstractType& bound, 4403 const AbstractType& bound,
4221 intptr_t token_pos); 4404 intptr_t token_pos);
4222 4405
4223 private: 4406 private:
4224 void set_parameterized_class(const Class& value) const; 4407 void set_parameterized_class(const Class& value) const;
4225 void set_name(const String& value) const; 4408 void set_name(const String& value) const;
4226 void set_token_pos(intptr_t token_pos) const; 4409 void set_token_pos(intptr_t token_pos) const;
4227 void set_type_state(int8_t state) const; 4410 void set_type_state(int8_t state) const;
4411
4412 static intptr_t NextFieldOffset() {
4413 // Indicates this class cannot be extended by dart code.
4414 return -kWordSize;
4415 }
4416
4228 static RawTypeParameter* New(); 4417 static RawTypeParameter* New();
4229 4418
4230 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType); 4419 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType);
4231 friend class Class; 4420 friend class Class;
4232 }; 4421 };
4233 4422
4234 4423
4235 // A BoundedType represents a type instantiated at compile time from a type 4424 // A BoundedType represents a type instantiated at compile time from a type
4236 // parameter specifying a bound that either cannot be checked at compile time 4425 // parameter specifying a bound that either cannot be checked at compile time
4237 // because the type or the bound are still uninstantiated or can be checked and 4426 // because the type or the bound are still uninstantiated or can be checked and
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
4294 private: 4483 private:
4295 void set_type(const AbstractType& value) const; 4484 void set_type(const AbstractType& value) const;
4296 void set_bound(const AbstractType& value) const; 4485 void set_bound(const AbstractType& value) const;
4297 void set_type_parameter(const TypeParameter& value) const; 4486 void set_type_parameter(const TypeParameter& value) const;
4298 4487
4299 bool is_being_checked() const { 4488 bool is_being_checked() const {
4300 return raw_ptr()->is_being_checked_; 4489 return raw_ptr()->is_being_checked_;
4301 } 4490 }
4302 void set_is_being_checked(bool value) const; 4491 void set_is_being_checked(bool value) const;
4303 4492
4493 static intptr_t NextFieldOffset() {
4494 // Indicates this class cannot be extended by dart code.
4495 return -kWordSize;
4496 }
4497
4304 static RawBoundedType* New(); 4498 static RawBoundedType* New();
4305 4499
4306 FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType); 4500 FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType);
4307 friend class Class; 4501 friend class Class;
4308 }; 4502 };
4309 4503
4310 4504
4311 // A MixinAppType represents a parsed mixin application clause, e.g. 4505 // A MixinAppType represents a parsed mixin application clause, e.g.
4312 // "S<T> with M<U>, N<V>". 4506 // "S<T> with M<U>, N<V>".
4313 // MixinAppType objects do not survive finalization, so they do not 4507 // MixinAppType objects do not survive finalization, so they do not
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4345 4539
4346 static RawMixinAppType* New(const AbstractType& super_type, 4540 static RawMixinAppType* New(const AbstractType& super_type,
4347 const Array& mixin_types); 4541 const Array& mixin_types);
4348 4542
4349 private: 4543 private:
4350 void set_super_type(const AbstractType& value) const; 4544 void set_super_type(const AbstractType& value) const;
4351 4545
4352 RawArray* mixin_types() const { return raw_ptr()->mixin_types_; } 4546 RawArray* mixin_types() const { return raw_ptr()->mixin_types_; }
4353 void set_mixin_types(const Array& value) const; 4547 void set_mixin_types(const Array& value) const;
4354 4548
4549 static intptr_t NextFieldOffset() {
4550 // Indicates this class cannot be extended by dart code.
4551 return -kWordSize;
4552 }
4553
4355 static RawMixinAppType* New(); 4554 static RawMixinAppType* New();
4356 4555
4357 FINAL_HEAP_OBJECT_IMPLEMENTATION(MixinAppType, AbstractType); 4556 FINAL_HEAP_OBJECT_IMPLEMENTATION(MixinAppType, AbstractType);
4358 friend class Class; 4557 friend class Class;
4359 }; 4558 };
4360 4559
4361 4560
4362 class Number : public Instance { 4561 class Number : public Instance {
4363 public: 4562 public:
4364 // TODO(iposva): Fill in a useful Number interface. 4563 // TODO(iposva): Fill in a useful Number interface.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
4471 void operator=(RawSmi* value) { 4670 void operator=(RawSmi* value) {
4472 raw_ = value; 4671 raw_ = value;
4473 CHECK_HANDLE(); 4672 CHECK_HANDLE();
4474 } 4673 }
4475 void operator^=(RawObject* value) { 4674 void operator^=(RawObject* value) {
4476 raw_ = value; 4675 raw_ = value;
4477 CHECK_HANDLE(); 4676 CHECK_HANDLE();
4478 } 4677 }
4479 4678
4480 private: 4679 private:
4680 static intptr_t NextFieldOffset() {
4681 // Indicates this class cannot be extended by dart code.
4682 return -kWordSize;
4683 }
4684
4481 static intptr_t ValueFromRaw(uword raw_value) { 4685 static intptr_t ValueFromRaw(uword raw_value) {
4482 intptr_t value = raw_value; 4686 intptr_t value = raw_value;
4483 ASSERT((value & kSmiTagMask) == kSmiTag); 4687 ASSERT((value & kSmiTagMask) == kSmiTag);
4484 return (value >> kSmiTagShift); 4688 return (value >> kSmiTagShift);
4485 } 4689 }
4690
4486 static cpp_vtable handle_vtable_; 4691 static cpp_vtable handle_vtable_;
4487 4692
4488 Smi() : Integer() {} 4693 Smi() : Integer() {}
4489 BASE_OBJECT_IMPLEMENTATION(Smi, Integer); 4694 BASE_OBJECT_IMPLEMENTATION(Smi, Integer);
4490 4695
4491 friend class Api; // For ValueFromRaw 4696 friend class Api; // For ValueFromRaw
4492 friend class Class; 4697 friend class Class;
4493 friend class Object; 4698 friend class Object;
4494 }; 4699 };
4495 4700
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4529 // Only Integer::NewXXX is allowed to call Mint::NewXXX directly. 4734 // Only Integer::NewXXX is allowed to call Mint::NewXXX directly.
4530 friend class Integer; 4735 friend class Integer;
4531 4736
4532 static RawMint* New(int64_t value, Heap::Space space = Heap::kNew); 4737 static RawMint* New(int64_t value, Heap::Space space = Heap::kNew);
4533 4738
4534 static RawMint* NewCanonical(int64_t value); 4739 static RawMint* NewCanonical(int64_t value);
4535 4740
4536 private: 4741 private:
4537 void set_value(int64_t value) const; 4742 void set_value(int64_t value) const;
4538 4743
4744 static intptr_t NextFieldOffset() {
4745 // Indicates this class cannot be extended by dart code.
4746 return -kWordSize;
4747 }
4748
4539 FINAL_HEAP_OBJECT_IMPLEMENTATION(Mint, Integer); 4749 FINAL_HEAP_OBJECT_IMPLEMENTATION(Mint, Integer);
4540 friend class Class; 4750 friend class Class;
4541 }; 4751 };
4542 4752
4543 4753
4544 class Bigint : public Integer { 4754 class Bigint : public Integer {
4545 private: 4755 private:
4546 typedef uint32_t Chunk; 4756 typedef uint32_t Chunk;
4547 typedef uint64_t DoubleChunk; 4757 typedef uint64_t DoubleChunk;
4548 static const int kChunkSize = sizeof(Chunk); 4758 static const int kChunkSize = sizeof(Chunk);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
4612 raw_ptr()->signed_length_ = -raw_ptr()->signed_length_; 4822 raw_ptr()->signed_length_ = -raw_ptr()->signed_length_;
4613 } 4823 }
4614 4824
4615 Chunk* ChunkAddr(intptr_t index) const { 4825 Chunk* ChunkAddr(intptr_t index) const {
4616 ASSERT(0 <= index); 4826 ASSERT(0 <= index);
4617 ASSERT(index < Length()); 4827 ASSERT(index < Length());
4618 uword digits_start = reinterpret_cast<uword>(raw_ptr()) + sizeof(RawBigint); 4828 uword digits_start = reinterpret_cast<uword>(raw_ptr()) + sizeof(RawBigint);
4619 return &(reinterpret_cast<Chunk*>(digits_start)[index]); 4829 return &(reinterpret_cast<Chunk*>(digits_start)[index]);
4620 } 4830 }
4621 4831
4832 static intptr_t NextFieldOffset() {
4833 // Indicates this class cannot be extended by dart code.
4834 return -kWordSize;
4835 }
4836
4622 static RawBigint* Allocate(intptr_t length, Heap::Space space = Heap::kNew); 4837 static RawBigint* Allocate(intptr_t length, Heap::Space space = Heap::kNew);
4623 4838
4624 FINAL_HEAP_OBJECT_IMPLEMENTATION(Bigint, Integer); 4839 FINAL_HEAP_OBJECT_IMPLEMENTATION(Bigint, Integer);
4625 friend class BigintOperations; 4840 friend class BigintOperations;
4626 friend class Class; 4841 friend class Class;
4627 }; 4842 };
4628 4843
4629 4844
4630 // Class Double represents class Double in corelib_impl, which implements 4845 // Class Double represents class Double in corelib_impl, which implements
4631 // abstract class double in corelib. 4846 // abstract class double in corelib.
(...skipping 20 matching lines...) Expand all
4652 4867
4653 static intptr_t InstanceSize() { 4868 static intptr_t InstanceSize() {
4654 return RoundedAllocationSize(sizeof(RawDouble)); 4869 return RoundedAllocationSize(sizeof(RawDouble));
4655 } 4870 }
4656 4871
4657 static intptr_t value_offset() { return OFFSET_OF(RawDouble, value_); } 4872 static intptr_t value_offset() { return OFFSET_OF(RawDouble, value_); }
4658 4873
4659 private: 4874 private:
4660 void set_value(double value) const; 4875 void set_value(double value) const;
4661 4876
4877 static intptr_t NextFieldOffset() {
4878 // Indicates this class cannot be extended by dart code.
4879 return -kWordSize;
4880 }
4881
4662 FINAL_HEAP_OBJECT_IMPLEMENTATION(Double, Number); 4882 FINAL_HEAP_OBJECT_IMPLEMENTATION(Double, Number);
4663 friend class Class; 4883 friend class Class;
4664 }; 4884 };
4665 4885
4666 4886
4667 // String may not be '\0' terminated. 4887 // String may not be '\0' terminated.
4668 class String : public Instance { 4888 class String : public Instance {
4669 public: 4889 public:
4670 // We use 30 bits for the hash code so that we consistently use a 4890 // We use 30 bits for the hash code so that we consistently use a
4671 // 32bit Smi representation for the hash code on all architectures. 4891 // 32bit Smi representation for the hash code on all architectures.
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
5034 ASSERT(str.IsOneByteString()); 5254 ASSERT(str.IsOneByteString());
5035 NoGCScope no_gc; 5255 NoGCScope no_gc;
5036 return &raw_ptr(str)->data_[index]; 5256 return &raw_ptr(str)->data_[index];
5037 } 5257 }
5038 5258
5039 static RawOneByteString* ReadFrom(SnapshotReader* reader, 5259 static RawOneByteString* ReadFrom(SnapshotReader* reader,
5040 intptr_t object_id, 5260 intptr_t object_id,
5041 intptr_t tags, 5261 intptr_t tags,
5042 Snapshot::Kind kind); 5262 Snapshot::Kind kind);
5043 5263
5264 static intptr_t NextFieldOffset() {
5265 // Indicates this class cannot be extended by dart code.
5266 return -kWordSize;
5267 }
5268
5044 friend class Class; 5269 friend class Class;
5045 friend class String; 5270 friend class String;
5046 friend class ExternalOneByteString; 5271 friend class ExternalOneByteString;
5047 friend class SnapshotReader; 5272 friend class SnapshotReader;
5048 }; 5273 };
5049 5274
5050 5275
5051 class TwoByteString : public AllStatic { 5276 class TwoByteString : public AllStatic {
5052 public: 5277 public:
5053 static int32_t CharAt(const String& str, intptr_t index) { 5278 static int32_t CharAt(const String& str, intptr_t index) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
5126 ASSERT(str.IsTwoByteString()); 5351 ASSERT(str.IsTwoByteString());
5127 NoGCScope no_gc; 5352 NoGCScope no_gc;
5128 return &raw_ptr(str)->data_[index]; 5353 return &raw_ptr(str)->data_[index];
5129 } 5354 }
5130 5355
5131 static RawTwoByteString* ReadFrom(SnapshotReader* reader, 5356 static RawTwoByteString* ReadFrom(SnapshotReader* reader,
5132 intptr_t object_id, 5357 intptr_t object_id,
5133 intptr_t tags, 5358 intptr_t tags,
5134 Snapshot::Kind kind); 5359 Snapshot::Kind kind);
5135 5360
5361 static intptr_t NextFieldOffset() {
5362 // Indicates this class cannot be extended by dart code.
5363 return -kWordSize;
5364 }
5365
5136 friend class Class; 5366 friend class Class;
5137 friend class String; 5367 friend class String;
5138 friend class SnapshotReader; 5368 friend class SnapshotReader;
5139 }; 5369 };
5140 5370
5141 5371
5142 class ExternalOneByteString : public AllStatic { 5372 class ExternalOneByteString : public AllStatic {
5143 public: 5373 public:
5144 static int32_t CharAt(const String& str, intptr_t index) { 5374 static int32_t CharAt(const String& str, intptr_t index) {
5145 return *CharAddr(str, index); 5375 return *CharAddr(str, index);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
5194 raw_ptr(str)->external_data_ = data; 5424 raw_ptr(str)->external_data_ = data;
5195 } 5425 }
5196 5426
5197 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); 5427 static void Finalize(Dart_WeakPersistentHandle handle, void* peer);
5198 5428
5199 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader, 5429 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader,
5200 intptr_t object_id, 5430 intptr_t object_id,
5201 intptr_t tags, 5431 intptr_t tags,
5202 Snapshot::Kind kind); 5432 Snapshot::Kind kind);
5203 5433
5434 static intptr_t NextFieldOffset() {
5435 // Indicates this class cannot be extended by dart code.
5436 return -kWordSize;
5437 }
5438
5204 friend class Class; 5439 friend class Class;
5205 friend class String; 5440 friend class String;
5206 friend class SnapshotReader; 5441 friend class SnapshotReader;
5207 }; 5442 };
5208 5443
5209 5444
5210 class ExternalTwoByteString : public AllStatic { 5445 class ExternalTwoByteString : public AllStatic {
5211 public: 5446 public:
5212 static int32_t CharAt(const String& str, intptr_t index) { 5447 static int32_t CharAt(const String& str, intptr_t index) {
5213 return *CharAddr(str, index); 5448 return *CharAddr(str, index);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
5260 raw_ptr(str)->external_data_ = data; 5495 raw_ptr(str)->external_data_ = data;
5261 } 5496 }
5262 5497
5263 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); 5498 static void Finalize(Dart_WeakPersistentHandle handle, void* peer);
5264 5499
5265 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader, 5500 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader,
5266 intptr_t object_id, 5501 intptr_t object_id,
5267 intptr_t tags, 5502 intptr_t tags,
5268 Snapshot::Kind kind); 5503 Snapshot::Kind kind);
5269 5504
5505 static intptr_t NextFieldOffset() {
5506 // Indicates this class cannot be extended by dart code.
5507 return -kWordSize;
5508 }
5509
5270 friend class Class; 5510 friend class Class;
5271 friend class String; 5511 friend class String;
5272 friend class SnapshotReader; 5512 friend class SnapshotReader;
5273 }; 5513 };
5274 5514
5275 5515
5276 // Class Bool implements Dart core class bool. 5516 // Class Bool implements Dart core class bool.
5277 class Bool : public Instance { 5517 class Bool : public Instance {
5278 public: 5518 public:
5279 bool value() const { 5519 bool value() const {
(...skipping 12 matching lines...) Expand all
5292 return Object::bool_false(); 5532 return Object::bool_false();
5293 } 5533 }
5294 5534
5295 static const Bool& Get(bool value) { 5535 static const Bool& Get(bool value) {
5296 return value ? Bool::True() : Bool::False(); 5536 return value ? Bool::True() : Bool::False();
5297 } 5537 }
5298 5538
5299 private: 5539 private:
5300 void set_value(bool value) const { raw_ptr()->value_ = value; } 5540 void set_value(bool value) const { raw_ptr()->value_ = value; }
5301 5541
5542 static intptr_t NextFieldOffset() {
5543 // Indicates this class cannot be extended by dart code.
5544 return -kWordSize;
5545 }
5546
5302 // New should only be called to initialize the two legal bool values. 5547 // New should only be called to initialize the two legal bool values.
5303 static RawBool* New(bool value); 5548 static RawBool* New(bool value);
5304 5549
5305 FINAL_HEAP_OBJECT_IMPLEMENTATION(Bool, Instance); 5550 FINAL_HEAP_OBJECT_IMPLEMENTATION(Bool, Instance);
5306 friend class Class; 5551 friend class Class;
5307 friend class Object; // To initialize the true and false values. 5552 friend class Object; // To initialize the true and false values.
5308 }; 5553 };
5309 5554
5310 5555
5311 class Array : public Instance { 5556 class Array : public Instance {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
5401 ASSERT((index >= 0) && (index < Length())); 5646 ASSERT((index >= 0) && (index < Length()));
5402 return &raw_ptr()->data()[index]; 5647 return &raw_ptr()->data()[index];
5403 } 5648 }
5404 5649
5405 void SetLength(intptr_t value) const { 5650 void SetLength(intptr_t value) const {
5406 // This is only safe because we create a new Smi, which does not cause 5651 // This is only safe because we create a new Smi, which does not cause
5407 // heap allocation. 5652 // heap allocation.
5408 raw_ptr()->length_ = Smi::New(value); 5653 raw_ptr()->length_ = Smi::New(value);
5409 } 5654 }
5410 5655
5656 static intptr_t NextFieldOffset() {
5657 // Indicates this class cannot be extended by dart code.
5658 return -kWordSize;
5659 }
5660
5411 FINAL_HEAP_OBJECT_IMPLEMENTATION(Array, Instance); 5661 FINAL_HEAP_OBJECT_IMPLEMENTATION(Array, Instance);
5412 friend class Class; 5662 friend class Class;
5413 friend class ImmutableArray; 5663 friend class ImmutableArray;
5414 friend class Object; 5664 friend class Object;
5415 friend class String; 5665 friend class String;
5416 }; 5666 };
5417 5667
5418 5668
5419 class ImmutableArray : public AllStatic { 5669 class ImmutableArray : public AllStatic {
5420 public: 5670 public:
5421 static RawImmutableArray* New(intptr_t len, Heap::Space space = Heap::kNew); 5671 static RawImmutableArray* New(intptr_t len, Heap::Space space = Heap::kNew);
5422 5672
5423 static RawImmutableArray* ReadFrom(SnapshotReader* reader, 5673 static RawImmutableArray* ReadFrom(SnapshotReader* reader,
5424 intptr_t object_id, 5674 intptr_t object_id,
5425 intptr_t tags, 5675 intptr_t tags,
5426 Snapshot::Kind kind); 5676 Snapshot::Kind kind);
5427 5677
5428 static const ClassId kClassId = kImmutableArrayCid; 5678 static const ClassId kClassId = kImmutableArrayCid;
5429 5679
5430 static intptr_t InstanceSize() { 5680 static intptr_t InstanceSize() {
5431 return Array::InstanceSize(); 5681 return Array::InstanceSize();
5432 } 5682 }
5433 5683
5434 static intptr_t InstanceSize(intptr_t len) { 5684 static intptr_t InstanceSize(intptr_t len) {
5435 return Array::InstanceSize(len); 5685 return Array::InstanceSize(len);
5436 } 5686 }
5437 5687
5438 private: 5688 private:
5689 static intptr_t NextFieldOffset() {
5690 // Indicates this class cannot be extended by dart code.
5691 return -kWordSize;
5692 }
5693
5439 static RawImmutableArray* raw(const Array& array) { 5694 static RawImmutableArray* raw(const Array& array) {
5440 return reinterpret_cast<RawImmutableArray*>(array.raw()); 5695 return reinterpret_cast<RawImmutableArray*>(array.raw());
5441 } 5696 }
5442 5697
5443 friend class Class; 5698 friend class Class;
5444 }; 5699 };
5445 5700
5446 5701
5447 class GrowableObjectArray : public Instance { 5702 class GrowableObjectArray : public Instance {
5448 public: 5703 public:
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
5545 *addr = value; 5800 *addr = value;
5546 // Filter stores based on source and target. 5801 // Filter stores based on source and target.
5547 if (!value->IsHeapObject()) return; 5802 if (!value->IsHeapObject()) return;
5548 if (value->IsNewObject() && data()->IsOldObject() && 5803 if (value->IsNewObject() && data()->IsOldObject() &&
5549 !data()->IsRemembered()) { 5804 !data()->IsRemembered()) {
5550 data()->SetRememberedBit(); 5805 data()->SetRememberedBit();
5551 Isolate::Current()->store_buffer()->AddObject(data()); 5806 Isolate::Current()->store_buffer()->AddObject(data());
5552 } 5807 }
5553 } 5808 }
5554 5809
5810 static intptr_t NextFieldOffset() {
5811 return sizeof(RawGrowableObjectArray);
Ivan Posva 2013/11/03 16:08:51 Are you sure we need to be able to extend the VM's
siva 2013/11/04 16:05:01 Removed this. On 2013/11/03 16:08:51, Ivan Posva
5812 }
5813
5555 static const int kDefaultInitialCapacity = 4; 5814 static const int kDefaultInitialCapacity = 4;
5556 5815
5557 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance); 5816 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance);
5558 friend class Array; 5817 friend class Array;
5559 friend class Class; 5818 friend class Class;
5560 }; 5819 };
5561 5820
5562 5821
5563 class Float32x4 : public Instance { 5822 class Float32x4 : public Instance {
5564 public: 5823 public:
(...skipping 17 matching lines...) Expand all
5582 5841
5583 static intptr_t InstanceSize() { 5842 static intptr_t InstanceSize() {
5584 return RoundedAllocationSize(sizeof(RawFloat32x4)); 5843 return RoundedAllocationSize(sizeof(RawFloat32x4));
5585 } 5844 }
5586 5845
5587 static intptr_t value_offset() { 5846 static intptr_t value_offset() {
5588 return OFFSET_OF(RawFloat32x4, value_); 5847 return OFFSET_OF(RawFloat32x4, value_);
5589 } 5848 }
5590 5849
5591 private: 5850 private:
5851 static intptr_t NextFieldOffset() {
5852 // Indicates this class cannot be extended by dart code.
5853 return -kWordSize;
5854 }
5855
5592 FINAL_HEAP_OBJECT_IMPLEMENTATION(Float32x4, Instance); 5856 FINAL_HEAP_OBJECT_IMPLEMENTATION(Float32x4, Instance);
5593 friend class Class; 5857 friend class Class;
5594 }; 5858 };
5595 5859
5596 5860
5597 class Uint32x4 : public Instance { 5861 class Uint32x4 : public Instance {
5598 public: 5862 public:
5599 static RawUint32x4* New(uint32_t value0, uint32_t value1, uint32_t value2, 5863 static RawUint32x4* New(uint32_t value0, uint32_t value1, uint32_t value2,
5600 uint32_t value3, Heap::Space space = Heap::kNew); 5864 uint32_t value3, Heap::Space space = Heap::kNew);
5601 static RawUint32x4* New(simd128_value_t value, 5865 static RawUint32x4* New(simd128_value_t value,
(...skipping 14 matching lines...) Expand all
5616 5880
5617 static intptr_t InstanceSize() { 5881 static intptr_t InstanceSize() {
5618 return RoundedAllocationSize(sizeof(RawUint32x4)); 5882 return RoundedAllocationSize(sizeof(RawUint32x4));
5619 } 5883 }
5620 5884
5621 static intptr_t value_offset() { 5885 static intptr_t value_offset() {
5622 return OFFSET_OF(RawUint32x4, value_); 5886 return OFFSET_OF(RawUint32x4, value_);
5623 } 5887 }
5624 5888
5625 private: 5889 private:
5890 static intptr_t NextFieldOffset() {
5891 // Indicates this class cannot be extended by dart code.
5892 return -kWordSize;
5893 }
5894
5626 FINAL_HEAP_OBJECT_IMPLEMENTATION(Uint32x4, Instance); 5895 FINAL_HEAP_OBJECT_IMPLEMENTATION(Uint32x4, Instance);
5627 friend class Class; 5896 friend class Class;
5628 }; 5897 };
5629 5898
5630 5899
5631 class TypedData : public Instance { 5900 class TypedData : public Instance {
5632 public: 5901 public:
5633 intptr_t Length() const { 5902 intptr_t Length() const {
5634 ASSERT(!IsNull()); 5903 ASSERT(!IsNull());
5635 return Smi::Value(raw_ptr()->length_); 5904 return Smi::Value(raw_ptr()->length_);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
5743 intptr_t cid = obj.raw()->GetClassId(); 6012 intptr_t cid = obj.raw()->GetClassId();
5744 return RawObject::IsTypedDataClassId(cid); 6013 return RawObject::IsTypedDataClassId(cid);
5745 } 6014 }
5746 6015
5747 protected: 6016 protected:
5748 void SetLength(intptr_t value) const { 6017 void SetLength(intptr_t value) const {
5749 raw_ptr()->length_ = Smi::New(value); 6018 raw_ptr()->length_ = Smi::New(value);
5750 } 6019 }
5751 6020
5752 private: 6021 private:
6022 static intptr_t NextFieldOffset() {
6023 // Indicates this class cannot be extended by dart code.
6024 return -kWordSize;
6025 }
6026
5753 static const intptr_t element_size[]; 6027 static const intptr_t element_size[];
5754 6028
5755 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypedData, Instance); 6029 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypedData, Instance);
5756 friend class Class; 6030 friend class Class;
5757 friend class ExternalTypedData; 6031 friend class ExternalTypedData;
5758 friend class TypedDataView; 6032 friend class TypedDataView;
5759 }; 6033 };
5760 6034
5761 6035
5762 class ExternalTypedData : public Instance { 6036 class ExternalTypedData : public Instance {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
5862 6136
5863 void SetData(uint8_t* data) const { 6137 void SetData(uint8_t* data) const {
5864 raw_ptr()->data_ = data; 6138 raw_ptr()->data_ = data;
5865 } 6139 }
5866 6140
5867 void SetPeer(void* peer) const { 6141 void SetPeer(void* peer) const {
5868 raw_ptr()->peer_ = peer; 6142 raw_ptr()->peer_ = peer;
5869 } 6143 }
5870 6144
5871 private: 6145 private:
6146 static intptr_t NextFieldOffset() {
6147 // Indicates this class cannot be extended by dart code.
6148 return -kWordSize;
6149 }
6150
5872 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData, Instance); 6151 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData, Instance);
5873 friend class Class; 6152 friend class Class;
5874 }; 6153 };
5875 6154
5876 6155
5877 class TypedDataView : public AllStatic { 6156 class TypedDataView : public AllStatic {
5878 public: 6157 public:
5879 static intptr_t ElementSizeInBytes(const Instance& view_obj) { 6158 static intptr_t ElementSizeInBytes(const Instance& view_obj) {
5880 ASSERT(!view_obj.IsNull()); 6159 ASSERT(!view_obj.IsNull());
5881 intptr_t cid = view_obj.raw()->GetClassId(); 6160 intptr_t cid = view_obj.raw()->GetClassId();
(...skipping 18 matching lines...) Expand all
5900 6179
5901 static bool IsExternalTypedDataView(const Instance& view_obj) { 6180 static bool IsExternalTypedDataView(const Instance& view_obj) {
5902 const Instance& data = Instance::Handle(Data(view_obj)); 6181 const Instance& data = Instance::Handle(Data(view_obj));
5903 intptr_t cid = data.raw()->GetClassId(); 6182 intptr_t cid = data.raw()->GetClassId();
5904 ASSERT(RawObject::IsTypedDataClassId(cid) || 6183 ASSERT(RawObject::IsTypedDataClassId(cid) ||
5905 RawObject::IsExternalTypedDataClassId(cid)); 6184 RawObject::IsExternalTypedDataClassId(cid));
5906 return RawObject::IsExternalTypedDataClassId(cid); 6185 return RawObject::IsExternalTypedDataClassId(cid);
5907 } 6186 }
5908 6187
5909 static intptr_t NumberOfFields() { 6188 static intptr_t NumberOfFields() {
5910 return (kLengthOffset - kTypeArguments); 6189 return kLengthOffset;
5911 } 6190 }
5912 6191
5913 static intptr_t data_offset() { 6192 static intptr_t data_offset() {
5914 return kWordSize * kDataOffset; 6193 return kWordSize * kDataOffset;
5915 } 6194 }
5916 6195
5917 static intptr_t offset_in_bytes_offset() { 6196 static intptr_t offset_in_bytes_offset() {
5918 return kWordSize * kOffsetInBytesOffset; 6197 return kWordSize * kOffsetInBytesOffset;
5919 } 6198 }
5920 6199
5921 static intptr_t length_offset() { 6200 static intptr_t length_offset() {
5922 return kWordSize * kLengthOffset; 6201 return kWordSize * kLengthOffset;
5923 } 6202 }
5924 6203
5925 static intptr_t ElementSizeInBytes(intptr_t class_id) { 6204 static intptr_t ElementSizeInBytes(intptr_t class_id) {
5926 ASSERT(RawObject::IsTypedDataViewClassId(class_id)); 6205 ASSERT(RawObject::IsTypedDataViewClassId(class_id));
5927 return (class_id == kByteDataViewCid) ? 6206 return (class_id == kByteDataViewCid) ?
5928 TypedData::element_size[kTypedDataInt8ArrayCid] : 6207 TypedData::element_size[kTypedDataInt8ArrayCid] :
5929 TypedData::element_size[class_id - kTypedDataInt8ArrayViewCid]; 6208 TypedData::element_size[class_id - kTypedDataInt8ArrayViewCid];
5930 } 6209 }
5931 6210
5932 private: 6211 private:
5933 enum { 6212 enum {
5934 kTypeArguments = 1, 6213 kDataOffset = 1,
5935 kDataOffset = 2, 6214 kOffsetInBytesOffset = 2,
5936 kOffsetInBytesOffset = 3, 6215 kLengthOffset = 3,
5937 kLengthOffset = 4,
5938 }; 6216 };
5939 }; 6217 };
5940 6218
5941 6219
5942 class Closure : public AllStatic { 6220 class Closure : public AllStatic {
5943 public: 6221 public:
5944 static RawFunction* function(const Instance& closure) { 6222 static RawFunction* function(const Instance& closure) {
5945 return *FunctionAddr(closure); 6223 return *FunctionAddr(closure);
5946 } 6224 }
5947 static intptr_t function_offset() { 6225 static intptr_t function_offset() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
6000 reinterpret_cast<intptr_t>(obj.raw_ptr()) + context_offset()); 6278 reinterpret_cast<intptr_t>(obj.raw_ptr()) + context_offset());
6001 } 6279 }
6002 static void set_function(const Instance& closure, 6280 static void set_function(const Instance& closure,
6003 const Function& value) { 6281 const Function& value) {
6004 closure.StorePointer(FunctionAddr(closure), value.raw()); 6282 closure.StorePointer(FunctionAddr(closure), value.raw());
6005 } 6283 }
6006 static void set_context(const Instance& closure, 6284 static void set_context(const Instance& closure,
6007 const Context& value) { 6285 const Context& value) {
6008 closure.StorePointer(ContextAddr(closure), value.raw()); 6286 closure.StorePointer(ContextAddr(closure), value.raw());
6009 } 6287 }
6288 static intptr_t NextFieldOffset() {
6289 // Indicates this class cannot be extended by dart code.
6290 return -kWordSize;
6291 }
6010 6292
6011 friend class Class; 6293 friend class Class;
6012 }; 6294 };
6013 6295
6014 6296
6015 // Internal stacktrace object used in exceptions for printing stack traces. 6297 // Internal stacktrace object used in exceptions for printing stack traces.
6016 class Stacktrace : public Instance { 6298 class Stacktrace : public Instance {
6017 public: 6299 public:
6018 static const int kPreallocatedStackdepth = 10; 6300 static const int kPreallocatedStackdepth = 10;
6019 6301
(...skipping 22 matching lines...) Expand all
6042 RawString* FullStacktrace() const; 6324 RawString* FullStacktrace() const;
6043 const char* ToCStringInternal(intptr_t* frame_index) const; 6325 const char* ToCStringInternal(intptr_t* frame_index) const;
6044 6326
6045 private: 6327 private:
6046 void set_code_array(const Array& code_array) const; 6328 void set_code_array(const Array& code_array) const;
6047 void set_pc_offset_array(const Array& pc_offset_array) const; 6329 void set_pc_offset_array(const Array& pc_offset_array) const;
6048 void set_catch_code_array(const Array& code_array) const; 6330 void set_catch_code_array(const Array& code_array) const;
6049 void set_catch_pc_offset_array(const Array& pc_offset_array) const; 6331 void set_catch_pc_offset_array(const Array& pc_offset_array) const;
6050 bool expand_inlined() const; 6332 bool expand_inlined() const;
6051 6333
6334 static intptr_t NextFieldOffset() {
6335 // Indicates this class cannot be extended by dart code.
6336 return -kWordSize;
6337 }
6338
6052 FINAL_HEAP_OBJECT_IMPLEMENTATION(Stacktrace, Instance); 6339 FINAL_HEAP_OBJECT_IMPLEMENTATION(Stacktrace, Instance);
6053 friend class Class; 6340 friend class Class;
6054 }; 6341 };
6055 6342
6056 6343
6057 // Internal JavaScript regular expression object. 6344 // Internal JavaScript regular expression object.
6058 class JSRegExp : public Instance { 6345 class JSRegExp : public Instance {
6059 public: 6346 public:
6060 // Meaning of RegExType: 6347 // Meaning of RegExType:
6061 // kUninitialized: the type of th regexp has not been initialized yet. 6348 // kUninitialized: the type of th regexp has not been initialized yet.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
6122 private: 6409 private:
6123 void set_type(RegExType type) const { raw_ptr()->type_ = type; } 6410 void set_type(RegExType type) const { raw_ptr()->type_ = type; }
6124 void set_flags(intptr_t value) const { raw_ptr()->flags_ = value; } 6411 void set_flags(intptr_t value) const { raw_ptr()->flags_ = value; }
6125 6412
6126 void SetLength(intptr_t value) const { 6413 void SetLength(intptr_t value) const {
6127 // This is only safe because we create a new Smi, which does not cause 6414 // This is only safe because we create a new Smi, which does not cause
6128 // heap allocation. 6415 // heap allocation.
6129 raw_ptr()->data_length_ = Smi::New(value); 6416 raw_ptr()->data_length_ = Smi::New(value);
6130 } 6417 }
6131 6418
6419 static intptr_t NextFieldOffset() {
6420 // Indicates this class cannot be extended by dart code.
6421 return -kWordSize;
6422 }
6423
6132 FINAL_HEAP_OBJECT_IMPLEMENTATION(JSRegExp, Instance); 6424 FINAL_HEAP_OBJECT_IMPLEMENTATION(JSRegExp, Instance);
6133 friend class Class; 6425 friend class Class;
6134 }; 6426 };
6135 6427
6136 6428
6137 class WeakProperty : public Instance { 6429 class WeakProperty : public Instance {
6138 public: 6430 public:
6139 RawObject* key() const { 6431 RawObject* key() const {
6140 return raw_ptr()->key_; 6432 return raw_ptr()->key_;
6141 } 6433 }
(...skipping 15 matching lines...) Expand all
6157 static intptr_t InstanceSize() { 6449 static intptr_t InstanceSize() {
6158 return RoundedAllocationSize(sizeof(RawWeakProperty)); 6450 return RoundedAllocationSize(sizeof(RawWeakProperty));
6159 } 6451 }
6160 6452
6161 static void Clear(RawWeakProperty* raw_weak) { 6453 static void Clear(RawWeakProperty* raw_weak) {
6162 raw_weak->ptr()->key_ = Object::null(); 6454 raw_weak->ptr()->key_ = Object::null();
6163 raw_weak->ptr()->value_ = Object::null(); 6455 raw_weak->ptr()->value_ = Object::null();
6164 } 6456 }
6165 6457
6166 private: 6458 private:
6459 static intptr_t NextFieldOffset() {
6460 return sizeof(RawWeakProperty);
Ivan Posva 2013/11/03 16:08:51 ditto. Internal VM implementation class, should th
siva 2013/11/04 16:05:01 Rolled this into FINAL_HEAL_OBJECT_IMPLEMENTATION
6461 }
6462
6167 FINAL_HEAP_OBJECT_IMPLEMENTATION(WeakProperty, Instance); 6463 FINAL_HEAP_OBJECT_IMPLEMENTATION(WeakProperty, Instance);
6168 friend class Class; 6464 friend class Class;
6169 }; 6465 };
6170 6466
6171 6467
6172 class MirrorReference : public Instance { 6468 class MirrorReference : public Instance {
6173 public: 6469 public:
6174 RawObject* referent() const { 6470 RawObject* referent() const {
6175 return raw_ptr()->referent_; 6471 return raw_ptr()->referent_;
6176 } 6472 }
(...skipping 15 matching lines...) Expand all
6192 RawTypeParameter* GetTypeParameterReferent() const; 6488 RawTypeParameter* GetTypeParameterReferent() const;
6193 6489
6194 static RawMirrorReference* New(const Object& referent, 6490 static RawMirrorReference* New(const Object& referent,
6195 Heap::Space space = Heap::kNew); 6491 Heap::Space space = Heap::kNew);
6196 6492
6197 static intptr_t InstanceSize() { 6493 static intptr_t InstanceSize() {
6198 return RoundedAllocationSize(sizeof(RawMirrorReference)); 6494 return RoundedAllocationSize(sizeof(RawMirrorReference));
6199 } 6495 }
6200 6496
6201 private: 6497 private:
6498 static intptr_t NextFieldOffset() {
6499 // Indicates this class cannot be extended by dart code.
6500 return -kWordSize;
6501 }
6502
6202 FINAL_HEAP_OBJECT_IMPLEMENTATION(MirrorReference, Instance); 6503 FINAL_HEAP_OBJECT_IMPLEMENTATION(MirrorReference, Instance);
6203 friend class Class; 6504 friend class Class;
6204 }; 6505 };
6205 6506
6206 6507
6207 // Breaking cycles and loops. 6508 // Breaking cycles and loops.
6208 RawClass* Object::clazz() const { 6509 RawClass* Object::clazz() const {
6209 uword raw_value = reinterpret_cast<uword>(raw_); 6510 uword raw_value = reinterpret_cast<uword>(raw_);
6210 if ((raw_value & kSmiTagMask) == kSmiTag) { 6511 if ((raw_value & kSmiTagMask) == kSmiTag) {
6211 return Smi::Class(); 6512 return Smi::Class();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
6321 6622
6322 6623
6323 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6624 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6324 intptr_t index) { 6625 intptr_t index) {
6325 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6626 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6326 } 6627 }
6327 6628
6328 } // namespace dart 6629 } // namespace dart
6329 6630
6330 #endif // VM_OBJECT_H_ 6631 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/freelist.h ('k') | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698