OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 -1; | |
Ivan Posva
2013/11/02 00:25:55
How about -kWordSize and then the scaling becomes
siva
2013/11/02 03:45:00
Done.
| |
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
641 void set_instance_size(intptr_t value_in_bytes) const { | 646 void set_instance_size(intptr_t value_in_bytes) const { |
642 ASSERT(kWordSize != 0); | 647 ASSERT(kWordSize != 0); |
643 set_instance_size_in_words(value_in_bytes / kWordSize); | 648 set_instance_size_in_words(value_in_bytes / kWordSize); |
644 } | 649 } |
645 void set_instance_size_in_words(intptr_t value) const { | 650 void set_instance_size_in_words(intptr_t value) const { |
646 ASSERT(Utils::IsAligned((value * kWordSize), kObjectAlignment)); | 651 ASSERT(Utils::IsAligned((value * kWordSize), kObjectAlignment)); |
647 raw_ptr()->instance_size_in_words_ = value; | 652 raw_ptr()->instance_size_in_words_ = value; |
648 } | 653 } |
649 | 654 |
650 intptr_t next_field_offset() const { | 655 intptr_t next_field_offset() const { |
656 if (raw_ptr()->next_field_offset_in_words_ == -1) { | |
Ivan Posva
2013/11/02 00:25:55
I think we can remove this test and just return a
siva
2013/11/02 03:45:00
Done.
| |
657 return -1; | |
658 } | |
651 return raw_ptr()->next_field_offset_in_words_ * kWordSize; | 659 return raw_ptr()->next_field_offset_in_words_ * kWordSize; |
652 } | 660 } |
653 void set_next_field_offset(intptr_t value_in_bytes) const { | 661 void set_next_field_offset(intptr_t value_in_bytes) const { |
654 ASSERT(kWordSize != 0); | 662 if (value_in_bytes == -1) { |
Ivan Posva
2013/11/02 00:25:55
I would think this test can go too.
siva
2013/11/02 03:45:00
Done.
| |
655 set_next_field_offset_in_words(value_in_bytes / kWordSize); | 663 set_next_field_offset_in_words(-1); |
664 } else { | |
665 ASSERT(kWordSize != 0); | |
666 set_next_field_offset_in_words(value_in_bytes / kWordSize); | |
667 } | |
656 } | 668 } |
657 void set_next_field_offset_in_words(intptr_t value) const { | 669 void set_next_field_offset_in_words(intptr_t value) const { |
658 ASSERT((Utils::IsAligned((value * kWordSize), kObjectAlignment) && | 670 ASSERT((value == -1) || |
671 (Utils::IsAligned((value * kWordSize), kObjectAlignment) && | |
659 (value == raw_ptr()->instance_size_in_words_)) || | 672 (value == raw_ptr()->instance_size_in_words_)) || |
660 (!Utils::IsAligned((value * kWordSize), kObjectAlignment) && | 673 (!Utils::IsAligned((value * kWordSize), kObjectAlignment) && |
661 ((value + 1) == raw_ptr()->instance_size_in_words_))); | 674 ((value + 1) == raw_ptr()->instance_size_in_words_))); |
662 raw_ptr()->next_field_offset_in_words_ = value; | 675 raw_ptr()->next_field_offset_in_words_ = value; |
663 } | 676 } |
664 | 677 |
665 cpp_vtable handle_vtable() const { return raw_ptr()->handle_vtable_; } | 678 cpp_vtable handle_vtable() const { return raw_ptr()->handle_vtable_; } |
666 void set_handle_vtable(cpp_vtable value) const { | 679 void set_handle_vtable(cpp_vtable value) const { |
667 raw_ptr()->handle_vtable_ = value; | 680 raw_ptr()->handle_vtable_ = value; |
668 } | 681 } |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1076 void set_constants(const Array& value) const; | 1089 void set_constants(const Array& value) const; |
1077 | 1090 |
1078 void set_canonical_types(const Array& value) const; | 1091 void set_canonical_types(const Array& value) const; |
1079 RawArray* canonical_types() const; | 1092 RawArray* canonical_types() const; |
1080 | 1093 |
1081 RawArray* invocation_dispatcher_cache() const; | 1094 RawArray* invocation_dispatcher_cache() const; |
1082 void set_invocation_dispatcher_cache(const Array& cache) const; | 1095 void set_invocation_dispatcher_cache(const Array& cache) const; |
1083 RawFunction* CreateInvocationDispatcher(const String& target_name, | 1096 RawFunction* CreateInvocationDispatcher(const String& target_name, |
1084 const Array& args_desc, | 1097 const Array& args_desc, |
1085 RawFunction::Kind kind) const; | 1098 RawFunction::Kind kind) const; |
1099 | |
1100 static intptr_t NextFieldOffset() { | |
1101 // Indicates this class cannot be extended by dart code. | |
1102 return -1; | |
1103 } | |
1086 void CalculateFieldOffsets() const; | 1104 void CalculateFieldOffsets() const; |
1087 | 1105 |
1088 // Initial value for the cached number of type arguments. | 1106 // Initial value for the cached number of type arguments. |
1089 static const intptr_t kUnknownNumTypeArguments = -1; | 1107 static const intptr_t kUnknownNumTypeArguments = -1; |
1090 | 1108 |
1091 int16_t num_type_arguments() const { | 1109 int16_t num_type_arguments() const { |
1092 return raw_ptr()->num_type_arguments_; | 1110 return raw_ptr()->num_type_arguments_; |
1093 } | 1111 } |
1094 void set_num_type_arguments(intptr_t value) const; | 1112 void set_num_type_arguments(intptr_t value) const; |
1095 | 1113 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1137 return raw_ptr()->library_prefix_; | 1155 return raw_ptr()->library_prefix_; |
1138 } | 1156 } |
1139 RawString* ident() const { return raw_ptr()->ident_; } | 1157 RawString* ident() const { return raw_ptr()->ident_; } |
1140 intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 1158 intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
1141 | 1159 |
1142 RawString* Name() const; | 1160 RawString* Name() const; |
1143 | 1161 |
1144 static intptr_t InstanceSize() { | 1162 static intptr_t InstanceSize() { |
1145 return RoundedAllocationSize(sizeof(RawUnresolvedClass)); | 1163 return RoundedAllocationSize(sizeof(RawUnresolvedClass)); |
1146 } | 1164 } |
1165 | |
1147 static RawUnresolvedClass* New(const LibraryPrefix& library_prefix, | 1166 static RawUnresolvedClass* New(const LibraryPrefix& library_prefix, |
1148 const String& ident, | 1167 const String& ident, |
1149 intptr_t token_pos); | 1168 intptr_t token_pos); |
1150 | 1169 |
1151 private: | 1170 private: |
1152 void set_library_prefix(const LibraryPrefix& library_prefix) const; | 1171 void set_library_prefix(const LibraryPrefix& library_prefix) const; |
1153 void set_ident(const String& ident) const; | 1172 void set_ident(const String& ident) const; |
1154 void set_token_pos(intptr_t token_pos) const; | 1173 void set_token_pos(intptr_t token_pos) const; |
1155 | 1174 |
1175 static intptr_t NextFieldOffset() { | |
1176 // Indicates this class cannot be extended by dart code. | |
1177 return -1; | |
1178 } | |
Ivan Posva
2013/11/02 00:25:55
Empty line here and other places.
siva
2013/11/02 03:45:00
Done.
| |
1156 static RawUnresolvedClass* New(); | 1179 static RawUnresolvedClass* New(); |
1157 | 1180 |
1158 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object); | 1181 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object); |
1159 friend class Class; | 1182 friend class Class; |
1160 }; | 1183 }; |
1161 | 1184 |
1162 | 1185 |
1163 // AbstractTypeArguments is an abstract superclass. | 1186 // AbstractTypeArguments is an abstract superclass. |
1164 // Subclasses of AbstractTypeArguments are TypeArguments and | 1187 // Subclasses of AbstractTypeArguments are TypeArguments and |
1165 // InstantiatedTypeArguments. | 1188 // InstantiatedTypeArguments. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1315 return RoundedAllocationSize( | 1338 return RoundedAllocationSize( |
1316 sizeof(RawTypeArguments) + (len * kBytesPerElement)); | 1339 sizeof(RawTypeArguments) + (len * kBytesPerElement)); |
1317 } | 1340 } |
1318 | 1341 |
1319 static RawTypeArguments* New(intptr_t len, Heap::Space space = Heap::kOld); | 1342 static RawTypeArguments* New(intptr_t len, Heap::Space space = Heap::kOld); |
1320 | 1343 |
1321 private: | 1344 private: |
1322 RawAbstractType** TypeAddr(intptr_t index) const; | 1345 RawAbstractType** TypeAddr(intptr_t index) const; |
1323 void SetLength(intptr_t value) const; | 1346 void SetLength(intptr_t value) const; |
1324 | 1347 |
1348 static intptr_t NextFieldOffset() { | |
1349 // Indicates this class cannot be extended by dart code. | |
1350 return -1; | |
1351 } | |
1352 | |
1325 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeArguments, AbstractTypeArguments); | 1353 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeArguments, AbstractTypeArguments); |
1326 friend class Class; | 1354 friend class Class; |
1327 }; | 1355 }; |
1328 | 1356 |
1329 | 1357 |
1330 // An instance of InstantiatedTypeArguments is never encountered at compile | 1358 // An instance of InstantiatedTypeArguments is never encountered at compile |
1331 // time, but only at run time, when type parameters can be matched to actual | 1359 // time, but only at run time, when type parameters can be matched to actual |
1332 // types. | 1360 // types. |
1333 // An instance of InstantiatedTypeArguments consists of a pair of | 1361 // An instance of InstantiatedTypeArguments consists of a pair of |
1334 // AbstractTypeArguments objects. The first type argument vector is | 1362 // AbstractTypeArguments objects. The first type argument vector is |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1377 | 1405 |
1378 static RawInstantiatedTypeArguments* New( | 1406 static RawInstantiatedTypeArguments* New( |
1379 const AbstractTypeArguments& uninstantiated_type_arguments, | 1407 const AbstractTypeArguments& uninstantiated_type_arguments, |
1380 const AbstractTypeArguments& instantiator_type_arguments); | 1408 const AbstractTypeArguments& instantiator_type_arguments); |
1381 | 1409 |
1382 private: | 1410 private: |
1383 void set_uninstantiated_type_arguments( | 1411 void set_uninstantiated_type_arguments( |
1384 const AbstractTypeArguments& value) const; | 1412 const AbstractTypeArguments& value) const; |
1385 void set_instantiator_type_arguments( | 1413 void set_instantiator_type_arguments( |
1386 const AbstractTypeArguments& value) const; | 1414 const AbstractTypeArguments& value) const; |
1415 | |
1416 static intptr_t NextFieldOffset() { | |
1417 // Indicates this class cannot be extended by dart code. | |
1418 return -1; | |
1419 } | |
1387 static RawInstantiatedTypeArguments* New(); | 1420 static RawInstantiatedTypeArguments* New(); |
1388 | 1421 |
1389 FINAL_HEAP_OBJECT_IMPLEMENTATION(InstantiatedTypeArguments, | 1422 FINAL_HEAP_OBJECT_IMPLEMENTATION(InstantiatedTypeArguments, |
1390 AbstractTypeArguments); | 1423 AbstractTypeArguments); |
1391 friend class Class; | 1424 friend class Class; |
1392 }; | 1425 }; |
1393 | 1426 |
1394 | 1427 |
1395 class PatchClass : public Object { | 1428 class PatchClass : public Object { |
1396 public: | 1429 public: |
1397 RawClass* patched_class() const { return raw_ptr()->patched_class_; } | 1430 RawClass* patched_class() const { return raw_ptr()->patched_class_; } |
1398 RawClass* source_class() const { return raw_ptr()->source_class_; } | 1431 RawClass* source_class() const { return raw_ptr()->source_class_; } |
1399 RawScript* Script() const; | 1432 RawScript* Script() const; |
1400 | 1433 |
1401 static intptr_t InstanceSize() { | 1434 static intptr_t InstanceSize() { |
1402 return RoundedAllocationSize(sizeof(RawPatchClass)); | 1435 return RoundedAllocationSize(sizeof(RawPatchClass)); |
1403 } | 1436 } |
1404 | 1437 |
1405 static RawPatchClass* New(const Class& patched_class, | 1438 static RawPatchClass* New(const Class& patched_class, |
1406 const Class& source_class); | 1439 const Class& source_class); |
1407 | 1440 |
1408 private: | 1441 private: |
1409 void set_patched_class(const Class& value) const; | 1442 void set_patched_class(const Class& value) const; |
1410 void set_source_class(const Class& value) const; | 1443 void set_source_class(const Class& value) const; |
1444 | |
1445 static intptr_t NextFieldOffset() { | |
1446 // Indicates this class cannot be extended by dart code. | |
1447 return -1; | |
1448 } | |
1411 static RawPatchClass* New(); | 1449 static RawPatchClass* New(); |
1412 | 1450 |
1413 FINAL_HEAP_OBJECT_IMPLEMENTATION(PatchClass, Object); | 1451 FINAL_HEAP_OBJECT_IMPLEMENTATION(PatchClass, Object); |
1414 friend class Class; | 1452 friend class Class; |
1415 }; | 1453 }; |
1416 | 1454 |
1417 | 1455 |
1418 class Function : public Object { | 1456 class Function : public Object { |
1419 public: | 1457 public: |
1420 RawString* name() const { return raw_ptr()->name_; } | 1458 RawString* name() const { return raw_ptr()->name_; } |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1849 // Returns true if this function represents a local function. | 1887 // Returns true if this function represents a local function. |
1850 bool IsLocalFunction() const { | 1888 bool IsLocalFunction() const { |
1851 return parent_function() != Function::null(); | 1889 return parent_function() != Function::null(); |
1852 } | 1890 } |
1853 | 1891 |
1854 // Returns true if this function represents a signature function without code. | 1892 // Returns true if this function represents a signature function without code. |
1855 bool IsSignatureFunction() const { | 1893 bool IsSignatureFunction() const { |
1856 return kind() == RawFunction::kSignatureFunction; | 1894 return kind() == RawFunction::kSignatureFunction; |
1857 } | 1895 } |
1858 | 1896 |
1859 | |
1860 static intptr_t InstanceSize() { | 1897 static intptr_t InstanceSize() { |
1861 return RoundedAllocationSize(sizeof(RawFunction)); | 1898 return RoundedAllocationSize(sizeof(RawFunction)); |
1862 } | 1899 } |
1863 | 1900 |
1864 static RawFunction* New(const String& name, | 1901 static RawFunction* New(const String& name, |
1865 RawFunction::Kind kind, | 1902 RawFunction::Kind kind, |
1866 bool is_static, | 1903 bool is_static, |
1867 bool is_const, | 1904 bool is_const, |
1868 bool is_abstract, | 1905 bool is_abstract, |
1869 bool is_external, | 1906 bool is_external, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1939 void set_is_external(bool value) const; | 1976 void set_is_external(bool value) const; |
1940 void set_parent_function(const Function& value) const; | 1977 void set_parent_function(const Function& value) const; |
1941 void set_owner(const Object& value) const; | 1978 void set_owner(const Object& value) const; |
1942 RawFunction* implicit_closure_function() const; | 1979 RawFunction* implicit_closure_function() const; |
1943 void set_implicit_closure_function(const Function& value) const; | 1980 void set_implicit_closure_function(const Function& value) const; |
1944 RawInstance* implicit_static_closure() const; | 1981 RawInstance* implicit_static_closure() const; |
1945 void set_implicit_static_closure(const Instance& closure) const; | 1982 void set_implicit_static_closure(const Instance& closure) const; |
1946 void set_num_optional_parameters(intptr_t value) const; // Encoded value. | 1983 void set_num_optional_parameters(intptr_t value) const; // Encoded value. |
1947 void set_kind_tag(intptr_t value) const; | 1984 void set_kind_tag(intptr_t value) const; |
1948 void set_data(const Object& value) const; | 1985 void set_data(const Object& value) const; |
1986 | |
1987 static intptr_t NextFieldOffset() { | |
1988 // Indicates this class cannot be extended by dart code. | |
1989 return -1; | |
1990 } | |
1949 static RawFunction* New(); | 1991 static RawFunction* New(); |
1950 | 1992 |
1951 void BuildSignatureParameters(bool instantiate, | 1993 void BuildSignatureParameters(bool instantiate, |
1952 NameVisibility name_visibility, | 1994 NameVisibility name_visibility, |
1953 const AbstractTypeArguments& instantiator, | 1995 const AbstractTypeArguments& instantiator, |
1954 const GrowableObjectArray& pieces) const; | 1996 const GrowableObjectArray& pieces) const; |
1955 RawString* BuildSignature(bool instantiate, | 1997 RawString* BuildSignature(bool instantiate, |
1956 NameVisibility name_visibility, | 1998 NameVisibility name_visibility, |
1957 const AbstractTypeArguments& instantiator) const; | 1999 const AbstractTypeArguments& instantiator) const; |
1958 | 2000 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2000 RawInstance* implicit_static_closure() const { | 2042 RawInstance* implicit_static_closure() const { |
2001 return raw_ptr()->closure_; | 2043 return raw_ptr()->closure_; |
2002 } | 2044 } |
2003 void set_implicit_static_closure(const Instance& closure) const; | 2045 void set_implicit_static_closure(const Instance& closure) const; |
2004 | 2046 |
2005 RawCode* closure_allocation_stub() const { | 2047 RawCode* closure_allocation_stub() const { |
2006 return raw_ptr()->closure_allocation_stub_; | 2048 return raw_ptr()->closure_allocation_stub_; |
2007 } | 2049 } |
2008 void set_closure_allocation_stub(const Code& value) const; | 2050 void set_closure_allocation_stub(const Code& value) const; |
2009 | 2051 |
2052 static intptr_t NextFieldOffset() { | |
2053 // Indicates this class cannot be extended by dart code. | |
2054 return -1; | |
2055 } | |
2010 static RawClosureData* New(); | 2056 static RawClosureData* New(); |
2011 | 2057 |
2012 FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object); | 2058 FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object); |
2013 friend class Class; | 2059 friend class Class; |
2014 friend class Function; | 2060 friend class Function; |
2015 friend class HeapProfiler; | 2061 friend class HeapProfiler; |
2016 }; | 2062 }; |
2017 | 2063 |
2018 | 2064 |
2019 class RedirectionData: public Object { | 2065 class RedirectionData: public Object { |
2020 public: | 2066 public: |
2021 static intptr_t InstanceSize() { | 2067 static intptr_t InstanceSize() { |
2022 return RoundedAllocationSize(sizeof(RawRedirectionData)); | 2068 return RoundedAllocationSize(sizeof(RawRedirectionData)); |
2023 } | 2069 } |
2024 | 2070 |
2025 private: | 2071 private: |
2026 // The type specifies the class and type arguments of the target constructor. | 2072 // The type specifies the class and type arguments of the target constructor. |
2027 RawType* type() const { return raw_ptr()->type_; } | 2073 RawType* type() const { return raw_ptr()->type_; } |
2028 void set_type(const Type& value) const; | 2074 void set_type(const Type& value) const; |
2029 | 2075 |
2030 // The optional identifier specifies a named constructor. | 2076 // The optional identifier specifies a named constructor. |
2031 RawString* identifier() const { return raw_ptr()->identifier_; } | 2077 RawString* identifier() const { return raw_ptr()->identifier_; } |
2032 void set_identifier(const String& value) const; | 2078 void set_identifier(const String& value) const; |
2033 | 2079 |
2034 // The resolved constructor or factory target of the redirection. | 2080 // The resolved constructor or factory target of the redirection. |
2035 RawFunction* target() const { return raw_ptr()->target_; } | 2081 RawFunction* target() const { return raw_ptr()->target_; } |
2036 void set_target(const Function& value) const; | 2082 void set_target(const Function& value) const; |
2037 | 2083 |
2084 static intptr_t NextFieldOffset() { | |
2085 // Indicates this class cannot be extended by dart code. | |
2086 return -1; | |
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 Loading... | |
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 -1; | |
2269 } | |
2215 static RawField* New(); | 2270 static RawField* New(); |
2216 | 2271 |
2217 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object); | 2272 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object); |
2218 friend class Class; | 2273 friend class Class; |
2219 friend class HeapProfiler; | 2274 friend class HeapProfiler; |
2220 }; | 2275 }; |
2221 | 2276 |
2222 | 2277 |
2223 class LiteralToken : public Object { | 2278 class LiteralToken : public Object { |
2224 public: | 2279 public: |
2225 Token::Kind kind() const { return raw_ptr()->kind_; } | 2280 Token::Kind kind() const { return raw_ptr()->kind_; } |
2226 RawString* literal() const { return raw_ptr()->literal_; } | 2281 RawString* literal() const { return raw_ptr()->literal_; } |
2227 RawObject* value() const { return raw_ptr()->value_; } | 2282 RawObject* value() const { return raw_ptr()->value_; } |
2228 | 2283 |
2229 static intptr_t InstanceSize() { | 2284 static intptr_t InstanceSize() { |
2230 return RoundedAllocationSize(sizeof(RawLiteralToken)); | 2285 return RoundedAllocationSize(sizeof(RawLiteralToken)); |
2231 } | 2286 } |
2232 | 2287 |
2233 static RawLiteralToken* New(); | 2288 static RawLiteralToken* New(); |
2234 static RawLiteralToken* New(Token::Kind kind, const String& literal); | 2289 static RawLiteralToken* New(Token::Kind kind, const String& literal); |
2235 | 2290 |
2236 private: | 2291 private: |
2237 void set_kind(Token::Kind kind) const { raw_ptr()->kind_ = kind; } | 2292 void set_kind(Token::Kind kind) const { raw_ptr()->kind_ = kind; } |
2238 void set_literal(const String& literal) const; | 2293 void set_literal(const String& literal) const; |
2239 void set_value(const Object& value) const; | 2294 void set_value(const Object& value) const; |
2240 | 2295 |
2296 static intptr_t NextFieldOffset() { | |
2297 // Indicates this class cannot be extended by dart code. | |
2298 return -1; | |
2299 } | |
2300 | |
2241 FINAL_HEAP_OBJECT_IMPLEMENTATION(LiteralToken, Object); | 2301 FINAL_HEAP_OBJECT_IMPLEMENTATION(LiteralToken, Object); |
2242 friend class Class; | 2302 friend class Class; |
2243 }; | 2303 }; |
2244 | 2304 |
2245 | 2305 |
2246 class TokenStream : public Object { | 2306 class TokenStream : public Object { |
2247 public: | 2307 public: |
2248 RawArray* TokenObjects() const; | 2308 RawArray* TokenObjects() const; |
2249 void SetTokenObjects(const Array& value) const; | 2309 void SetTokenObjects(const Array& value) const; |
2250 | 2310 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2314 Object& obj_; | 2374 Object& obj_; |
2315 intptr_t cur_token_pos_; | 2375 intptr_t cur_token_pos_; |
2316 Token::Kind cur_token_kind_; | 2376 Token::Kind cur_token_kind_; |
2317 intptr_t cur_token_obj_index_; | 2377 intptr_t cur_token_obj_index_; |
2318 Iterator::StreamType stream_type_; | 2378 Iterator::StreamType stream_type_; |
2319 }; | 2379 }; |
2320 | 2380 |
2321 private: | 2381 private: |
2322 void SetPrivateKey(const String& value) const; | 2382 void SetPrivateKey(const String& value) const; |
2323 | 2383 |
2384 static intptr_t NextFieldOffset() { | |
2385 // Indicates this class cannot be extended by dart code. | |
2386 return -1; | |
2387 } | |
2324 static RawTokenStream* New(); | 2388 static RawTokenStream* New(); |
2325 static void DataFinalizer(Dart_WeakPersistentHandle handle, void *peer); | 2389 static void DataFinalizer(Dart_WeakPersistentHandle handle, void *peer); |
2326 | 2390 |
2327 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); | 2391 FINAL_HEAP_OBJECT_IMPLEMENTATION(TokenStream, Object); |
2328 friend class Class; | 2392 friend class Class; |
2329 }; | 2393 }; |
2330 | 2394 |
2331 | 2395 |
2332 class Script : public Object { | 2396 class Script : public Object { |
2333 public: | 2397 public: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2371 | 2435 |
2372 static RawScript* New(const String& url, | 2436 static RawScript* New(const String& url, |
2373 const String& source, | 2437 const String& source, |
2374 RawScript::Kind kind); | 2438 RawScript::Kind kind); |
2375 | 2439 |
2376 private: | 2440 private: |
2377 void set_url(const String& value) const; | 2441 void set_url(const String& value) const; |
2378 void set_source(const String& value) const; | 2442 void set_source(const String& value) const; |
2379 void set_kind(RawScript::Kind value) const; | 2443 void set_kind(RawScript::Kind value) const; |
2380 void set_tokens(const TokenStream& value) const; | 2444 void set_tokens(const TokenStream& value) const; |
2445 | |
2446 static intptr_t NextFieldOffset() { | |
2447 // Indicates this class cannot be extended by dart code. | |
2448 return -1; | |
2449 } | |
2381 static RawScript* New(); | 2450 static RawScript* New(); |
2382 | 2451 |
2383 FINAL_HEAP_OBJECT_IMPLEMENTATION(Script, Object); | 2452 FINAL_HEAP_OBJECT_IMPLEMENTATION(Script, Object); |
2384 friend class Class; | 2453 friend class Class; |
2385 }; | 2454 }; |
2386 | 2455 |
2387 | 2456 |
2388 class DictionaryIterator : public ValueObject { | 2457 class DictionaryIterator : public ValueObject { |
2389 public: | 2458 public: |
2390 explicit DictionaryIterator(const Library& library); | 2459 explicit DictionaryIterator(const Library& library); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2585 | 2654 |
2586 | 2655 |
2587 // Return Function::null() if function does not exist in libs. | 2656 // Return Function::null() if function does not exist in libs. |
2588 static RawFunction* GetFunction(const GrowableArray<Library*>& libs, | 2657 static RawFunction* GetFunction(const GrowableArray<Library*>& libs, |
2589 const char* class_name, | 2658 const char* class_name, |
2590 const char* function_name); | 2659 const char* function_name); |
2591 | 2660 |
2592 private: | 2661 private: |
2593 static const int kInitialImportsCapacity = 4; | 2662 static const int kInitialImportsCapacity = 4; |
2594 static const int kImportsCapacityIncrement = 8; | 2663 static const int kImportsCapacityIncrement = 8; |
2664 | |
2665 static intptr_t NextFieldOffset() { | |
2666 // Indicates this class cannot be extended by dart code. | |
2667 return -1; | |
2668 } | |
2595 static RawLibrary* New(); | 2669 static RawLibrary* New(); |
2596 | 2670 |
2597 void set_num_imports(intptr_t value) const { | 2671 void set_num_imports(intptr_t value) const { |
2598 raw_ptr()->num_imports_ = value; | 2672 raw_ptr()->num_imports_ = value; |
2599 } | 2673 } |
2600 RawArray* imports() const { return raw_ptr()->imports_; } | 2674 RawArray* imports() const { return raw_ptr()->imports_; } |
2601 RawArray* exports() const { return raw_ptr()->exports_; } | 2675 RawArray* exports() const { return raw_ptr()->exports_; } |
2602 bool HasExports() const; | 2676 bool HasExports() const; |
2603 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } | 2677 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } |
2604 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } | 2678 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2647 | 2721 |
2648 static RawLibraryPrefix* New(const String& name, const Namespace& import); | 2722 static RawLibraryPrefix* New(const String& name, const Namespace& import); |
2649 | 2723 |
2650 private: | 2724 private: |
2651 static const int kInitialSize = 2; | 2725 static const int kInitialSize = 2; |
2652 static const int kIncrementSize = 2; | 2726 static const int kIncrementSize = 2; |
2653 | 2727 |
2654 void set_name(const String& value) const; | 2728 void set_name(const String& value) const; |
2655 void set_imports(const Array& value) const; | 2729 void set_imports(const Array& value) const; |
2656 void set_num_imports(intptr_t value) const; | 2730 void set_num_imports(intptr_t value) const; |
2731 | |
2732 static intptr_t NextFieldOffset() { | |
2733 // Indicates this class cannot be extended by dart code. | |
2734 return -1; | |
2735 } | |
2657 static RawLibraryPrefix* New(); | 2736 static RawLibraryPrefix* New(); |
2658 | 2737 |
2659 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); | 2738 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); |
2660 friend class Class; | 2739 friend class Class; |
2661 }; | 2740 }; |
2662 | 2741 |
2663 | 2742 |
2664 // A Namespace contains the names in a library dictionary, filtered by | 2743 // A Namespace contains the names in a library dictionary, filtered by |
2665 // the show/hide combinators. | 2744 // the show/hide combinators. |
2666 class Namespace : public Object { | 2745 class Namespace : public Object { |
2667 public: | 2746 public: |
2668 RawLibrary* library() const { return raw_ptr()->library_; } | 2747 RawLibrary* library() const { return raw_ptr()->library_; } |
2669 RawArray* show_names() const { return raw_ptr()->show_names_; } | 2748 RawArray* show_names() const { return raw_ptr()->show_names_; } |
2670 RawArray* hide_names() const { return raw_ptr()->hide_names_; } | 2749 RawArray* hide_names() const { return raw_ptr()->hide_names_; } |
2671 | 2750 |
2672 static intptr_t InstanceSize() { | 2751 static intptr_t InstanceSize() { |
2673 return RoundedAllocationSize(sizeof(RawNamespace)); | 2752 return RoundedAllocationSize(sizeof(RawNamespace)); |
2674 } | 2753 } |
2675 | 2754 |
2676 bool HidesName(const String& name) const; | 2755 bool HidesName(const String& name) const; |
2677 RawObject* Lookup(const String& name) const; | 2756 RawObject* Lookup(const String& name) const; |
2678 | 2757 |
2679 static RawNamespace* New(const Library& library, | 2758 static RawNamespace* New(const Library& library, |
2680 const Array& show_names, | 2759 const Array& show_names, |
2681 const Array& hide_names); | 2760 const Array& hide_names); |
2761 | |
2682 private: | 2762 private: |
2763 static intptr_t NextFieldOffset() { | |
2764 // Indicates this class cannot be extended by dart code. | |
2765 return -1; | |
2766 } | |
2683 static RawNamespace* New(); | 2767 static RawNamespace* New(); |
2684 | 2768 |
2685 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); | 2769 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); |
2686 friend class Class; | 2770 friend class Class; |
2687 }; | 2771 }; |
2688 | 2772 |
2689 | 2773 |
2690 class Instructions : public Object { | 2774 class Instructions : public Object { |
2691 public: | 2775 public: |
2692 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). | 2776 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2735 void set_size(intptr_t size) const { | 2819 void set_size(intptr_t size) const { |
2736 raw_ptr()->size_ = size; | 2820 raw_ptr()->size_ = size; |
2737 } | 2821 } |
2738 void set_code(RawCode* code) const { | 2822 void set_code(RawCode* code) const { |
2739 raw_ptr()->code_ = code; | 2823 raw_ptr()->code_ = code; |
2740 } | 2824 } |
2741 void set_object_pool(RawArray* object_pool) const { | 2825 void set_object_pool(RawArray* object_pool) const { |
2742 StorePointer(&raw_ptr()->object_pool_, object_pool); | 2826 StorePointer(&raw_ptr()->object_pool_, object_pool); |
2743 } | 2827 } |
2744 | 2828 |
2829 static intptr_t NextFieldOffset() { | |
2830 // Indicates this class cannot be extended by dart code. | |
2831 return -1; | |
2832 } | |
2745 // New is a private method as RawInstruction and RawCode objects should | 2833 // New is a private method as RawInstruction and RawCode objects should |
2746 // only be created using the Code::FinalizeCode method. This method creates | 2834 // only be created using the Code::FinalizeCode method. This method creates |
2747 // the RawInstruction and RawCode objects, sets up the pointer offsets | 2835 // the RawInstruction and RawCode objects, sets up the pointer offsets |
2748 // and links the two in a GC safe manner. | 2836 // and links the two in a GC safe manner. |
2749 static RawInstructions* New(intptr_t size); | 2837 static RawInstructions* New(intptr_t size); |
2750 | 2838 |
2751 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object); | 2839 FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object); |
2752 friend class Class; | 2840 friend class Class; |
2753 friend class Code; | 2841 friend class Code; |
2754 }; | 2842 }; |
(...skipping 22 matching lines...) Expand all Loading... | |
2777 } | 2865 } |
2778 static intptr_t InstanceSize(intptr_t len) { | 2866 static intptr_t InstanceSize(intptr_t len) { |
2779 ASSERT(0 <= len && len <= kMaxElements); | 2867 ASSERT(0 <= len && len <= kMaxElements); |
2780 return RoundedAllocationSize( | 2868 return RoundedAllocationSize( |
2781 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); | 2869 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); |
2782 } | 2870 } |
2783 | 2871 |
2784 static RawLocalVarDescriptors* New(intptr_t num_variables); | 2872 static RawLocalVarDescriptors* New(intptr_t num_variables); |
2785 | 2873 |
2786 private: | 2874 private: |
2875 static intptr_t NextFieldOffset() { | |
2876 // Indicates this class cannot be extended by dart code. | |
2877 return -1; | |
2878 } | |
2787 FINAL_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object); | 2879 FINAL_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object); |
2788 friend class Class; | 2880 friend class Class; |
2789 }; | 2881 }; |
2790 | 2882 |
2791 | 2883 |
2792 class PcDescriptors : public Object { | 2884 class PcDescriptors : public Object { |
2793 private: | 2885 private: |
2794 // Describes the layout of PC descriptor data. | 2886 // Describes the layout of PC descriptor data. |
2795 enum { | 2887 enum { |
2796 kPcEntry = 0, // PC value of the descriptor, unique. | 2888 kPcEntry = 0, // PC value of the descriptor, unique. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2878 | 2970 |
2879 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { | 2971 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { |
2880 ASSERT((index >=0) && (index < Length())); | 2972 ASSERT((index >=0) && (index < Length())); |
2881 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; | 2973 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; |
2882 return &raw_ptr()->data_[data_index]; | 2974 return &raw_ptr()->data_[data_index]; |
2883 } | 2975 } |
2884 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const { | 2976 RawSmi** SmiAddr(intptr_t index, intptr_t entry_offset) const { |
2885 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset)); | 2977 return reinterpret_cast<RawSmi**>(EntryAddr(index, entry_offset)); |
2886 } | 2978 } |
2887 | 2979 |
2980 static intptr_t NextFieldOffset() { | |
2981 // Indicates this class cannot be extended by dart code. | |
2982 return -1; | |
2983 } | |
2984 | |
2888 FINAL_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); | 2985 FINAL_HEAP_OBJECT_IMPLEMENTATION(PcDescriptors, Object); |
2889 friend class Class; | 2986 friend class Class; |
2890 }; | 2987 }; |
2891 | 2988 |
2892 | 2989 |
2893 class Stackmap : public Object { | 2990 class Stackmap : public Object { |
2894 public: | 2991 public: |
2895 static const intptr_t kNoMaximum = -1; | 2992 static const intptr_t kNoMaximum = -1; |
2896 static const intptr_t kNoMinimum = -1; | 2993 static const intptr_t kNoMinimum = -1; |
2897 | 2994 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2931 intptr_t register_bit_count); | 3028 intptr_t register_bit_count); |
2932 | 3029 |
2933 private: | 3030 private: |
2934 void SetLength(intptr_t length) const { raw_ptr()->length_ = length; } | 3031 void SetLength(intptr_t length) const { raw_ptr()->length_ = length; } |
2935 | 3032 |
2936 bool InRange(intptr_t index) const { return index < Length(); } | 3033 bool InRange(intptr_t index) const { return index < Length(); } |
2937 | 3034 |
2938 bool GetBit(intptr_t bit_index) const; | 3035 bool GetBit(intptr_t bit_index) const; |
2939 void SetBit(intptr_t bit_index, bool value) const; | 3036 void SetBit(intptr_t bit_index, bool value) const; |
2940 | 3037 |
3038 static intptr_t NextFieldOffset() { | |
3039 // Indicates this class cannot be extended by dart code. | |
3040 return -1; | |
3041 } | |
3042 | |
2941 FINAL_HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); | 3043 FINAL_HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); |
2942 friend class BitmapBuilder; | 3044 friend class BitmapBuilder; |
2943 friend class Class; | 3045 friend class Class; |
2944 }; | 3046 }; |
2945 | 3047 |
2946 | 3048 |
2947 class ExceptionHandlers : public Object { | 3049 class ExceptionHandlers : public Object { |
2948 public: | 3050 public: |
2949 intptr_t Length() const; | 3051 intptr_t Length() const; |
2950 | 3052 |
(...skipping 30 matching lines...) Expand all Loading... | |
2981 // We would have a VisitPointers function here to traverse the | 3083 // We would have a VisitPointers function here to traverse the |
2982 // exception handler table to visit objects if any in the table. | 3084 // exception handler table to visit objects if any in the table. |
2983 | 3085 |
2984 private: | 3086 private: |
2985 // Pick somewhat arbitrary maximum number of exception handlers | 3087 // Pick somewhat arbitrary maximum number of exception handlers |
2986 // for a function. This value is used to catch potentially | 3088 // for a function. This value is used to catch potentially |
2987 // malicious code. | 3089 // malicious code. |
2988 static const intptr_t kMaxHandlers = 1024 * 1024; | 3090 static const intptr_t kMaxHandlers = 1024 * 1024; |
2989 | 3091 |
2990 void set_handled_types_data(const Array& value) const; | 3092 void set_handled_types_data(const Array& value) const; |
3093 | |
3094 static intptr_t NextFieldOffset() { | |
3095 // Indicates this class cannot be extended by dart code. | |
3096 return -1; | |
3097 } | |
3098 | |
2991 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object); | 3099 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object); |
2992 friend class Class; | 3100 friend class Class; |
2993 }; | 3101 }; |
2994 | 3102 |
2995 | 3103 |
2996 // Holds deopt information at one deoptimization point. The information consists | 3104 // Holds deopt information at one deoptimization point. The information consists |
2997 // of two parts: | 3105 // of two parts: |
2998 // - first a prefix consiting of kMaterializeObject instructions describing | 3106 // - first a prefix consiting of kMaterializeObject instructions describing |
2999 // objects which had their allocation removed as part of AllocationSinking | 3107 // objects which had their allocation removed as part of AllocationSinking |
3000 // pass and have to be materialized; | 3108 // pass and have to be materialized; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3066 | 3174 |
3067 private: | 3175 private: |
3068 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { | 3176 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { |
3069 ASSERT((index >=0) && (index < Length())); | 3177 ASSERT((index >=0) && (index < Length())); |
3070 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; | 3178 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; |
3071 return &raw_ptr()->data_[data_index]; | 3179 return &raw_ptr()->data_[data_index]; |
3072 } | 3180 } |
3073 | 3181 |
3074 void SetLength(intptr_t value) const; | 3182 void SetLength(intptr_t value) const; |
3075 | 3183 |
3184 static intptr_t NextFieldOffset() { | |
3185 // Indicates this class cannot be extended by dart code. | |
3186 return -1; | |
3187 } | |
3188 | |
3076 FINAL_HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object); | 3189 FINAL_HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object); |
3077 friend class Class; | 3190 friend class Class; |
3078 }; | 3191 }; |
3079 | 3192 |
3080 | 3193 |
3081 class Code : public Object { | 3194 class Code : public Object { |
3082 public: | 3195 public: |
3083 RawInstructions* instructions() const { return raw_ptr()->instructions_; } | 3196 RawInstructions* instructions() const { return raw_ptr()->instructions_; } |
3084 static intptr_t instructions_offset() { | 3197 static intptr_t instructions_offset() { |
3085 return OFFSET_OF(RawCode, instructions_); | 3198 return OFFSET_OF(RawCode, instructions_); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3312 ASSERT(index < pointer_offsets_length()); | 3425 ASSERT(index < pointer_offsets_length()); |
3313 // TODO(iposva): Unit test is missing for this functionality. | 3426 // TODO(iposva): Unit test is missing for this functionality. |
3314 return &raw_ptr()->data_[index]; | 3427 return &raw_ptr()->data_[index]; |
3315 } | 3428 } |
3316 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { | 3429 void SetPointerOffsetAt(int index, int32_t offset_in_instructions) { |
3317 *PointerOffsetAddrAt(index) = offset_in_instructions; | 3430 *PointerOffsetAddrAt(index) = offset_in_instructions; |
3318 } | 3431 } |
3319 | 3432 |
3320 intptr_t BinarySearchInSCallTable(uword pc) const; | 3433 intptr_t BinarySearchInSCallTable(uword pc) const; |
3321 | 3434 |
3435 static intptr_t NextFieldOffset() { | |
3436 // Indicates this class cannot be extended by dart code. | |
3437 return -1; | |
3438 } | |
3439 | |
3322 // New is a private method as RawInstruction and RawCode objects should | 3440 // New is a private method as RawInstruction and RawCode objects should |
3323 // only be created using the Code::FinalizeCode method. This method creates | 3441 // only be created using the Code::FinalizeCode method. This method creates |
3324 // the RawInstruction and RawCode objects, sets up the pointer offsets | 3442 // the RawInstruction and RawCode objects, sets up the pointer offsets |
3325 // and links the two in a GC safe manner. | 3443 // and links the two in a GC safe manner. |
3326 static RawCode* New(intptr_t pointer_offsets_length); | 3444 static RawCode* New(intptr_t pointer_offsets_length); |
3327 | 3445 |
3328 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object); | 3446 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object); |
3329 friend class Class; | 3447 friend class Class; |
3330 }; | 3448 }; |
3331 | 3449 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3379 } | 3497 } |
3380 | 3498 |
3381 void set_isolate(Isolate* isolate) const { | 3499 void set_isolate(Isolate* isolate) const { |
3382 raw_ptr()->isolate_ = isolate; | 3500 raw_ptr()->isolate_ = isolate; |
3383 } | 3501 } |
3384 | 3502 |
3385 void set_num_variables(intptr_t num_variables) const { | 3503 void set_num_variables(intptr_t num_variables) const { |
3386 raw_ptr()->num_variables_ = num_variables; | 3504 raw_ptr()->num_variables_ = num_variables; |
3387 } | 3505 } |
3388 | 3506 |
3507 static intptr_t NextFieldOffset() { | |
3508 // Indicates this class cannot be extended by dart code. | |
3509 return -1; | |
3510 } | |
3511 | |
3389 FINAL_HEAP_OBJECT_IMPLEMENTATION(Context, Object); | 3512 FINAL_HEAP_OBJECT_IMPLEMENTATION(Context, Object); |
3390 friend class Class; | 3513 friend class Class; |
3391 }; | 3514 }; |
3392 | 3515 |
3393 | 3516 |
3394 // The ContextScope class makes it possible to delay the compilation of a local | 3517 // 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 | 3518 // 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 | 3519 // 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) | 3520 // 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 | 3521 // functions enclosing the local function. Each captured variable is represented |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3451 } | 3574 } |
3452 | 3575 |
3453 RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const { | 3576 RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const { |
3454 ASSERT((index >= 0) && (index < num_variables())); | 3577 ASSERT((index >= 0) && (index < num_variables())); |
3455 uword raw_addr = reinterpret_cast<uword>(raw_ptr()); | 3578 uword raw_addr = reinterpret_cast<uword>(raw_ptr()); |
3456 raw_addr += sizeof(RawContextScope) + | 3579 raw_addr += sizeof(RawContextScope) + |
3457 (index * sizeof(RawContextScope::VariableDesc)); | 3580 (index * sizeof(RawContextScope::VariableDesc)); |
3458 return reinterpret_cast<RawContextScope::VariableDesc*>(raw_addr); | 3581 return reinterpret_cast<RawContextScope::VariableDesc*>(raw_addr); |
3459 } | 3582 } |
3460 | 3583 |
3584 static intptr_t NextFieldOffset() { | |
3585 // Indicates this class cannot be extended by dart code. | |
3586 return -1; | |
3587 } | |
3588 | |
3461 FINAL_HEAP_OBJECT_IMPLEMENTATION(ContextScope, Object); | 3589 FINAL_HEAP_OBJECT_IMPLEMENTATION(ContextScope, Object); |
3462 friend class Class; | 3590 friend class Class; |
3463 }; | 3591 }; |
3464 | 3592 |
3465 | 3593 |
3466 // Object holding information about an IC: test classes and their | 3594 // Object holding information about an IC: test classes and their |
3467 // corresponding targets. | 3595 // corresponding targets. |
3468 class ICData : public Object { | 3596 class ICData : public Object { |
3469 public: | 3597 public: |
3470 RawFunction* function() const { | 3598 RawFunction* function() const { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3608 void set_ic_data(const Array& value) const; | 3736 void set_ic_data(const Array& value) const; |
3609 | 3737 |
3610 #if defined(DEBUG) | 3738 #if defined(DEBUG) |
3611 // Used in asserts to verify that a check is not added twice. | 3739 // Used in asserts to verify that a check is not added twice. |
3612 bool HasCheck(const GrowableArray<intptr_t>& cids) const; | 3740 bool HasCheck(const GrowableArray<intptr_t>& cids) const; |
3613 #endif // DEBUG | 3741 #endif // DEBUG |
3614 | 3742 |
3615 intptr_t TestEntryLength() const; | 3743 intptr_t TestEntryLength() const; |
3616 void WriteSentinel(const Array& data) const; | 3744 void WriteSentinel(const Array& data) const; |
3617 | 3745 |
3746 static intptr_t NextFieldOffset() { | |
3747 // Indicates this class cannot be extended by dart code. | |
3748 return -1; | |
3749 } | |
3750 | |
3618 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object); | 3751 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object); |
3619 friend class Class; | 3752 friend class Class; |
3620 }; | 3753 }; |
3621 | 3754 |
3622 | 3755 |
3623 class MegamorphicCache : public Object { | 3756 class MegamorphicCache : public Object { |
3624 public: | 3757 public: |
3625 static const int kInitialCapacity = 16; | 3758 static const int kInitialCapacity = 16; |
3626 static const double kLoadFactor; | 3759 static const double kLoadFactor; |
3627 | 3760 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3662 | 3795 |
3663 static inline void SetEntry(const Array& array, | 3796 static inline void SetEntry(const Array& array, |
3664 intptr_t index, | 3797 intptr_t index, |
3665 const Smi& class_id, | 3798 const Smi& class_id, |
3666 const Function& target); | 3799 const Function& target); |
3667 | 3800 |
3668 static inline RawObject* GetClassId(const Array& array, intptr_t index); | 3801 static inline RawObject* GetClassId(const Array& array, intptr_t index); |
3669 static inline RawObject* GetTargetFunction(const Array& array, | 3802 static inline RawObject* GetTargetFunction(const Array& array, |
3670 intptr_t index); | 3803 intptr_t index); |
3671 | 3804 |
3805 static intptr_t NextFieldOffset() { | |
3806 // Indicates this class cannot be extended by dart code. | |
3807 return -1; | |
3808 } | |
3809 | |
3672 FINAL_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache, Object); | 3810 FINAL_HEAP_OBJECT_IMPLEMENTATION(MegamorphicCache, Object); |
3673 }; | 3811 }; |
3674 | 3812 |
3675 | 3813 |
3676 class SubtypeTestCache : public Object { | 3814 class SubtypeTestCache : public Object { |
3677 public: | 3815 public: |
3678 enum Entries { | 3816 enum Entries { |
3679 kInstanceClassId = 0, | 3817 kInstanceClassId = 0, |
3680 kInstanceTypeArguments = 1, | 3818 kInstanceTypeArguments = 1, |
3681 kInstantiatorTypeArguments = 2, | 3819 kInstantiatorTypeArguments = 2, |
(...skipping 24 matching lines...) Expand all Loading... | |
3706 | 3844 |
3707 private: | 3845 private: |
3708 RawArray* cache() const { | 3846 RawArray* cache() const { |
3709 return raw_ptr()->cache_; | 3847 return raw_ptr()->cache_; |
3710 } | 3848 } |
3711 | 3849 |
3712 void set_cache(const Array& value) const; | 3850 void set_cache(const Array& value) const; |
3713 | 3851 |
3714 intptr_t TestEntryLength() const; | 3852 intptr_t TestEntryLength() const; |
3715 | 3853 |
3854 static intptr_t NextFieldOffset() { | |
3855 // Indicates this class cannot be extended by dart code. | |
3856 return -1; | |
3857 } | |
3858 | |
3716 FINAL_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache, Object); | 3859 FINAL_HEAP_OBJECT_IMPLEMENTATION(SubtypeTestCache, Object); |
3717 friend class Class; | 3860 friend class Class; |
3718 }; | 3861 }; |
3719 | 3862 |
3720 | 3863 |
3721 class Error : public Object { | 3864 class Error : public Object { |
3722 public: | 3865 public: |
3723 virtual const char* ToErrorCString() const; | 3866 virtual const char* ToErrorCString() const; |
3724 | 3867 |
3725 private: | 3868 private: |
(...skipping 12 matching lines...) Expand all Loading... | |
3738 return RoundedAllocationSize(sizeof(RawApiError)); | 3881 return RoundedAllocationSize(sizeof(RawApiError)); |
3739 } | 3882 } |
3740 | 3883 |
3741 static RawApiError* New(const String& message, | 3884 static RawApiError* New(const String& message, |
3742 Heap::Space space = Heap::kNew); | 3885 Heap::Space space = Heap::kNew); |
3743 | 3886 |
3744 virtual const char* ToErrorCString() const; | 3887 virtual const char* ToErrorCString() const; |
3745 | 3888 |
3746 private: | 3889 private: |
3747 void set_message(const String& message) const; | 3890 void set_message(const String& message) const; |
3891 | |
3892 static intptr_t NextFieldOffset() { | |
3893 // Indicates this class cannot be extended by dart code. | |
3894 return -1; | |
3895 } | |
3748 static RawApiError* New(); | 3896 static RawApiError* New(); |
3749 | 3897 |
3750 FINAL_HEAP_OBJECT_IMPLEMENTATION(ApiError, Error); | 3898 FINAL_HEAP_OBJECT_IMPLEMENTATION(ApiError, Error); |
3751 friend class Class; | 3899 friend class Class; |
3752 }; | 3900 }; |
3753 | 3901 |
3754 | 3902 |
3755 class LanguageError : public Error { | 3903 class LanguageError : public Error { |
3756 public: | 3904 public: |
3757 RawString* message() const { return raw_ptr()->message_; } | 3905 RawString* message() const { return raw_ptr()->message_; } |
3758 static intptr_t message_offset() { | 3906 static intptr_t message_offset() { |
3759 return OFFSET_OF(RawLanguageError, message_); | 3907 return OFFSET_OF(RawLanguageError, message_); |
3760 } | 3908 } |
3761 | 3909 |
3762 static intptr_t InstanceSize() { | 3910 static intptr_t InstanceSize() { |
3763 return RoundedAllocationSize(sizeof(RawLanguageError)); | 3911 return RoundedAllocationSize(sizeof(RawLanguageError)); |
3764 } | 3912 } |
3765 | 3913 |
3766 static RawLanguageError* New(const String& message, | 3914 static RawLanguageError* New(const String& message, |
3767 Heap::Space space = Heap::kNew); | 3915 Heap::Space space = Heap::kNew); |
3768 | 3916 |
3769 virtual const char* ToErrorCString() const; | 3917 virtual const char* ToErrorCString() const; |
3770 | 3918 |
3771 private: | 3919 private: |
3772 void set_message(const String& message) const; | 3920 void set_message(const String& message) const; |
3921 | |
3922 static intptr_t NextFieldOffset() { | |
3923 // Indicates this class cannot be extended by dart code. | |
3924 return -1; | |
3925 } | |
3773 static RawLanguageError* New(); | 3926 static RawLanguageError* New(); |
3774 | 3927 |
3775 FINAL_HEAP_OBJECT_IMPLEMENTATION(LanguageError, Error); | 3928 FINAL_HEAP_OBJECT_IMPLEMENTATION(LanguageError, Error); |
3776 friend class Class; | 3929 friend class Class; |
3777 }; | 3930 }; |
3778 | 3931 |
3779 | 3932 |
3780 class UnhandledException : public Error { | 3933 class UnhandledException : public Error { |
3781 public: | 3934 public: |
3782 RawInstance* exception() const { return raw_ptr()->exception_; } | 3935 RawInstance* exception() const { return raw_ptr()->exception_; } |
(...skipping 13 matching lines...) Expand all Loading... | |
3796 static RawUnhandledException* New(const Instance& exception, | 3949 static RawUnhandledException* New(const Instance& exception, |
3797 const Instance& stacktrace, | 3950 const Instance& stacktrace, |
3798 Heap::Space space = Heap::kNew); | 3951 Heap::Space space = Heap::kNew); |
3799 | 3952 |
3800 virtual const char* ToErrorCString() const; | 3953 virtual const char* ToErrorCString() const; |
3801 | 3954 |
3802 private: | 3955 private: |
3803 void set_exception(const Instance& exception) const; | 3956 void set_exception(const Instance& exception) const; |
3804 void set_stacktrace(const Instance& stacktrace) const; | 3957 void set_stacktrace(const Instance& stacktrace) const; |
3805 | 3958 |
3959 static intptr_t NextFieldOffset() { | |
3960 // Indicates this class cannot be extended by dart code. | |
3961 return -1; | |
3962 } | |
3963 | |
3806 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnhandledException, Error); | 3964 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnhandledException, Error); |
3807 friend class Class; | 3965 friend class Class; |
3808 }; | 3966 }; |
3809 | 3967 |
3810 | 3968 |
3811 class UnwindError : public Error { | 3969 class UnwindError : public Error { |
3812 public: | 3970 public: |
3813 RawString* message() const { return raw_ptr()->message_; } | 3971 RawString* message() const { return raw_ptr()->message_; } |
3814 static intptr_t message_offset() { | 3972 static intptr_t message_offset() { |
3815 return OFFSET_OF(RawUnwindError, message_); | 3973 return OFFSET_OF(RawUnwindError, message_); |
3816 } | 3974 } |
3817 | 3975 |
3818 static intptr_t InstanceSize() { | 3976 static intptr_t InstanceSize() { |
3819 return RoundedAllocationSize(sizeof(RawUnwindError)); | 3977 return RoundedAllocationSize(sizeof(RawUnwindError)); |
3820 } | 3978 } |
3821 | 3979 |
3822 static RawUnwindError* New(const String& message, | 3980 static RawUnwindError* New(const String& message, |
3823 Heap::Space space = Heap::kNew); | 3981 Heap::Space space = Heap::kNew); |
3824 | 3982 |
3825 virtual const char* ToErrorCString() const; | 3983 virtual const char* ToErrorCString() const; |
3826 | 3984 |
3827 private: | 3985 private: |
3828 void set_message(const String& message) const; | 3986 void set_message(const String& message) const; |
3829 | 3987 |
3988 static intptr_t NextFieldOffset() { | |
3989 // Indicates this class cannot be extended by dart code. | |
3990 return -1; | |
3991 } | |
3992 | |
3830 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnwindError, Error); | 3993 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnwindError, Error); |
3831 friend class Class; | 3994 friend class Class; |
3832 }; | 3995 }; |
3833 | 3996 |
3834 | 3997 |
3835 // Instance is the base class for all instance objects (aka the Object class | 3998 // Instance is the base class for all instance objects (aka the Object class |
3836 // in Dart source code. | 3999 // in Dart source code. |
3837 class Instance : public Object { | 4000 class Instance : public Object { |
3838 public: | 4001 public: |
3839 virtual bool Equals(const Instance& other) const; | 4002 virtual bool Equals(const Instance& other) const; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3906 return FieldAddrAtOffset(field.Offset()); | 4069 return FieldAddrAtOffset(field.Offset()); |
3907 } | 4070 } |
3908 RawObject** NativeFieldsAddr() const { | 4071 RawObject** NativeFieldsAddr() const { |
3909 return FieldAddrAtOffset(sizeof(RawObject)); | 4072 return FieldAddrAtOffset(sizeof(RawObject)); |
3910 } | 4073 } |
3911 void SetFieldAtOffset(intptr_t offset, const Object& value) const { | 4074 void SetFieldAtOffset(intptr_t offset, const Object& value) const { |
3912 StorePointer(FieldAddrAtOffset(offset), value.raw()); | 4075 StorePointer(FieldAddrAtOffset(offset), value.raw()); |
3913 } | 4076 } |
3914 bool IsValidFieldOffset(int offset) const; | 4077 bool IsValidFieldOffset(int offset) const; |
3915 | 4078 |
4079 static intptr_t NextFieldOffset() { | |
4080 return sizeof(RawInstance); | |
4081 } | |
4082 | |
3916 // TODO(iposva): Determine if this gets in the way of Smi. | 4083 // TODO(iposva): Determine if this gets in the way of Smi. |
3917 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); | 4084 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); |
3918 friend class Class; | 4085 friend class Class; |
3919 friend class Closure; | 4086 friend class Closure; |
4087 friend class SnapshotWriter; | |
4088 friend class StubCode; | |
3920 friend class TypedDataView; | 4089 friend class TypedDataView; |
3921 }; | 4090 }; |
3922 | 4091 |
3923 | 4092 |
3924 // AbstractType is an abstract superclass. | 4093 // AbstractType is an abstract superclass. |
3925 // Subclasses of AbstractType are Type and TypeParameter. | 4094 // Subclasses of AbstractType are Type and TypeParameter. |
3926 class AbstractType : public Instance { | 4095 class AbstractType : public Instance { |
3927 public: | 4096 public: |
3928 virtual bool IsFinalized() const; | 4097 virtual bool IsFinalized() const; |
3929 virtual bool IsBeingFinalized() const; | 4098 virtual bool IsBeingFinalized() const; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4149 | 4318 |
4150 static RawType* New(const Object& clazz, | 4319 static RawType* New(const Object& clazz, |
4151 const AbstractTypeArguments& arguments, | 4320 const AbstractTypeArguments& arguments, |
4152 intptr_t token_pos, | 4321 intptr_t token_pos, |
4153 Heap::Space space = Heap::kOld); | 4322 Heap::Space space = Heap::kOld); |
4154 | 4323 |
4155 private: | 4324 private: |
4156 void set_token_pos(intptr_t token_pos) const; | 4325 void set_token_pos(intptr_t token_pos) const; |
4157 void set_type_state(int8_t state) const; | 4326 void set_type_state(int8_t state) const; |
4158 | 4327 |
4328 static intptr_t NextFieldOffset() { | |
4329 // Indicates this class cannot be extended by dart code. | |
4330 return -1; | |
4331 } | |
Ivan Posva
2013/11/02 00:25:55
Doesn't this correspond to the Dart class Type, wh
siva
2013/11/02 03:45:00
Done.
| |
4159 static RawType* New(Heap::Space space = Heap::kOld); | 4332 static RawType* New(Heap::Space space = Heap::kOld); |
4160 | 4333 |
4161 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType); | 4334 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType); |
4162 friend class Class; | 4335 friend class Class; |
4163 }; | 4336 }; |
4164 | 4337 |
4165 | 4338 |
4166 // A TypeParameter represents a type parameter of a parameterized class. | 4339 // 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 | 4340 // It specifies its index (and its name for debugging purposes), as well as its |
4168 // upper bound. | 4341 // upper bound. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4218 intptr_t index, | 4391 intptr_t index, |
4219 const String& name, | 4392 const String& name, |
4220 const AbstractType& bound, | 4393 const AbstractType& bound, |
4221 intptr_t token_pos); | 4394 intptr_t token_pos); |
4222 | 4395 |
4223 private: | 4396 private: |
4224 void set_parameterized_class(const Class& value) const; | 4397 void set_parameterized_class(const Class& value) const; |
4225 void set_name(const String& value) const; | 4398 void set_name(const String& value) const; |
4226 void set_token_pos(intptr_t token_pos) const; | 4399 void set_token_pos(intptr_t token_pos) const; |
4227 void set_type_state(int8_t state) const; | 4400 void set_type_state(int8_t state) const; |
4401 | |
4402 static intptr_t NextFieldOffset() { | |
4403 // Indicates this class cannot be extended by dart code. | |
4404 return -1; | |
4405 } | |
4228 static RawTypeParameter* New(); | 4406 static RawTypeParameter* New(); |
4229 | 4407 |
4230 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType); | 4408 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType); |
4231 friend class Class; | 4409 friend class Class; |
4232 }; | 4410 }; |
4233 | 4411 |
4234 | 4412 |
4235 // A BoundedType represents a type instantiated at compile time from a type | 4413 // 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 | 4414 // 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 | 4415 // 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 Loading... | |
4294 private: | 4472 private: |
4295 void set_type(const AbstractType& value) const; | 4473 void set_type(const AbstractType& value) const; |
4296 void set_bound(const AbstractType& value) const; | 4474 void set_bound(const AbstractType& value) const; |
4297 void set_type_parameter(const TypeParameter& value) const; | 4475 void set_type_parameter(const TypeParameter& value) const; |
4298 | 4476 |
4299 bool is_being_checked() const { | 4477 bool is_being_checked() const { |
4300 return raw_ptr()->is_being_checked_; | 4478 return raw_ptr()->is_being_checked_; |
4301 } | 4479 } |
4302 void set_is_being_checked(bool value) const; | 4480 void set_is_being_checked(bool value) const; |
4303 | 4481 |
4482 static intptr_t NextFieldOffset() { | |
4483 // Indicates this class cannot be extended by dart code. | |
4484 return -1; | |
4485 } | |
4304 static RawBoundedType* New(); | 4486 static RawBoundedType* New(); |
4305 | 4487 |
4306 FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType); | 4488 FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType); |
4307 friend class Class; | 4489 friend class Class; |
4308 }; | 4490 }; |
4309 | 4491 |
4310 | 4492 |
4311 // A MixinAppType represents a parsed mixin application clause, e.g. | 4493 // A MixinAppType represents a parsed mixin application clause, e.g. |
4312 // "S<T> with M<U>, N<V>". | 4494 // "S<T> with M<U>, N<V>". |
4313 // MixinAppType objects do not survive finalization, so they do not | 4495 // MixinAppType objects do not survive finalization, so they do not |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4345 | 4527 |
4346 static RawMixinAppType* New(const AbstractType& super_type, | 4528 static RawMixinAppType* New(const AbstractType& super_type, |
4347 const Array& mixin_types); | 4529 const Array& mixin_types); |
4348 | 4530 |
4349 private: | 4531 private: |
4350 void set_super_type(const AbstractType& value) const; | 4532 void set_super_type(const AbstractType& value) const; |
4351 | 4533 |
4352 RawArray* mixin_types() const { return raw_ptr()->mixin_types_; } | 4534 RawArray* mixin_types() const { return raw_ptr()->mixin_types_; } |
4353 void set_mixin_types(const Array& value) const; | 4535 void set_mixin_types(const Array& value) const; |
4354 | 4536 |
4537 static intptr_t NextFieldOffset() { | |
4538 // Indicates this class cannot be extended by dart code. | |
4539 return -1; | |
4540 } | |
4355 static RawMixinAppType* New(); | 4541 static RawMixinAppType* New(); |
4356 | 4542 |
4357 FINAL_HEAP_OBJECT_IMPLEMENTATION(MixinAppType, AbstractType); | 4543 FINAL_HEAP_OBJECT_IMPLEMENTATION(MixinAppType, AbstractType); |
4358 friend class Class; | 4544 friend class Class; |
4359 }; | 4545 }; |
4360 | 4546 |
4361 | 4547 |
4362 class Number : public Instance { | 4548 class Number : public Instance { |
4363 public: | 4549 public: |
4364 // TODO(iposva): Fill in a useful Number interface. | 4550 // TODO(iposva): Fill in a useful Number interface. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4471 void operator=(RawSmi* value) { | 4657 void operator=(RawSmi* value) { |
4472 raw_ = value; | 4658 raw_ = value; |
4473 CHECK_HANDLE(); | 4659 CHECK_HANDLE(); |
4474 } | 4660 } |
4475 void operator^=(RawObject* value) { | 4661 void operator^=(RawObject* value) { |
4476 raw_ = value; | 4662 raw_ = value; |
4477 CHECK_HANDLE(); | 4663 CHECK_HANDLE(); |
4478 } | 4664 } |
4479 | 4665 |
4480 private: | 4666 private: |
4667 static intptr_t NextFieldOffset() { | |
4668 // Indicates this class cannot be extended by dart code. | |
4669 return -1; | |
4670 } | |
4481 static intptr_t ValueFromRaw(uword raw_value) { | 4671 static intptr_t ValueFromRaw(uword raw_value) { |
4482 intptr_t value = raw_value; | 4672 intptr_t value = raw_value; |
4483 ASSERT((value & kSmiTagMask) == kSmiTag); | 4673 ASSERT((value & kSmiTagMask) == kSmiTag); |
4484 return (value >> kSmiTagShift); | 4674 return (value >> kSmiTagShift); |
4485 } | 4675 } |
4486 static cpp_vtable handle_vtable_; | 4676 static cpp_vtable handle_vtable_; |
4487 | 4677 |
4488 Smi() : Integer() {} | 4678 Smi() : Integer() {} |
4489 BASE_OBJECT_IMPLEMENTATION(Smi, Integer); | 4679 BASE_OBJECT_IMPLEMENTATION(Smi, Integer); |
4490 | 4680 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4529 // Only Integer::NewXXX is allowed to call Mint::NewXXX directly. | 4719 // Only Integer::NewXXX is allowed to call Mint::NewXXX directly. |
4530 friend class Integer; | 4720 friend class Integer; |
4531 | 4721 |
4532 static RawMint* New(int64_t value, Heap::Space space = Heap::kNew); | 4722 static RawMint* New(int64_t value, Heap::Space space = Heap::kNew); |
4533 | 4723 |
4534 static RawMint* NewCanonical(int64_t value); | 4724 static RawMint* NewCanonical(int64_t value); |
4535 | 4725 |
4536 private: | 4726 private: |
4537 void set_value(int64_t value) const; | 4727 void set_value(int64_t value) const; |
4538 | 4728 |
4729 static intptr_t NextFieldOffset() { | |
4730 // Indicates this class cannot be extended by dart code. | |
4731 return -1; | |
4732 } | |
4733 | |
4539 FINAL_HEAP_OBJECT_IMPLEMENTATION(Mint, Integer); | 4734 FINAL_HEAP_OBJECT_IMPLEMENTATION(Mint, Integer); |
4540 friend class Class; | 4735 friend class Class; |
4541 }; | 4736 }; |
4542 | 4737 |
4543 | 4738 |
4544 class Bigint : public Integer { | 4739 class Bigint : public Integer { |
4545 private: | 4740 private: |
4546 typedef uint32_t Chunk; | 4741 typedef uint32_t Chunk; |
4547 typedef uint64_t DoubleChunk; | 4742 typedef uint64_t DoubleChunk; |
4548 static const int kChunkSize = sizeof(Chunk); | 4743 static const int kChunkSize = sizeof(Chunk); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4612 raw_ptr()->signed_length_ = -raw_ptr()->signed_length_; | 4807 raw_ptr()->signed_length_ = -raw_ptr()->signed_length_; |
4613 } | 4808 } |
4614 | 4809 |
4615 Chunk* ChunkAddr(intptr_t index) const { | 4810 Chunk* ChunkAddr(intptr_t index) const { |
4616 ASSERT(0 <= index); | 4811 ASSERT(0 <= index); |
4617 ASSERT(index < Length()); | 4812 ASSERT(index < Length()); |
4618 uword digits_start = reinterpret_cast<uword>(raw_ptr()) + sizeof(RawBigint); | 4813 uword digits_start = reinterpret_cast<uword>(raw_ptr()) + sizeof(RawBigint); |
4619 return &(reinterpret_cast<Chunk*>(digits_start)[index]); | 4814 return &(reinterpret_cast<Chunk*>(digits_start)[index]); |
4620 } | 4815 } |
4621 | 4816 |
4817 static intptr_t NextFieldOffset() { | |
4818 // Indicates this class cannot be extended by dart code. | |
4819 return -1; | |
4820 } | |
4622 static RawBigint* Allocate(intptr_t length, Heap::Space space = Heap::kNew); | 4821 static RawBigint* Allocate(intptr_t length, Heap::Space space = Heap::kNew); |
4623 | 4822 |
4624 FINAL_HEAP_OBJECT_IMPLEMENTATION(Bigint, Integer); | 4823 FINAL_HEAP_OBJECT_IMPLEMENTATION(Bigint, Integer); |
4625 friend class BigintOperations; | 4824 friend class BigintOperations; |
4626 friend class Class; | 4825 friend class Class; |
4627 }; | 4826 }; |
4628 | 4827 |
4629 | 4828 |
4630 // Class Double represents class Double in corelib_impl, which implements | 4829 // Class Double represents class Double in corelib_impl, which implements |
4631 // abstract class double in corelib. | 4830 // abstract class double in corelib. |
(...skipping 20 matching lines...) Expand all Loading... | |
4652 | 4851 |
4653 static intptr_t InstanceSize() { | 4852 static intptr_t InstanceSize() { |
4654 return RoundedAllocationSize(sizeof(RawDouble)); | 4853 return RoundedAllocationSize(sizeof(RawDouble)); |
4655 } | 4854 } |
4656 | 4855 |
4657 static intptr_t value_offset() { return OFFSET_OF(RawDouble, value_); } | 4856 static intptr_t value_offset() { return OFFSET_OF(RawDouble, value_); } |
4658 | 4857 |
4659 private: | 4858 private: |
4660 void set_value(double value) const; | 4859 void set_value(double value) const; |
4661 | 4860 |
4861 static intptr_t NextFieldOffset() { | |
4862 // Indicates this class cannot be extended by dart code. | |
4863 return -1; | |
4864 } | |
4865 | |
4662 FINAL_HEAP_OBJECT_IMPLEMENTATION(Double, Number); | 4866 FINAL_HEAP_OBJECT_IMPLEMENTATION(Double, Number); |
4663 friend class Class; | 4867 friend class Class; |
4664 }; | 4868 }; |
4665 | 4869 |
4666 | 4870 |
4667 // String may not be '\0' terminated. | 4871 // String may not be '\0' terminated. |
4668 class String : public Instance { | 4872 class String : public Instance { |
4669 public: | 4873 public: |
4670 // We use 30 bits for the hash code so that we consistently use a | 4874 // 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. | 4875 // 32bit Smi representation for the hash code on all architectures. |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5034 ASSERT(str.IsOneByteString()); | 5238 ASSERT(str.IsOneByteString()); |
5035 NoGCScope no_gc; | 5239 NoGCScope no_gc; |
5036 return &raw_ptr(str)->data_[index]; | 5240 return &raw_ptr(str)->data_[index]; |
5037 } | 5241 } |
5038 | 5242 |
5039 static RawOneByteString* ReadFrom(SnapshotReader* reader, | 5243 static RawOneByteString* ReadFrom(SnapshotReader* reader, |
5040 intptr_t object_id, | 5244 intptr_t object_id, |
5041 intptr_t tags, | 5245 intptr_t tags, |
5042 Snapshot::Kind kind); | 5246 Snapshot::Kind kind); |
5043 | 5247 |
5248 static intptr_t NextFieldOffset() { | |
5249 // Indicates this class cannot be extended by dart code. | |
5250 return -1; | |
5251 } | |
5252 | |
5044 friend class Class; | 5253 friend class Class; |
5045 friend class String; | 5254 friend class String; |
5046 friend class ExternalOneByteString; | 5255 friend class ExternalOneByteString; |
5047 friend class SnapshotReader; | 5256 friend class SnapshotReader; |
5048 }; | 5257 }; |
5049 | 5258 |
5050 | 5259 |
5051 class TwoByteString : public AllStatic { | 5260 class TwoByteString : public AllStatic { |
5052 public: | 5261 public: |
5053 static int32_t CharAt(const String& str, intptr_t index) { | 5262 static int32_t CharAt(const String& str, intptr_t index) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5126 ASSERT(str.IsTwoByteString()); | 5335 ASSERT(str.IsTwoByteString()); |
5127 NoGCScope no_gc; | 5336 NoGCScope no_gc; |
5128 return &raw_ptr(str)->data_[index]; | 5337 return &raw_ptr(str)->data_[index]; |
5129 } | 5338 } |
5130 | 5339 |
5131 static RawTwoByteString* ReadFrom(SnapshotReader* reader, | 5340 static RawTwoByteString* ReadFrom(SnapshotReader* reader, |
5132 intptr_t object_id, | 5341 intptr_t object_id, |
5133 intptr_t tags, | 5342 intptr_t tags, |
5134 Snapshot::Kind kind); | 5343 Snapshot::Kind kind); |
5135 | 5344 |
5345 static intptr_t NextFieldOffset() { | |
5346 // Indicates this class cannot be extended by dart code. | |
5347 return -1; | |
5348 } | |
5349 | |
5136 friend class Class; | 5350 friend class Class; |
5137 friend class String; | 5351 friend class String; |
5138 friend class SnapshotReader; | 5352 friend class SnapshotReader; |
5139 }; | 5353 }; |
5140 | 5354 |
5141 | 5355 |
5142 class ExternalOneByteString : public AllStatic { | 5356 class ExternalOneByteString : public AllStatic { |
5143 public: | 5357 public: |
5144 static int32_t CharAt(const String& str, intptr_t index) { | 5358 static int32_t CharAt(const String& str, intptr_t index) { |
5145 return *CharAddr(str, index); | 5359 return *CharAddr(str, index); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5194 raw_ptr(str)->external_data_ = data; | 5408 raw_ptr(str)->external_data_ = data; |
5195 } | 5409 } |
5196 | 5410 |
5197 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); | 5411 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); |
5198 | 5412 |
5199 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader, | 5413 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader, |
5200 intptr_t object_id, | 5414 intptr_t object_id, |
5201 intptr_t tags, | 5415 intptr_t tags, |
5202 Snapshot::Kind kind); | 5416 Snapshot::Kind kind); |
5203 | 5417 |
5418 static intptr_t NextFieldOffset() { | |
5419 // Indicates this class cannot be extended by dart code. | |
5420 return -1; | |
5421 } | |
5422 | |
5204 friend class Class; | 5423 friend class Class; |
5205 friend class String; | 5424 friend class String; |
5206 friend class SnapshotReader; | 5425 friend class SnapshotReader; |
5207 }; | 5426 }; |
5208 | 5427 |
5209 | 5428 |
5210 class ExternalTwoByteString : public AllStatic { | 5429 class ExternalTwoByteString : public AllStatic { |
5211 public: | 5430 public: |
5212 static int32_t CharAt(const String& str, intptr_t index) { | 5431 static int32_t CharAt(const String& str, intptr_t index) { |
5213 return *CharAddr(str, index); | 5432 return *CharAddr(str, index); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5260 raw_ptr(str)->external_data_ = data; | 5479 raw_ptr(str)->external_data_ = data; |
5261 } | 5480 } |
5262 | 5481 |
5263 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); | 5482 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); |
5264 | 5483 |
5265 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader, | 5484 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader, |
5266 intptr_t object_id, | 5485 intptr_t object_id, |
5267 intptr_t tags, | 5486 intptr_t tags, |
5268 Snapshot::Kind kind); | 5487 Snapshot::Kind kind); |
5269 | 5488 |
5489 static intptr_t NextFieldOffset() { | |
5490 // Indicates this class cannot be extended by dart code. | |
5491 return -1; | |
5492 } | |
5493 | |
5270 friend class Class; | 5494 friend class Class; |
5271 friend class String; | 5495 friend class String; |
5272 friend class SnapshotReader; | 5496 friend class SnapshotReader; |
5273 }; | 5497 }; |
5274 | 5498 |
5275 | 5499 |
5276 // Class Bool implements Dart core class bool. | 5500 // Class Bool implements Dart core class bool. |
5277 class Bool : public Instance { | 5501 class Bool : public Instance { |
5278 public: | 5502 public: |
5279 bool value() const { | 5503 bool value() const { |
(...skipping 12 matching lines...) Expand all Loading... | |
5292 return Object::bool_false(); | 5516 return Object::bool_false(); |
5293 } | 5517 } |
5294 | 5518 |
5295 static const Bool& Get(bool value) { | 5519 static const Bool& Get(bool value) { |
5296 return value ? Bool::True() : Bool::False(); | 5520 return value ? Bool::True() : Bool::False(); |
5297 } | 5521 } |
5298 | 5522 |
5299 private: | 5523 private: |
5300 void set_value(bool value) const { raw_ptr()->value_ = value; } | 5524 void set_value(bool value) const { raw_ptr()->value_ = value; } |
5301 | 5525 |
5526 static intptr_t NextFieldOffset() { | |
5527 // Indicates this class cannot be extended by dart code. | |
5528 return -1; | |
5529 } | |
5302 // New should only be called to initialize the two legal bool values. | 5530 // New should only be called to initialize the two legal bool values. |
5303 static RawBool* New(bool value); | 5531 static RawBool* New(bool value); |
5304 | 5532 |
5305 FINAL_HEAP_OBJECT_IMPLEMENTATION(Bool, Instance); | 5533 FINAL_HEAP_OBJECT_IMPLEMENTATION(Bool, Instance); |
5306 friend class Class; | 5534 friend class Class; |
5307 friend class Object; // To initialize the true and false values. | 5535 friend class Object; // To initialize the true and false values. |
5308 }; | 5536 }; |
5309 | 5537 |
5310 | 5538 |
5311 class Array : public Instance { | 5539 class Array : public Instance { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5401 ASSERT((index >= 0) && (index < Length())); | 5629 ASSERT((index >= 0) && (index < Length())); |
5402 return &raw_ptr()->data()[index]; | 5630 return &raw_ptr()->data()[index]; |
5403 } | 5631 } |
5404 | 5632 |
5405 void SetLength(intptr_t value) const { | 5633 void SetLength(intptr_t value) const { |
5406 // This is only safe because we create a new Smi, which does not cause | 5634 // This is only safe because we create a new Smi, which does not cause |
5407 // heap allocation. | 5635 // heap allocation. |
5408 raw_ptr()->length_ = Smi::New(value); | 5636 raw_ptr()->length_ = Smi::New(value); |
5409 } | 5637 } |
5410 | 5638 |
5639 static intptr_t NextFieldOffset() { | |
5640 // Indicates this class cannot be extended by dart code. | |
5641 return -1; | |
5642 } | |
5643 | |
5411 FINAL_HEAP_OBJECT_IMPLEMENTATION(Array, Instance); | 5644 FINAL_HEAP_OBJECT_IMPLEMENTATION(Array, Instance); |
5412 friend class Class; | 5645 friend class Class; |
5413 friend class ImmutableArray; | 5646 friend class ImmutableArray; |
5414 friend class Object; | 5647 friend class Object; |
5415 friend class String; | 5648 friend class String; |
5416 }; | 5649 }; |
5417 | 5650 |
5418 | 5651 |
5419 class ImmutableArray : public AllStatic { | 5652 class ImmutableArray : public AllStatic { |
5420 public: | 5653 public: |
5421 static RawImmutableArray* New(intptr_t len, Heap::Space space = Heap::kNew); | 5654 static RawImmutableArray* New(intptr_t len, Heap::Space space = Heap::kNew); |
5422 | 5655 |
5423 static RawImmutableArray* ReadFrom(SnapshotReader* reader, | 5656 static RawImmutableArray* ReadFrom(SnapshotReader* reader, |
5424 intptr_t object_id, | 5657 intptr_t object_id, |
5425 intptr_t tags, | 5658 intptr_t tags, |
5426 Snapshot::Kind kind); | 5659 Snapshot::Kind kind); |
5427 | 5660 |
5428 static const ClassId kClassId = kImmutableArrayCid; | 5661 static const ClassId kClassId = kImmutableArrayCid; |
5429 | 5662 |
5430 static intptr_t InstanceSize() { | 5663 static intptr_t InstanceSize() { |
5431 return Array::InstanceSize(); | 5664 return Array::InstanceSize(); |
5432 } | 5665 } |
5433 | 5666 |
5434 static intptr_t InstanceSize(intptr_t len) { | 5667 static intptr_t InstanceSize(intptr_t len) { |
5435 return Array::InstanceSize(len); | 5668 return Array::InstanceSize(len); |
5436 } | 5669 } |
5437 | 5670 |
5438 private: | 5671 private: |
5672 static intptr_t NextFieldOffset() { | |
5673 // Indicates this class cannot be extended by dart code. | |
5674 return -1; | |
5675 } | |
5439 static RawImmutableArray* raw(const Array& array) { | 5676 static RawImmutableArray* raw(const Array& array) { |
5440 return reinterpret_cast<RawImmutableArray*>(array.raw()); | 5677 return reinterpret_cast<RawImmutableArray*>(array.raw()); |
5441 } | 5678 } |
5442 | 5679 |
5443 friend class Class; | 5680 friend class Class; |
5444 }; | 5681 }; |
5445 | 5682 |
5446 | 5683 |
5447 class GrowableObjectArray : public Instance { | 5684 class GrowableObjectArray : public Instance { |
5448 public: | 5685 public: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5545 *addr = value; | 5782 *addr = value; |
5546 // Filter stores based on source and target. | 5783 // Filter stores based on source and target. |
5547 if (!value->IsHeapObject()) return; | 5784 if (!value->IsHeapObject()) return; |
5548 if (value->IsNewObject() && data()->IsOldObject() && | 5785 if (value->IsNewObject() && data()->IsOldObject() && |
5549 !data()->IsRemembered()) { | 5786 !data()->IsRemembered()) { |
5550 data()->SetRememberedBit(); | 5787 data()->SetRememberedBit(); |
5551 Isolate::Current()->store_buffer()->AddObject(data()); | 5788 Isolate::Current()->store_buffer()->AddObject(data()); |
5552 } | 5789 } |
5553 } | 5790 } |
5554 | 5791 |
5792 static intptr_t NextFieldOffset() { | |
5793 return sizeof(RawGrowableObjectArray); | |
5794 } | |
5795 | |
5555 static const int kDefaultInitialCapacity = 4; | 5796 static const int kDefaultInitialCapacity = 4; |
5556 | 5797 |
5557 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance); | 5798 FINAL_HEAP_OBJECT_IMPLEMENTATION(GrowableObjectArray, Instance); |
5558 friend class Array; | 5799 friend class Array; |
5559 friend class Class; | 5800 friend class Class; |
5560 }; | 5801 }; |
5561 | 5802 |
5562 | 5803 |
5563 class Float32x4 : public Instance { | 5804 class Float32x4 : public Instance { |
5564 public: | 5805 public: |
(...skipping 17 matching lines...) Expand all Loading... | |
5582 | 5823 |
5583 static intptr_t InstanceSize() { | 5824 static intptr_t InstanceSize() { |
5584 return RoundedAllocationSize(sizeof(RawFloat32x4)); | 5825 return RoundedAllocationSize(sizeof(RawFloat32x4)); |
5585 } | 5826 } |
5586 | 5827 |
5587 static intptr_t value_offset() { | 5828 static intptr_t value_offset() { |
5588 return OFFSET_OF(RawFloat32x4, value_); | 5829 return OFFSET_OF(RawFloat32x4, value_); |
5589 } | 5830 } |
5590 | 5831 |
5591 private: | 5832 private: |
5833 static intptr_t NextFieldOffset() { | |
5834 // Indicates this class cannot be extended by dart code. | |
5835 return -1; | |
5836 } | |
5592 FINAL_HEAP_OBJECT_IMPLEMENTATION(Float32x4, Instance); | 5837 FINAL_HEAP_OBJECT_IMPLEMENTATION(Float32x4, Instance); |
5593 friend class Class; | 5838 friend class Class; |
5594 }; | 5839 }; |
5595 | 5840 |
5596 | 5841 |
5597 class Uint32x4 : public Instance { | 5842 class Uint32x4 : public Instance { |
5598 public: | 5843 public: |
5599 static RawUint32x4* New(uint32_t value0, uint32_t value1, uint32_t value2, | 5844 static RawUint32x4* New(uint32_t value0, uint32_t value1, uint32_t value2, |
5600 uint32_t value3, Heap::Space space = Heap::kNew); | 5845 uint32_t value3, Heap::Space space = Heap::kNew); |
5601 static RawUint32x4* New(simd128_value_t value, | 5846 static RawUint32x4* New(simd128_value_t value, |
(...skipping 14 matching lines...) Expand all Loading... | |
5616 | 5861 |
5617 static intptr_t InstanceSize() { | 5862 static intptr_t InstanceSize() { |
5618 return RoundedAllocationSize(sizeof(RawUint32x4)); | 5863 return RoundedAllocationSize(sizeof(RawUint32x4)); |
5619 } | 5864 } |
5620 | 5865 |
5621 static intptr_t value_offset() { | 5866 static intptr_t value_offset() { |
5622 return OFFSET_OF(RawUint32x4, value_); | 5867 return OFFSET_OF(RawUint32x4, value_); |
5623 } | 5868 } |
5624 | 5869 |
5625 private: | 5870 private: |
5871 static intptr_t NextFieldOffset() { | |
5872 // Indicates this class cannot be extended by dart code. | |
5873 return -1; | |
5874 } | |
5626 FINAL_HEAP_OBJECT_IMPLEMENTATION(Uint32x4, Instance); | 5875 FINAL_HEAP_OBJECT_IMPLEMENTATION(Uint32x4, Instance); |
5627 friend class Class; | 5876 friend class Class; |
5628 }; | 5877 }; |
5629 | 5878 |
5630 | 5879 |
5631 class TypedData : public Instance { | 5880 class TypedData : public Instance { |
5632 public: | 5881 public: |
5633 intptr_t Length() const { | 5882 intptr_t Length() const { |
5634 ASSERT(!IsNull()); | 5883 ASSERT(!IsNull()); |
5635 return Smi::Value(raw_ptr()->length_); | 5884 return Smi::Value(raw_ptr()->length_); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5743 intptr_t cid = obj.raw()->GetClassId(); | 5992 intptr_t cid = obj.raw()->GetClassId(); |
5744 return RawObject::IsTypedDataClassId(cid); | 5993 return RawObject::IsTypedDataClassId(cid); |
5745 } | 5994 } |
5746 | 5995 |
5747 protected: | 5996 protected: |
5748 void SetLength(intptr_t value) const { | 5997 void SetLength(intptr_t value) const { |
5749 raw_ptr()->length_ = Smi::New(value); | 5998 raw_ptr()->length_ = Smi::New(value); |
5750 } | 5999 } |
5751 | 6000 |
5752 private: | 6001 private: |
6002 static intptr_t NextFieldOffset() { | |
6003 // Indicates this class cannot be extended by dart code. | |
6004 return -1; | |
6005 } | |
5753 static const intptr_t element_size[]; | 6006 static const intptr_t element_size[]; |
5754 | 6007 |
5755 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypedData, Instance); | 6008 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypedData, Instance); |
5756 friend class Class; | 6009 friend class Class; |
5757 friend class ExternalTypedData; | 6010 friend class ExternalTypedData; |
5758 friend class TypedDataView; | 6011 friend class TypedDataView; |
5759 }; | 6012 }; |
5760 | 6013 |
5761 | 6014 |
5762 class ExternalTypedData : public Instance { | 6015 class ExternalTypedData : public Instance { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5862 | 6115 |
5863 void SetData(uint8_t* data) const { | 6116 void SetData(uint8_t* data) const { |
5864 raw_ptr()->data_ = data; | 6117 raw_ptr()->data_ = data; |
5865 } | 6118 } |
5866 | 6119 |
5867 void SetPeer(void* peer) const { | 6120 void SetPeer(void* peer) const { |
5868 raw_ptr()->peer_ = peer; | 6121 raw_ptr()->peer_ = peer; |
5869 } | 6122 } |
5870 | 6123 |
5871 private: | 6124 private: |
6125 static intptr_t NextFieldOffset() { | |
6126 // Indicates this class cannot be extended by dart code. | |
6127 return -1; | |
6128 } | |
6129 | |
5872 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData, Instance); | 6130 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExternalTypedData, Instance); |
5873 friend class Class; | 6131 friend class Class; |
5874 }; | 6132 }; |
5875 | 6133 |
5876 | 6134 |
5877 class TypedDataView : public AllStatic { | 6135 class TypedDataView : public AllStatic { |
5878 public: | 6136 public: |
5879 static intptr_t ElementSizeInBytes(const Instance& view_obj) { | 6137 static intptr_t ElementSizeInBytes(const Instance& view_obj) { |
5880 ASSERT(!view_obj.IsNull()); | 6138 ASSERT(!view_obj.IsNull()); |
5881 intptr_t cid = view_obj.raw()->GetClassId(); | 6139 intptr_t cid = view_obj.raw()->GetClassId(); |
(...skipping 18 matching lines...) Expand all Loading... | |
5900 | 6158 |
5901 static bool IsExternalTypedDataView(const Instance& view_obj) { | 6159 static bool IsExternalTypedDataView(const Instance& view_obj) { |
5902 const Instance& data = Instance::Handle(Data(view_obj)); | 6160 const Instance& data = Instance::Handle(Data(view_obj)); |
5903 intptr_t cid = data.raw()->GetClassId(); | 6161 intptr_t cid = data.raw()->GetClassId(); |
5904 ASSERT(RawObject::IsTypedDataClassId(cid) || | 6162 ASSERT(RawObject::IsTypedDataClassId(cid) || |
5905 RawObject::IsExternalTypedDataClassId(cid)); | 6163 RawObject::IsExternalTypedDataClassId(cid)); |
5906 return RawObject::IsExternalTypedDataClassId(cid); | 6164 return RawObject::IsExternalTypedDataClassId(cid); |
5907 } | 6165 } |
5908 | 6166 |
5909 static intptr_t NumberOfFields() { | 6167 static intptr_t NumberOfFields() { |
5910 return (kLengthOffset - kTypeArguments); | 6168 return kLengthOffset; |
5911 } | 6169 } |
5912 | 6170 |
5913 static intptr_t data_offset() { | 6171 static intptr_t data_offset() { |
5914 return kWordSize * kDataOffset; | 6172 return kWordSize * kDataOffset; |
5915 } | 6173 } |
5916 | 6174 |
5917 static intptr_t offset_in_bytes_offset() { | 6175 static intptr_t offset_in_bytes_offset() { |
5918 return kWordSize * kOffsetInBytesOffset; | 6176 return kWordSize * kOffsetInBytesOffset; |
5919 } | 6177 } |
5920 | 6178 |
5921 static intptr_t length_offset() { | 6179 static intptr_t length_offset() { |
5922 return kWordSize * kLengthOffset; | 6180 return kWordSize * kLengthOffset; |
5923 } | 6181 } |
5924 | 6182 |
5925 static intptr_t ElementSizeInBytes(intptr_t class_id) { | 6183 static intptr_t ElementSizeInBytes(intptr_t class_id) { |
5926 ASSERT(RawObject::IsTypedDataViewClassId(class_id)); | 6184 ASSERT(RawObject::IsTypedDataViewClassId(class_id)); |
5927 return (class_id == kByteDataViewCid) ? | 6185 return (class_id == kByteDataViewCid) ? |
5928 TypedData::element_size[kTypedDataInt8ArrayCid] : | 6186 TypedData::element_size[kTypedDataInt8ArrayCid] : |
5929 TypedData::element_size[class_id - kTypedDataInt8ArrayViewCid]; | 6187 TypedData::element_size[class_id - kTypedDataInt8ArrayViewCid]; |
5930 } | 6188 } |
5931 | 6189 |
5932 private: | 6190 private: |
5933 enum { | 6191 enum { |
5934 kTypeArguments = 1, | 6192 kDataOffset = 1, |
5935 kDataOffset = 2, | 6193 kOffsetInBytesOffset = 2, |
5936 kOffsetInBytesOffset = 3, | 6194 kLengthOffset = 3, |
5937 kLengthOffset = 4, | |
5938 }; | 6195 }; |
5939 }; | 6196 }; |
5940 | 6197 |
5941 | 6198 |
5942 class Closure : public AllStatic { | 6199 class Closure : public AllStatic { |
5943 public: | 6200 public: |
5944 static RawFunction* function(const Instance& closure) { | 6201 static RawFunction* function(const Instance& closure) { |
5945 return *FunctionAddr(closure); | 6202 return *FunctionAddr(closure); |
5946 } | 6203 } |
5947 static intptr_t function_offset() { | 6204 static intptr_t function_offset() { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6000 reinterpret_cast<intptr_t>(obj.raw_ptr()) + context_offset()); | 6257 reinterpret_cast<intptr_t>(obj.raw_ptr()) + context_offset()); |
6001 } | 6258 } |
6002 static void set_function(const Instance& closure, | 6259 static void set_function(const Instance& closure, |
6003 const Function& value) { | 6260 const Function& value) { |
6004 closure.StorePointer(FunctionAddr(closure), value.raw()); | 6261 closure.StorePointer(FunctionAddr(closure), value.raw()); |
6005 } | 6262 } |
6006 static void set_context(const Instance& closure, | 6263 static void set_context(const Instance& closure, |
6007 const Context& value) { | 6264 const Context& value) { |
6008 closure.StorePointer(ContextAddr(closure), value.raw()); | 6265 closure.StorePointer(ContextAddr(closure), value.raw()); |
6009 } | 6266 } |
6267 static intptr_t NextFieldOffset() { | |
6268 // Indicates this class cannot be extended by dart code. | |
6269 return -1; | |
6270 } | |
6010 | 6271 |
6011 friend class Class; | 6272 friend class Class; |
6012 }; | 6273 }; |
6013 | 6274 |
6014 | 6275 |
6015 // Internal stacktrace object used in exceptions for printing stack traces. | 6276 // Internal stacktrace object used in exceptions for printing stack traces. |
6016 class Stacktrace : public Instance { | 6277 class Stacktrace : public Instance { |
6017 public: | 6278 public: |
6018 static const int kPreallocatedStackdepth = 10; | 6279 static const int kPreallocatedStackdepth = 10; |
6019 | 6280 |
(...skipping 22 matching lines...) Expand all Loading... | |
6042 RawString* FullStacktrace() const; | 6303 RawString* FullStacktrace() const; |
6043 const char* ToCStringInternal(intptr_t* frame_index) const; | 6304 const char* ToCStringInternal(intptr_t* frame_index) const; |
6044 | 6305 |
6045 private: | 6306 private: |
6046 void set_code_array(const Array& code_array) const; | 6307 void set_code_array(const Array& code_array) const; |
6047 void set_pc_offset_array(const Array& pc_offset_array) const; | 6308 void set_pc_offset_array(const Array& pc_offset_array) const; |
6048 void set_catch_code_array(const Array& code_array) const; | 6309 void set_catch_code_array(const Array& code_array) const; |
6049 void set_catch_pc_offset_array(const Array& pc_offset_array) const; | 6310 void set_catch_pc_offset_array(const Array& pc_offset_array) const; |
6050 bool expand_inlined() const; | 6311 bool expand_inlined() const; |
6051 | 6312 |
6313 static intptr_t NextFieldOffset() { | |
6314 // Indicates this class cannot be extended by dart code. | |
6315 return -1; | |
6316 } | |
6317 | |
6052 FINAL_HEAP_OBJECT_IMPLEMENTATION(Stacktrace, Instance); | 6318 FINAL_HEAP_OBJECT_IMPLEMENTATION(Stacktrace, Instance); |
6053 friend class Class; | 6319 friend class Class; |
6054 }; | 6320 }; |
6055 | 6321 |
6056 | 6322 |
6057 // Internal JavaScript regular expression object. | 6323 // Internal JavaScript regular expression object. |
6058 class JSRegExp : public Instance { | 6324 class JSRegExp : public Instance { |
6059 public: | 6325 public: |
6060 // Meaning of RegExType: | 6326 // Meaning of RegExType: |
6061 // kUninitialized: the type of th regexp has not been initialized yet. | 6327 // kUninitialized: the type of th regexp has not been initialized yet. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6122 private: | 6388 private: |
6123 void set_type(RegExType type) const { raw_ptr()->type_ = type; } | 6389 void set_type(RegExType type) const { raw_ptr()->type_ = type; } |
6124 void set_flags(intptr_t value) const { raw_ptr()->flags_ = value; } | 6390 void set_flags(intptr_t value) const { raw_ptr()->flags_ = value; } |
6125 | 6391 |
6126 void SetLength(intptr_t value) const { | 6392 void SetLength(intptr_t value) const { |
6127 // This is only safe because we create a new Smi, which does not cause | 6393 // This is only safe because we create a new Smi, which does not cause |
6128 // heap allocation. | 6394 // heap allocation. |
6129 raw_ptr()->data_length_ = Smi::New(value); | 6395 raw_ptr()->data_length_ = Smi::New(value); |
6130 } | 6396 } |
6131 | 6397 |
6398 static intptr_t NextFieldOffset() { | |
6399 // Indicates this class cannot be extended by dart code. | |
6400 return -1; | |
6401 } | |
6402 | |
6132 FINAL_HEAP_OBJECT_IMPLEMENTATION(JSRegExp, Instance); | 6403 FINAL_HEAP_OBJECT_IMPLEMENTATION(JSRegExp, Instance); |
6133 friend class Class; | 6404 friend class Class; |
6134 }; | 6405 }; |
6135 | 6406 |
6136 | 6407 |
6137 class WeakProperty : public Instance { | 6408 class WeakProperty : public Instance { |
6138 public: | 6409 public: |
6139 RawObject* key() const { | 6410 RawObject* key() const { |
6140 return raw_ptr()->key_; | 6411 return raw_ptr()->key_; |
6141 } | 6412 } |
(...skipping 15 matching lines...) Expand all Loading... | |
6157 static intptr_t InstanceSize() { | 6428 static intptr_t InstanceSize() { |
6158 return RoundedAllocationSize(sizeof(RawWeakProperty)); | 6429 return RoundedAllocationSize(sizeof(RawWeakProperty)); |
6159 } | 6430 } |
6160 | 6431 |
6161 static void Clear(RawWeakProperty* raw_weak) { | 6432 static void Clear(RawWeakProperty* raw_weak) { |
6162 raw_weak->ptr()->key_ = Object::null(); | 6433 raw_weak->ptr()->key_ = Object::null(); |
6163 raw_weak->ptr()->value_ = Object::null(); | 6434 raw_weak->ptr()->value_ = Object::null(); |
6164 } | 6435 } |
6165 | 6436 |
6166 private: | 6437 private: |
6438 static intptr_t NextFieldOffset() { | |
6439 return sizeof(RawWeakProperty); | |
6440 } | |
6441 | |
6167 FINAL_HEAP_OBJECT_IMPLEMENTATION(WeakProperty, Instance); | 6442 FINAL_HEAP_OBJECT_IMPLEMENTATION(WeakProperty, Instance); |
6168 friend class Class; | 6443 friend class Class; |
6169 }; | 6444 }; |
6170 | 6445 |
6171 | 6446 |
6172 class MirrorReference : public Instance { | 6447 class MirrorReference : public Instance { |
6173 public: | 6448 public: |
6174 RawObject* referent() const { | 6449 RawObject* referent() const { |
6175 return raw_ptr()->referent_; | 6450 return raw_ptr()->referent_; |
6176 } | 6451 } |
(...skipping 15 matching lines...) Expand all Loading... | |
6192 RawTypeParameter* GetTypeParameterReferent() const; | 6467 RawTypeParameter* GetTypeParameterReferent() const; |
6193 | 6468 |
6194 static RawMirrorReference* New(const Object& referent, | 6469 static RawMirrorReference* New(const Object& referent, |
6195 Heap::Space space = Heap::kNew); | 6470 Heap::Space space = Heap::kNew); |
6196 | 6471 |
6197 static intptr_t InstanceSize() { | 6472 static intptr_t InstanceSize() { |
6198 return RoundedAllocationSize(sizeof(RawMirrorReference)); | 6473 return RoundedAllocationSize(sizeof(RawMirrorReference)); |
6199 } | 6474 } |
6200 | 6475 |
6201 private: | 6476 private: |
6477 static intptr_t NextFieldOffset() { | |
6478 // Indicates this class cannot be extended by dart code. | |
6479 return -1; | |
6480 } | |
6481 | |
6202 FINAL_HEAP_OBJECT_IMPLEMENTATION(MirrorReference, Instance); | 6482 FINAL_HEAP_OBJECT_IMPLEMENTATION(MirrorReference, Instance); |
6203 friend class Class; | 6483 friend class Class; |
6204 }; | 6484 }; |
6205 | 6485 |
6206 | 6486 |
6207 // Breaking cycles and loops. | 6487 // Breaking cycles and loops. |
6208 RawClass* Object::clazz() const { | 6488 RawClass* Object::clazz() const { |
6209 uword raw_value = reinterpret_cast<uword>(raw_); | 6489 uword raw_value = reinterpret_cast<uword>(raw_); |
6210 if ((raw_value & kSmiTagMask) == kSmiTag) { | 6490 if ((raw_value & kSmiTagMask) == kSmiTag) { |
6211 return Smi::Class(); | 6491 return Smi::Class(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6321 | 6601 |
6322 | 6602 |
6323 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6603 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6324 intptr_t index) { | 6604 intptr_t index) { |
6325 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6605 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6326 } | 6606 } |
6327 | 6607 |
6328 } // namespace dart | 6608 } // namespace dart |
6329 | 6609 |
6330 #endif // VM_OBJECT_H_ | 6610 #endif // VM_OBJECT_H_ |
OLD | NEW |