| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 raw_ = value; \ | 194 raw_ = value; \ |
| 195 CHECK_HANDLE(); \ | 195 CHECK_HANDLE(); \ |
| 196 } \ | 196 } \ |
| 197 private: /* NOLINT */ \ | 197 private: /* NOLINT */ \ |
| 198 object() : super() {} \ | 198 object() : super() {} \ |
| 199 BASE_OBJECT_IMPLEMENTATION(object, super) \ | 199 BASE_OBJECT_IMPLEMENTATION(object, super) \ |
| 200 Raw##object* raw_ptr() const { \ | 200 Raw##object* raw_ptr() const { \ |
| 201 ASSERT(raw() != null()); \ | 201 ASSERT(raw() != null()); \ |
| 202 return raw()->ptr(); \ | 202 return raw()->ptr(); \ |
| 203 } \ | 203 } \ |
| 204 static intptr_t NextFieldOffset() { \ |
| 205 return -kWordSize; \ |
| 206 } \ |
| 204 SNAPSHOT_READER_SUPPORT(object) \ | 207 SNAPSHOT_READER_SUPPORT(object) \ |
| 205 friend class Isolate; \ | 208 friend class Isolate; \ |
| 206 friend class StackFrame; \ | 209 friend class StackFrame; \ |
| 207 | 210 |
| 208 class Object { | 211 class Object { |
| 209 public: | 212 public: |
| 210 virtual ~Object() { } | 213 virtual ~Object() { } |
| 211 | 214 |
| 212 RawObject* raw() const { return raw_; } | 215 RawObject* raw() const { return raw_; } |
| 213 void operator=(RawObject* value) { | 216 void operator=(RawObject* value) { |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 if (value->IsNewObject() && raw()->IsOldObject() && | 524 if (value->IsNewObject() && raw()->IsOldObject() && |
| 522 !raw()->IsRemembered()) { | 525 !raw()->IsRemembered()) { |
| 523 raw()->SetRememberedBit(); | 526 raw()->SetRememberedBit(); |
| 524 Isolate::Current()->store_buffer()->AddObject(raw()); | 527 Isolate::Current()->store_buffer()->AddObject(raw()); |
| 525 } | 528 } |
| 526 } | 529 } |
| 527 | 530 |
| 528 RawObject* raw_; // The raw object reference. | 531 RawObject* raw_; // The raw object reference. |
| 529 | 532 |
| 530 private: | 533 private: |
| 534 static intptr_t NextFieldOffset() { |
| 535 // Indicates this class cannot be extended by dart code. |
| 536 return -kWordSize; |
| 537 } |
| 538 |
| 531 static void InitializeObject(uword address, intptr_t id, intptr_t size); | 539 static void InitializeObject(uword address, intptr_t id, intptr_t size); |
| 532 | 540 |
| 533 static void RegisterClass(const Class& cls, | 541 static void RegisterClass(const Class& cls, |
| 534 const String& name, | 542 const String& name, |
| 535 const Library& lib); | 543 const Library& lib); |
| 536 static void RegisterPrivateClass(const Class& cls, | 544 static void RegisterPrivateClass(const Class& cls, |
| 537 const String& name, | 545 const String& name, |
| 538 const Library& lib); | 546 const Library& lib); |
| 539 | 547 |
| 540 /* Initialize the handle based on the raw_ptr in the presence of null. */ | 548 /* Initialize the handle based on the raw_ptr in the presence of null. */ |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 } | 656 } |
| 649 | 657 |
| 650 intptr_t next_field_offset() const { | 658 intptr_t next_field_offset() const { |
| 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 ASSERT(kWordSize != 0); |
| 655 set_next_field_offset_in_words(value_in_bytes / kWordSize); | 663 set_next_field_offset_in_words(value_in_bytes / kWordSize); |
| 656 } | 664 } |
| 657 void set_next_field_offset_in_words(intptr_t value) const { | 665 void set_next_field_offset_in_words(intptr_t value) const { |
| 658 ASSERT((Utils::IsAligned((value * kWordSize), kObjectAlignment) && | 666 ASSERT((value == -1) || |
| 667 (Utils::IsAligned((value * kWordSize), kObjectAlignment) && |
| 659 (value == raw_ptr()->instance_size_in_words_)) || | 668 (value == raw_ptr()->instance_size_in_words_)) || |
| 660 (!Utils::IsAligned((value * kWordSize), kObjectAlignment) && | 669 (!Utils::IsAligned((value * kWordSize), kObjectAlignment) && |
| 661 ((value + 1) == raw_ptr()->instance_size_in_words_))); | 670 ((value + 1) == raw_ptr()->instance_size_in_words_))); |
| 662 raw_ptr()->next_field_offset_in_words_ = value; | 671 raw_ptr()->next_field_offset_in_words_ = value; |
| 663 } | 672 } |
| 664 | 673 |
| 665 cpp_vtable handle_vtable() const { return raw_ptr()->handle_vtable_; } | 674 cpp_vtable handle_vtable() const { return raw_ptr()->handle_vtable_; } |
| 666 void set_handle_vtable(cpp_vtable value) const { | 675 void set_handle_vtable(cpp_vtable value) const { |
| 667 raw_ptr()->handle_vtable_ = value; | 676 raw_ptr()->handle_vtable_ = value; |
| 668 } | 677 } |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 void set_constants(const Array& value) const; | 1085 void set_constants(const Array& value) const; |
| 1077 | 1086 |
| 1078 void set_canonical_types(const Array& value) const; | 1087 void set_canonical_types(const Array& value) const; |
| 1079 RawArray* canonical_types() const; | 1088 RawArray* canonical_types() const; |
| 1080 | 1089 |
| 1081 RawArray* invocation_dispatcher_cache() const; | 1090 RawArray* invocation_dispatcher_cache() const; |
| 1082 void set_invocation_dispatcher_cache(const Array& cache) const; | 1091 void set_invocation_dispatcher_cache(const Array& cache) const; |
| 1083 RawFunction* CreateInvocationDispatcher(const String& target_name, | 1092 RawFunction* CreateInvocationDispatcher(const String& target_name, |
| 1084 const Array& args_desc, | 1093 const Array& args_desc, |
| 1085 RawFunction::Kind kind) const; | 1094 RawFunction::Kind kind) const; |
| 1095 |
| 1086 void CalculateFieldOffsets() const; | 1096 void CalculateFieldOffsets() const; |
| 1087 | 1097 |
| 1088 // Initial value for the cached number of type arguments. | 1098 // Initial value for the cached number of type arguments. |
| 1089 static const intptr_t kUnknownNumTypeArguments = -1; | 1099 static const intptr_t kUnknownNumTypeArguments = -1; |
| 1090 | 1100 |
| 1091 int16_t num_type_arguments() const { | 1101 int16_t num_type_arguments() const { |
| 1092 return raw_ptr()->num_type_arguments_; | 1102 return raw_ptr()->num_type_arguments_; |
| 1093 } | 1103 } |
| 1094 void set_num_type_arguments(intptr_t value) const; | 1104 void set_num_type_arguments(intptr_t value) const; |
| 1095 | 1105 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1114 // Allocate an instance class which has a VM implementation. | 1124 // Allocate an instance class which has a VM implementation. |
| 1115 template <class FakeInstance> static RawClass* New(intptr_t id); | 1125 template <class FakeInstance> static RawClass* New(intptr_t id); |
| 1116 | 1126 |
| 1117 // Check the subtype or 'more specific' relationship. | 1127 // Check the subtype or 'more specific' relationship. |
| 1118 bool TypeTest(TypeTestKind test_kind, | 1128 bool TypeTest(TypeTestKind test_kind, |
| 1119 const AbstractTypeArguments& type_arguments, | 1129 const AbstractTypeArguments& type_arguments, |
| 1120 const Class& other, | 1130 const Class& other, |
| 1121 const AbstractTypeArguments& other_type_arguments, | 1131 const AbstractTypeArguments& other_type_arguments, |
| 1122 Error* bound_error) const; | 1132 Error* bound_error) const; |
| 1123 | 1133 |
| 1134 static bool TypeTestNonRecursive( |
| 1135 const Class& cls, |
| 1136 TypeTestKind test_kind, |
| 1137 const AbstractTypeArguments& type_arguments, |
| 1138 const Class& other, |
| 1139 const AbstractTypeArguments& other_type_arguments, |
| 1140 Error* bound_error); |
| 1141 |
| 1124 FINAL_HEAP_OBJECT_IMPLEMENTATION(Class, Object); | 1142 FINAL_HEAP_OBJECT_IMPLEMENTATION(Class, Object); |
| 1125 friend class AbstractType; | 1143 friend class AbstractType; |
| 1126 friend class Instance; | 1144 friend class Instance; |
| 1127 friend class Object; | 1145 friend class Object; |
| 1128 friend class Type; | 1146 friend class Type; |
| 1129 }; | 1147 }; |
| 1130 | 1148 |
| 1131 | 1149 |
| 1132 // Unresolved class is used for storing unresolved names which will be resolved | 1150 // Unresolved class is used for storing unresolved names which will be resolved |
| 1133 // to a class after all classes have been loaded and finalized. | 1151 // to a class after all classes have been loaded and finalized. |
| 1134 class UnresolvedClass : public Object { | 1152 class UnresolvedClass : public Object { |
| 1135 public: | 1153 public: |
| 1136 RawLibraryPrefix* library_prefix() const { | 1154 RawLibraryPrefix* library_prefix() const { |
| 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 |
| 1156 static RawUnresolvedClass* New(); | 1175 static RawUnresolvedClass* New(); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 | 1396 |
| 1378 static RawInstantiatedTypeArguments* New( | 1397 static RawInstantiatedTypeArguments* New( |
| 1379 const AbstractTypeArguments& uninstantiated_type_arguments, | 1398 const AbstractTypeArguments& uninstantiated_type_arguments, |
| 1380 const AbstractTypeArguments& instantiator_type_arguments); | 1399 const AbstractTypeArguments& instantiator_type_arguments); |
| 1381 | 1400 |
| 1382 private: | 1401 private: |
| 1383 void set_uninstantiated_type_arguments( | 1402 void set_uninstantiated_type_arguments( |
| 1384 const AbstractTypeArguments& value) const; | 1403 const AbstractTypeArguments& value) const; |
| 1385 void set_instantiator_type_arguments( | 1404 void set_instantiator_type_arguments( |
| 1386 const AbstractTypeArguments& value) const; | 1405 const AbstractTypeArguments& value) const; |
| 1406 |
| 1387 static RawInstantiatedTypeArguments* New(); | 1407 static RawInstantiatedTypeArguments* New(); |
| 1388 | 1408 |
| 1389 FINAL_HEAP_OBJECT_IMPLEMENTATION(InstantiatedTypeArguments, | 1409 FINAL_HEAP_OBJECT_IMPLEMENTATION(InstantiatedTypeArguments, |
| 1390 AbstractTypeArguments); | 1410 AbstractTypeArguments); |
| 1391 friend class Class; | 1411 friend class Class; |
| 1392 }; | 1412 }; |
| 1393 | 1413 |
| 1394 | 1414 |
| 1395 class PatchClass : public Object { | 1415 class PatchClass : public Object { |
| 1396 public: | 1416 public: |
| 1397 RawClass* patched_class() const { return raw_ptr()->patched_class_; } | 1417 RawClass* patched_class() const { return raw_ptr()->patched_class_; } |
| 1398 RawClass* source_class() const { return raw_ptr()->source_class_; } | 1418 RawClass* source_class() const { return raw_ptr()->source_class_; } |
| 1399 RawScript* Script() const; | 1419 RawScript* Script() const; |
| 1400 | 1420 |
| 1401 static intptr_t InstanceSize() { | 1421 static intptr_t InstanceSize() { |
| 1402 return RoundedAllocationSize(sizeof(RawPatchClass)); | 1422 return RoundedAllocationSize(sizeof(RawPatchClass)); |
| 1403 } | 1423 } |
| 1404 | 1424 |
| 1405 static RawPatchClass* New(const Class& patched_class, | 1425 static RawPatchClass* New(const Class& patched_class, |
| 1406 const Class& source_class); | 1426 const Class& source_class); |
| 1407 | 1427 |
| 1408 private: | 1428 private: |
| 1409 void set_patched_class(const Class& value) const; | 1429 void set_patched_class(const Class& value) const; |
| 1410 void set_source_class(const Class& value) const; | 1430 void set_source_class(const Class& value) const; |
| 1431 |
| 1411 static RawPatchClass* New(); | 1432 static RawPatchClass* New(); |
| 1412 | 1433 |
| 1413 FINAL_HEAP_OBJECT_IMPLEMENTATION(PatchClass, Object); | 1434 FINAL_HEAP_OBJECT_IMPLEMENTATION(PatchClass, Object); |
| 1414 friend class Class; | 1435 friend class Class; |
| 1415 }; | 1436 }; |
| 1416 | 1437 |
| 1417 | 1438 |
| 1418 class Function : public Object { | 1439 class Function : public Object { |
| 1419 public: | 1440 public: |
| 1420 RawString* name() const { return raw_ptr()->name_; } | 1441 RawString* name() const { return raw_ptr()->name_; } |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 // Returns true if this function represents a local function. | 1873 // Returns true if this function represents a local function. |
| 1853 bool IsLocalFunction() const { | 1874 bool IsLocalFunction() const { |
| 1854 return parent_function() != Function::null(); | 1875 return parent_function() != Function::null(); |
| 1855 } | 1876 } |
| 1856 | 1877 |
| 1857 // Returns true if this function represents a signature function without code. | 1878 // Returns true if this function represents a signature function without code. |
| 1858 bool IsSignatureFunction() const { | 1879 bool IsSignatureFunction() const { |
| 1859 return kind() == RawFunction::kSignatureFunction; | 1880 return kind() == RawFunction::kSignatureFunction; |
| 1860 } | 1881 } |
| 1861 | 1882 |
| 1862 | |
| 1863 static intptr_t InstanceSize() { | 1883 static intptr_t InstanceSize() { |
| 1864 return RoundedAllocationSize(sizeof(RawFunction)); | 1884 return RoundedAllocationSize(sizeof(RawFunction)); |
| 1865 } | 1885 } |
| 1866 | 1886 |
| 1867 static RawFunction* New(const String& name, | 1887 static RawFunction* New(const String& name, |
| 1868 RawFunction::Kind kind, | 1888 RawFunction::Kind kind, |
| 1869 bool is_static, | 1889 bool is_static, |
| 1870 bool is_const, | 1890 bool is_const, |
| 1871 bool is_abstract, | 1891 bool is_abstract, |
| 1872 bool is_external, | 1892 bool is_external, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 void set_is_external(bool value) const; | 1959 void set_is_external(bool value) const; |
| 1940 void set_parent_function(const Function& value) const; | 1960 void set_parent_function(const Function& value) const; |
| 1941 void set_owner(const Object& value) const; | 1961 void set_owner(const Object& value) const; |
| 1942 RawFunction* implicit_closure_function() const; | 1962 RawFunction* implicit_closure_function() const; |
| 1943 void set_implicit_closure_function(const Function& value) const; | 1963 void set_implicit_closure_function(const Function& value) const; |
| 1944 RawInstance* implicit_static_closure() const; | 1964 RawInstance* implicit_static_closure() const; |
| 1945 void set_implicit_static_closure(const Instance& closure) const; | 1965 void set_implicit_static_closure(const Instance& closure) const; |
| 1946 void set_num_optional_parameters(intptr_t value) const; // Encoded value. | 1966 void set_num_optional_parameters(intptr_t value) const; // Encoded value. |
| 1947 void set_kind_tag(intptr_t value) const; | 1967 void set_kind_tag(intptr_t value) const; |
| 1948 void set_data(const Object& value) const; | 1968 void set_data(const Object& value) const; |
| 1969 |
| 1949 static RawFunction* New(); | 1970 static RawFunction* New(); |
| 1950 | 1971 |
| 1951 void BuildSignatureParameters(bool instantiate, | 1972 void BuildSignatureParameters(bool instantiate, |
| 1952 NameVisibility name_visibility, | 1973 NameVisibility name_visibility, |
| 1953 const AbstractTypeArguments& instantiator, | 1974 const AbstractTypeArguments& instantiator, |
| 1954 const GrowableObjectArray& pieces) const; | 1975 const GrowableObjectArray& pieces) const; |
| 1955 RawString* BuildSignature(bool instantiate, | 1976 RawString* BuildSignature(bool instantiate, |
| 1956 NameVisibility name_visibility, | 1977 NameVisibility name_visibility, |
| 1957 const AbstractTypeArguments& instantiator) const; | 1978 const AbstractTypeArguments& instantiator) const; |
| 1958 | 1979 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2205 } | 2226 } |
| 2206 void set_owner(const Object& value) const { | 2227 void set_owner(const Object& value) const { |
| 2207 StorePointer(&raw_ptr()->owner_, value.raw()); | 2228 StorePointer(&raw_ptr()->owner_, value.raw()); |
| 2208 } | 2229 } |
| 2209 void set_token_pos(intptr_t token_pos) const { | 2230 void set_token_pos(intptr_t token_pos) const { |
| 2210 raw_ptr()->token_pos_ = token_pos; | 2231 raw_ptr()->token_pos_ = token_pos; |
| 2211 } | 2232 } |
| 2212 void set_kind_bits(intptr_t value) const { | 2233 void set_kind_bits(intptr_t value) const { |
| 2213 raw_ptr()->kind_bits_ = static_cast<uint8_t>(value); | 2234 raw_ptr()->kind_bits_ = static_cast<uint8_t>(value); |
| 2214 } | 2235 } |
| 2236 |
| 2215 static RawField* New(); | 2237 static RawField* New(); |
| 2216 | 2238 |
| 2217 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object); | 2239 FINAL_HEAP_OBJECT_IMPLEMENTATION(Field, Object); |
| 2218 friend class Class; | 2240 friend class Class; |
| 2219 friend class HeapProfiler; | 2241 friend class HeapProfiler; |
| 2220 }; | 2242 }; |
| 2221 | 2243 |
| 2222 | 2244 |
| 2223 class LiteralToken : public Object { | 2245 class LiteralToken : public Object { |
| 2224 public: | 2246 public: |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2371 | 2393 |
| 2372 static RawScript* New(const String& url, | 2394 static RawScript* New(const String& url, |
| 2373 const String& source, | 2395 const String& source, |
| 2374 RawScript::Kind kind); | 2396 RawScript::Kind kind); |
| 2375 | 2397 |
| 2376 private: | 2398 private: |
| 2377 void set_url(const String& value) const; | 2399 void set_url(const String& value) const; |
| 2378 void set_source(const String& value) const; | 2400 void set_source(const String& value) const; |
| 2379 void set_kind(RawScript::Kind value) const; | 2401 void set_kind(RawScript::Kind value) const; |
| 2380 void set_tokens(const TokenStream& value) const; | 2402 void set_tokens(const TokenStream& value) const; |
| 2403 |
| 2381 static RawScript* New(); | 2404 static RawScript* New(); |
| 2382 | 2405 |
| 2383 FINAL_HEAP_OBJECT_IMPLEMENTATION(Script, Object); | 2406 FINAL_HEAP_OBJECT_IMPLEMENTATION(Script, Object); |
| 2384 friend class Class; | 2407 friend class Class; |
| 2385 }; | 2408 }; |
| 2386 | 2409 |
| 2387 | 2410 |
| 2388 class DictionaryIterator : public ValueObject { | 2411 class DictionaryIterator : public ValueObject { |
| 2389 public: | 2412 public: |
| 2390 explicit DictionaryIterator(const Library& library); | 2413 explicit DictionaryIterator(const Library& library); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2585 | 2608 |
| 2586 | 2609 |
| 2587 // Return Function::null() if function does not exist in libs. | 2610 // Return Function::null() if function does not exist in libs. |
| 2588 static RawFunction* GetFunction(const GrowableArray<Library*>& libs, | 2611 static RawFunction* GetFunction(const GrowableArray<Library*>& libs, |
| 2589 const char* class_name, | 2612 const char* class_name, |
| 2590 const char* function_name); | 2613 const char* function_name); |
| 2591 | 2614 |
| 2592 private: | 2615 private: |
| 2593 static const int kInitialImportsCapacity = 4; | 2616 static const int kInitialImportsCapacity = 4; |
| 2594 static const int kImportsCapacityIncrement = 8; | 2617 static const int kImportsCapacityIncrement = 8; |
| 2618 |
| 2595 static RawLibrary* New(); | 2619 static RawLibrary* New(); |
| 2596 | 2620 |
| 2597 void set_num_imports(intptr_t value) const { | 2621 void set_num_imports(intptr_t value) const { |
| 2598 raw_ptr()->num_imports_ = value; | 2622 raw_ptr()->num_imports_ = value; |
| 2599 } | 2623 } |
| 2600 RawArray* imports() const { return raw_ptr()->imports_; } | 2624 RawArray* imports() const { return raw_ptr()->imports_; } |
| 2601 RawArray* exports() const { return raw_ptr()->exports_; } | 2625 RawArray* exports() const { return raw_ptr()->exports_; } |
| 2602 bool HasExports() const; | 2626 bool HasExports() const; |
| 2603 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } | 2627 RawArray* loaded_scripts() const { return raw_ptr()->loaded_scripts_; } |
| 2604 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } | 2628 RawGrowableObjectArray* metadata() const { return raw_ptr()->metadata_; } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2647 | 2671 |
| 2648 static RawLibraryPrefix* New(const String& name, const Namespace& import); | 2672 static RawLibraryPrefix* New(const String& name, const Namespace& import); |
| 2649 | 2673 |
| 2650 private: | 2674 private: |
| 2651 static const int kInitialSize = 2; | 2675 static const int kInitialSize = 2; |
| 2652 static const int kIncrementSize = 2; | 2676 static const int kIncrementSize = 2; |
| 2653 | 2677 |
| 2654 void set_name(const String& value) const; | 2678 void set_name(const String& value) const; |
| 2655 void set_imports(const Array& value) const; | 2679 void set_imports(const Array& value) const; |
| 2656 void set_num_imports(intptr_t value) const; | 2680 void set_num_imports(intptr_t value) const; |
| 2681 |
| 2657 static RawLibraryPrefix* New(); | 2682 static RawLibraryPrefix* New(); |
| 2658 | 2683 |
| 2659 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); | 2684 FINAL_HEAP_OBJECT_IMPLEMENTATION(LibraryPrefix, Object); |
| 2660 friend class Class; | 2685 friend class Class; |
| 2661 }; | 2686 }; |
| 2662 | 2687 |
| 2663 | 2688 |
| 2664 // A Namespace contains the names in a library dictionary, filtered by | 2689 // A Namespace contains the names in a library dictionary, filtered by |
| 2665 // the show/hide combinators. | 2690 // the show/hide combinators. |
| 2666 class Namespace : public Object { | 2691 class Namespace : public Object { |
| 2667 public: | 2692 public: |
| 2668 RawLibrary* library() const { return raw_ptr()->library_; } | 2693 RawLibrary* library() const { return raw_ptr()->library_; } |
| 2669 RawArray* show_names() const { return raw_ptr()->show_names_; } | 2694 RawArray* show_names() const { return raw_ptr()->show_names_; } |
| 2670 RawArray* hide_names() const { return raw_ptr()->hide_names_; } | 2695 RawArray* hide_names() const { return raw_ptr()->hide_names_; } |
| 2671 | 2696 |
| 2672 static intptr_t InstanceSize() { | 2697 static intptr_t InstanceSize() { |
| 2673 return RoundedAllocationSize(sizeof(RawNamespace)); | 2698 return RoundedAllocationSize(sizeof(RawNamespace)); |
| 2674 } | 2699 } |
| 2675 | 2700 |
| 2676 bool HidesName(const String& name) const; | 2701 bool HidesName(const String& name) const; |
| 2677 RawObject* Lookup(const String& name) const; | 2702 RawObject* Lookup(const String& name) const; |
| 2678 | 2703 |
| 2679 static RawNamespace* New(const Library& library, | 2704 static RawNamespace* New(const Library& library, |
| 2680 const Array& show_names, | 2705 const Array& show_names, |
| 2681 const Array& hide_names); | 2706 const Array& hide_names); |
| 2707 |
| 2682 private: | 2708 private: |
| 2683 static RawNamespace* New(); | 2709 static RawNamespace* New(); |
| 2684 | 2710 |
| 2685 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); | 2711 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); |
| 2686 friend class Class; | 2712 friend class Class; |
| 2687 }; | 2713 }; |
| 2688 | 2714 |
| 2689 | 2715 |
| 2690 class Instructions : public Object { | 2716 class Instructions : public Object { |
| 2691 public: | 2717 public: |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2981 // We would have a VisitPointers function here to traverse the | 3007 // We would have a VisitPointers function here to traverse the |
| 2982 // exception handler table to visit objects if any in the table. | 3008 // exception handler table to visit objects if any in the table. |
| 2983 | 3009 |
| 2984 private: | 3010 private: |
| 2985 // Pick somewhat arbitrary maximum number of exception handlers | 3011 // Pick somewhat arbitrary maximum number of exception handlers |
| 2986 // for a function. This value is used to catch potentially | 3012 // for a function. This value is used to catch potentially |
| 2987 // malicious code. | 3013 // malicious code. |
| 2988 static const intptr_t kMaxHandlers = 1024 * 1024; | 3014 static const intptr_t kMaxHandlers = 1024 * 1024; |
| 2989 | 3015 |
| 2990 void set_handled_types_data(const Array& value) const; | 3016 void set_handled_types_data(const Array& value) const; |
| 3017 |
| 2991 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object); | 3018 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object); |
| 2992 friend class Class; | 3019 friend class Class; |
| 2993 }; | 3020 }; |
| 2994 | 3021 |
| 2995 | 3022 |
| 2996 // Holds deopt information at one deoptimization point. The information consists | 3023 // Holds deopt information at one deoptimization point. The information consists |
| 2997 // of two parts: | 3024 // of two parts: |
| 2998 // - first a prefix consiting of kMaterializeObject instructions describing | 3025 // - first a prefix consiting of kMaterializeObject instructions describing |
| 2999 // objects which had their allocation removed as part of AllocationSinking | 3026 // objects which had their allocation removed as part of AllocationSinking |
| 3000 // pass and have to be materialized; | 3027 // pass and have to be materialized; |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3738 return RoundedAllocationSize(sizeof(RawApiError)); | 3765 return RoundedAllocationSize(sizeof(RawApiError)); |
| 3739 } | 3766 } |
| 3740 | 3767 |
| 3741 static RawApiError* New(const String& message, | 3768 static RawApiError* New(const String& message, |
| 3742 Heap::Space space = Heap::kNew); | 3769 Heap::Space space = Heap::kNew); |
| 3743 | 3770 |
| 3744 virtual const char* ToErrorCString() const; | 3771 virtual const char* ToErrorCString() const; |
| 3745 | 3772 |
| 3746 private: | 3773 private: |
| 3747 void set_message(const String& message) const; | 3774 void set_message(const String& message) const; |
| 3775 |
| 3748 static RawApiError* New(); | 3776 static RawApiError* New(); |
| 3749 | 3777 |
| 3750 FINAL_HEAP_OBJECT_IMPLEMENTATION(ApiError, Error); | 3778 FINAL_HEAP_OBJECT_IMPLEMENTATION(ApiError, Error); |
| 3751 friend class Class; | 3779 friend class Class; |
| 3752 }; | 3780 }; |
| 3753 | 3781 |
| 3754 | 3782 |
| 3755 class LanguageError : public Error { | 3783 class LanguageError : public Error { |
| 3756 public: | 3784 public: |
| 3757 RawString* message() const { return raw_ptr()->message_; } | 3785 RawString* message() const { return raw_ptr()->message_; } |
| 3758 static intptr_t message_offset() { | 3786 static intptr_t message_offset() { |
| 3759 return OFFSET_OF(RawLanguageError, message_); | 3787 return OFFSET_OF(RawLanguageError, message_); |
| 3760 } | 3788 } |
| 3761 | 3789 |
| 3762 static intptr_t InstanceSize() { | 3790 static intptr_t InstanceSize() { |
| 3763 return RoundedAllocationSize(sizeof(RawLanguageError)); | 3791 return RoundedAllocationSize(sizeof(RawLanguageError)); |
| 3764 } | 3792 } |
| 3765 | 3793 |
| 3766 static RawLanguageError* New(const String& message, | 3794 static RawLanguageError* New(const String& message, |
| 3767 Heap::Space space = Heap::kNew); | 3795 Heap::Space space = Heap::kNew); |
| 3768 | 3796 |
| 3769 virtual const char* ToErrorCString() const; | 3797 virtual const char* ToErrorCString() const; |
| 3770 | 3798 |
| 3771 private: | 3799 private: |
| 3772 void set_message(const String& message) const; | 3800 void set_message(const String& message) const; |
| 3801 |
| 3773 static RawLanguageError* New(); | 3802 static RawLanguageError* New(); |
| 3774 | 3803 |
| 3775 FINAL_HEAP_OBJECT_IMPLEMENTATION(LanguageError, Error); | 3804 FINAL_HEAP_OBJECT_IMPLEMENTATION(LanguageError, Error); |
| 3776 friend class Class; | 3805 friend class Class; |
| 3777 }; | 3806 }; |
| 3778 | 3807 |
| 3779 | 3808 |
| 3780 class UnhandledException : public Error { | 3809 class UnhandledException : public Error { |
| 3781 public: | 3810 public: |
| 3782 RawInstance* exception() const { return raw_ptr()->exception_; } | 3811 RawInstance* exception() const { return raw_ptr()->exception_; } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3906 return FieldAddrAtOffset(field.Offset()); | 3935 return FieldAddrAtOffset(field.Offset()); |
| 3907 } | 3936 } |
| 3908 RawObject** NativeFieldsAddr() const { | 3937 RawObject** NativeFieldsAddr() const { |
| 3909 return FieldAddrAtOffset(sizeof(RawObject)); | 3938 return FieldAddrAtOffset(sizeof(RawObject)); |
| 3910 } | 3939 } |
| 3911 void SetFieldAtOffset(intptr_t offset, const Object& value) const { | 3940 void SetFieldAtOffset(intptr_t offset, const Object& value) const { |
| 3912 StorePointer(FieldAddrAtOffset(offset), value.raw()); | 3941 StorePointer(FieldAddrAtOffset(offset), value.raw()); |
| 3913 } | 3942 } |
| 3914 bool IsValidFieldOffset(int offset) const; | 3943 bool IsValidFieldOffset(int offset) const; |
| 3915 | 3944 |
| 3945 static intptr_t NextFieldOffset() { |
| 3946 return sizeof(RawInstance); |
| 3947 } |
| 3948 |
| 3916 // TODO(iposva): Determine if this gets in the way of Smi. | 3949 // TODO(iposva): Determine if this gets in the way of Smi. |
| 3917 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); | 3950 HEAP_OBJECT_IMPLEMENTATION(Instance, Object); |
| 3918 friend class Class; | 3951 friend class Class; |
| 3919 friend class Closure; | 3952 friend class Closure; |
| 3953 friend class SnapshotWriter; |
| 3954 friend class StubCode; |
| 3920 friend class TypedDataView; | 3955 friend class TypedDataView; |
| 3921 }; | 3956 }; |
| 3922 | 3957 |
| 3923 | 3958 |
| 3924 // AbstractType is an abstract superclass. | 3959 // AbstractType is an abstract superclass. |
| 3925 // Subclasses of AbstractType are Type and TypeParameter. | 3960 // Subclasses of AbstractType are Type and TypeParameter. |
| 3926 class AbstractType : public Instance { | 3961 class AbstractType : public Instance { |
| 3927 public: | 3962 public: |
| 3928 virtual bool IsFinalized() const; | 3963 virtual bool IsFinalized() const; |
| 3929 virtual bool IsBeingFinalized() const; | 3964 virtual bool IsBeingFinalized() const; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4000 | 4035 |
| 4001 // Check if this type represents the 'int' type. | 4036 // Check if this type represents the 'int' type. |
| 4002 bool IsIntType() const; | 4037 bool IsIntType() const; |
| 4003 | 4038 |
| 4004 // Check if this type represents the 'double' type. | 4039 // Check if this type represents the 'double' type. |
| 4005 bool IsDoubleType() const; | 4040 bool IsDoubleType() const; |
| 4006 | 4041 |
| 4007 // Check if this type represents the 'Float32x4' type. | 4042 // Check if this type represents the 'Float32x4' type. |
| 4008 bool IsFloat32x4Type() const; | 4043 bool IsFloat32x4Type() const; |
| 4009 | 4044 |
| 4010 // Check if this type represents the 'Uint32x4' type. | 4045 // Check if this type represents the 'Int32x4' type. |
| 4011 bool IsUint32x4Type() const; | 4046 bool IsInt32x4Type() const; |
| 4012 | 4047 |
| 4013 // Check if this type represents the 'num' type. | 4048 // Check if this type represents the 'num' type. |
| 4014 bool IsNumberType() const; | 4049 bool IsNumberType() const; |
| 4015 | 4050 |
| 4016 // Check if this type represents the 'String' type. | 4051 // Check if this type represents the 'String' type. |
| 4017 bool IsStringType() const; | 4052 bool IsStringType() const; |
| 4018 | 4053 |
| 4019 // Check if this type represents the 'Function' type. | 4054 // Check if this type represents the 'Function' type. |
| 4020 bool IsFunctionType() const; | 4055 bool IsFunctionType() const; |
| 4021 | 4056 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4122 | 4157 |
| 4123 // The 'Mint' type. | 4158 // The 'Mint' type. |
| 4124 static RawType* MintType(); | 4159 static RawType* MintType(); |
| 4125 | 4160 |
| 4126 // The 'double' type. | 4161 // The 'double' type. |
| 4127 static RawType* Double(); | 4162 static RawType* Double(); |
| 4128 | 4163 |
| 4129 // The 'Float32x4' type. | 4164 // The 'Float32x4' type. |
| 4130 static RawType* Float32x4(); | 4165 static RawType* Float32x4(); |
| 4131 | 4166 |
| 4132 // The 'Uint32x4' type. | 4167 // The 'Int32x4' type. |
| 4133 static RawType* Uint32x4(); | 4168 static RawType* Int32x4(); |
| 4134 | 4169 |
| 4135 // The 'num' type. | 4170 // The 'num' type. |
| 4136 static RawType* Number(); | 4171 static RawType* Number(); |
| 4137 | 4172 |
| 4138 // The 'String' type. | 4173 // The 'String' type. |
| 4139 static RawType* StringType(); | 4174 static RawType* StringType(); |
| 4140 | 4175 |
| 4141 // The 'Array' type. | 4176 // The 'Array' type. |
| 4142 static RawType* ArrayType(); | 4177 static RawType* ArrayType(); |
| 4143 | 4178 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4218 intptr_t index, | 4253 intptr_t index, |
| 4219 const String& name, | 4254 const String& name, |
| 4220 const AbstractType& bound, | 4255 const AbstractType& bound, |
| 4221 intptr_t token_pos); | 4256 intptr_t token_pos); |
| 4222 | 4257 |
| 4223 private: | 4258 private: |
| 4224 void set_parameterized_class(const Class& value) const; | 4259 void set_parameterized_class(const Class& value) const; |
| 4225 void set_name(const String& value) const; | 4260 void set_name(const String& value) const; |
| 4226 void set_token_pos(intptr_t token_pos) const; | 4261 void set_token_pos(intptr_t token_pos) const; |
| 4227 void set_type_state(int8_t state) const; | 4262 void set_type_state(int8_t state) const; |
| 4263 |
| 4228 static RawTypeParameter* New(); | 4264 static RawTypeParameter* New(); |
| 4229 | 4265 |
| 4230 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType); | 4266 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType); |
| 4231 friend class Class; | 4267 friend class Class; |
| 4232 }; | 4268 }; |
| 4233 | 4269 |
| 4234 | 4270 |
| 4235 // A BoundedType represents a type instantiated at compile time from a type | 4271 // 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 | 4272 // 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 | 4273 // because the type or the bound are still uninstantiated or can be checked and |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4471 void operator=(RawSmi* value) { | 4507 void operator=(RawSmi* value) { |
| 4472 raw_ = value; | 4508 raw_ = value; |
| 4473 CHECK_HANDLE(); | 4509 CHECK_HANDLE(); |
| 4474 } | 4510 } |
| 4475 void operator^=(RawObject* value) { | 4511 void operator^=(RawObject* value) { |
| 4476 raw_ = value; | 4512 raw_ = value; |
| 4477 CHECK_HANDLE(); | 4513 CHECK_HANDLE(); |
| 4478 } | 4514 } |
| 4479 | 4515 |
| 4480 private: | 4516 private: |
| 4517 static intptr_t NextFieldOffset() { |
| 4518 // Indicates this class cannot be extended by dart code. |
| 4519 return -kWordSize; |
| 4520 } |
| 4521 |
| 4481 static intptr_t ValueFromRaw(uword raw_value) { | 4522 static intptr_t ValueFromRaw(uword raw_value) { |
| 4482 intptr_t value = raw_value; | 4523 intptr_t value = raw_value; |
| 4483 ASSERT((value & kSmiTagMask) == kSmiTag); | 4524 ASSERT((value & kSmiTagMask) == kSmiTag); |
| 4484 return (value >> kSmiTagShift); | 4525 return (value >> kSmiTagShift); |
| 4485 } | 4526 } |
| 4527 |
| 4486 static cpp_vtable handle_vtable_; | 4528 static cpp_vtable handle_vtable_; |
| 4487 | 4529 |
| 4488 Smi() : Integer() {} | 4530 Smi() : Integer() {} |
| 4489 BASE_OBJECT_IMPLEMENTATION(Smi, Integer); | 4531 BASE_OBJECT_IMPLEMENTATION(Smi, Integer); |
| 4490 | 4532 |
| 4491 friend class Api; // For ValueFromRaw | 4533 friend class Api; // For ValueFromRaw |
| 4492 friend class Class; | 4534 friend class Class; |
| 4493 friend class Object; | 4535 friend class Object; |
| 4494 }; | 4536 }; |
| 4495 | 4537 |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5194 raw_ptr(str)->external_data_ = data; | 5236 raw_ptr(str)->external_data_ = data; |
| 5195 } | 5237 } |
| 5196 | 5238 |
| 5197 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); | 5239 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); |
| 5198 | 5240 |
| 5199 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader, | 5241 static RawExternalOneByteString* ReadFrom(SnapshotReader* reader, |
| 5200 intptr_t object_id, | 5242 intptr_t object_id, |
| 5201 intptr_t tags, | 5243 intptr_t tags, |
| 5202 Snapshot::Kind kind); | 5244 Snapshot::Kind kind); |
| 5203 | 5245 |
| 5246 static intptr_t NextFieldOffset() { |
| 5247 // Indicates this class cannot be extended by dart code. |
| 5248 return -kWordSize; |
| 5249 } |
| 5250 |
| 5204 friend class Class; | 5251 friend class Class; |
| 5205 friend class String; | 5252 friend class String; |
| 5206 friend class SnapshotReader; | 5253 friend class SnapshotReader; |
| 5207 }; | 5254 }; |
| 5208 | 5255 |
| 5209 | 5256 |
| 5210 class ExternalTwoByteString : public AllStatic { | 5257 class ExternalTwoByteString : public AllStatic { |
| 5211 public: | 5258 public: |
| 5212 static int32_t CharAt(const String& str, intptr_t index) { | 5259 static int32_t CharAt(const String& str, intptr_t index) { |
| 5213 return *CharAddr(str, index); | 5260 return *CharAddr(str, index); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5260 raw_ptr(str)->external_data_ = data; | 5307 raw_ptr(str)->external_data_ = data; |
| 5261 } | 5308 } |
| 5262 | 5309 |
| 5263 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); | 5310 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); |
| 5264 | 5311 |
| 5265 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader, | 5312 static RawExternalTwoByteString* ReadFrom(SnapshotReader* reader, |
| 5266 intptr_t object_id, | 5313 intptr_t object_id, |
| 5267 intptr_t tags, | 5314 intptr_t tags, |
| 5268 Snapshot::Kind kind); | 5315 Snapshot::Kind kind); |
| 5269 | 5316 |
| 5317 static intptr_t NextFieldOffset() { |
| 5318 // Indicates this class cannot be extended by dart code. |
| 5319 return -kWordSize; |
| 5320 } |
| 5321 |
| 5270 friend class Class; | 5322 friend class Class; |
| 5271 friend class String; | 5323 friend class String; |
| 5272 friend class SnapshotReader; | 5324 friend class SnapshotReader; |
| 5273 }; | 5325 }; |
| 5274 | 5326 |
| 5275 | 5327 |
| 5276 // Class Bool implements Dart core class bool. | 5328 // Class Bool implements Dart core class bool. |
| 5277 class Bool : public Instance { | 5329 class Bool : public Instance { |
| 5278 public: | 5330 public: |
| 5279 bool value() const { | 5331 bool value() const { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5429 | 5481 |
| 5430 static intptr_t InstanceSize() { | 5482 static intptr_t InstanceSize() { |
| 5431 return Array::InstanceSize(); | 5483 return Array::InstanceSize(); |
| 5432 } | 5484 } |
| 5433 | 5485 |
| 5434 static intptr_t InstanceSize(intptr_t len) { | 5486 static intptr_t InstanceSize(intptr_t len) { |
| 5435 return Array::InstanceSize(len); | 5487 return Array::InstanceSize(len); |
| 5436 } | 5488 } |
| 5437 | 5489 |
| 5438 private: | 5490 private: |
| 5491 static intptr_t NextFieldOffset() { |
| 5492 // Indicates this class cannot be extended by dart code. |
| 5493 return -kWordSize; |
| 5494 } |
| 5495 |
| 5439 static RawImmutableArray* raw(const Array& array) { | 5496 static RawImmutableArray* raw(const Array& array) { |
| 5440 return reinterpret_cast<RawImmutableArray*>(array.raw()); | 5497 return reinterpret_cast<RawImmutableArray*>(array.raw()); |
| 5441 } | 5498 } |
| 5442 | 5499 |
| 5443 friend class Class; | 5500 friend class Class; |
| 5444 }; | 5501 }; |
| 5445 | 5502 |
| 5446 | 5503 |
| 5447 class GrowableObjectArray : public Instance { | 5504 class GrowableObjectArray : public Instance { |
| 5448 public: | 5505 public: |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5587 static intptr_t value_offset() { | 5644 static intptr_t value_offset() { |
| 5588 return OFFSET_OF(RawFloat32x4, value_); | 5645 return OFFSET_OF(RawFloat32x4, value_); |
| 5589 } | 5646 } |
| 5590 | 5647 |
| 5591 private: | 5648 private: |
| 5592 FINAL_HEAP_OBJECT_IMPLEMENTATION(Float32x4, Instance); | 5649 FINAL_HEAP_OBJECT_IMPLEMENTATION(Float32x4, Instance); |
| 5593 friend class Class; | 5650 friend class Class; |
| 5594 }; | 5651 }; |
| 5595 | 5652 |
| 5596 | 5653 |
| 5597 class Uint32x4 : public Instance { | 5654 class Int32x4 : public Instance { |
| 5598 public: | 5655 public: |
| 5599 static RawUint32x4* New(uint32_t value0, uint32_t value1, uint32_t value2, | 5656 static RawInt32x4* New(int32_t value0, int32_t value1, int32_t value2, |
| 5600 uint32_t value3, Heap::Space space = Heap::kNew); | 5657 int32_t value3, Heap::Space space = Heap::kNew); |
| 5601 static RawUint32x4* New(simd128_value_t value, | 5658 static RawInt32x4* New(simd128_value_t value, |
| 5602 Heap::Space space = Heap::kNew); | 5659 Heap::Space space = Heap::kNew); |
| 5603 | 5660 |
| 5604 uint32_t x() const; | 5661 int32_t x() const; |
| 5605 uint32_t y() const; | 5662 int32_t y() const; |
| 5606 uint32_t z() const; | 5663 int32_t z() const; |
| 5607 uint32_t w() const; | 5664 int32_t w() const; |
| 5608 | 5665 |
| 5609 void set_x(uint32_t x) const; | 5666 void set_x(int32_t x) const; |
| 5610 void set_y(uint32_t y) const; | 5667 void set_y(int32_t y) const; |
| 5611 void set_z(uint32_t z) const; | 5668 void set_z(int32_t z) const; |
| 5612 void set_w(uint32_t w) const; | 5669 void set_w(int32_t w) const; |
| 5613 | 5670 |
| 5614 simd128_value_t value() const; | 5671 simd128_value_t value() const; |
| 5615 void set_value(simd128_value_t value) const; | 5672 void set_value(simd128_value_t value) const; |
| 5616 | 5673 |
| 5617 static intptr_t InstanceSize() { | 5674 static intptr_t InstanceSize() { |
| 5618 return RoundedAllocationSize(sizeof(RawUint32x4)); | 5675 return RoundedAllocationSize(sizeof(RawInt32x4)); |
| 5619 } | 5676 } |
| 5620 | 5677 |
| 5621 static intptr_t value_offset() { | 5678 static intptr_t value_offset() { |
| 5622 return OFFSET_OF(RawUint32x4, value_); | 5679 return OFFSET_OF(RawInt32x4, value_); |
| 5623 } | 5680 } |
| 5624 | 5681 |
| 5625 private: | 5682 private: |
| 5626 FINAL_HEAP_OBJECT_IMPLEMENTATION(Uint32x4, Instance); | 5683 FINAL_HEAP_OBJECT_IMPLEMENTATION(Int32x4, Instance); |
| 5627 friend class Class; | 5684 friend class Class; |
| 5628 }; | 5685 }; |
| 5629 | 5686 |
| 5630 | 5687 |
| 5631 class TypedData : public Instance { | 5688 class TypedData : public Instance { |
| 5632 public: | 5689 public: |
| 5633 intptr_t Length() const { | 5690 intptr_t Length() const { |
| 5634 ASSERT(!IsNull()); | 5691 ASSERT(!IsNull()); |
| 5635 return Smi::Value(raw_ptr()->length_); | 5692 return Smi::Value(raw_ptr()->length_); |
| 5636 } | 5693 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5668 TYPED_GETTER_SETTER(Uint8, uint8_t) | 5725 TYPED_GETTER_SETTER(Uint8, uint8_t) |
| 5669 TYPED_GETTER_SETTER(Int16, int16_t) | 5726 TYPED_GETTER_SETTER(Int16, int16_t) |
| 5670 TYPED_GETTER_SETTER(Uint16, uint16_t) | 5727 TYPED_GETTER_SETTER(Uint16, uint16_t) |
| 5671 TYPED_GETTER_SETTER(Int32, int32_t) | 5728 TYPED_GETTER_SETTER(Int32, int32_t) |
| 5672 TYPED_GETTER_SETTER(Uint32, uint32_t) | 5729 TYPED_GETTER_SETTER(Uint32, uint32_t) |
| 5673 TYPED_GETTER_SETTER(Int64, int64_t) | 5730 TYPED_GETTER_SETTER(Int64, int64_t) |
| 5674 TYPED_GETTER_SETTER(Uint64, uint64_t) | 5731 TYPED_GETTER_SETTER(Uint64, uint64_t) |
| 5675 TYPED_GETTER_SETTER(Float32, float) | 5732 TYPED_GETTER_SETTER(Float32, float) |
| 5676 TYPED_GETTER_SETTER(Float64, double) | 5733 TYPED_GETTER_SETTER(Float64, double) |
| 5677 TYPED_GETTER_SETTER(Float32x4, simd128_value_t) | 5734 TYPED_GETTER_SETTER(Float32x4, simd128_value_t) |
| 5678 TYPED_GETTER_SETTER(Uint32x4, simd128_value_t) | 5735 TYPED_GETTER_SETTER(Int32x4, simd128_value_t) |
| 5679 | 5736 |
| 5680 #undef TYPED_GETTER_SETTER | 5737 #undef TYPED_GETTER_SETTER |
| 5681 | 5738 |
| 5682 static intptr_t length_offset() { | 5739 static intptr_t length_offset() { |
| 5683 return OFFSET_OF(RawTypedData, length_); | 5740 return OFFSET_OF(RawTypedData, length_); |
| 5684 } | 5741 } |
| 5685 | 5742 |
| 5686 static intptr_t data_offset() { | 5743 static intptr_t data_offset() { |
| 5687 return OFFSET_OF(RawTypedData, data_); | 5744 return OFFSET_OF(RawTypedData, data_); |
| 5688 } | 5745 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5802 TYPED_GETTER_SETTER(Uint8, uint8_t) | 5859 TYPED_GETTER_SETTER(Uint8, uint8_t) |
| 5803 TYPED_GETTER_SETTER(Int16, int16_t) | 5860 TYPED_GETTER_SETTER(Int16, int16_t) |
| 5804 TYPED_GETTER_SETTER(Uint16, uint16_t) | 5861 TYPED_GETTER_SETTER(Uint16, uint16_t) |
| 5805 TYPED_GETTER_SETTER(Int32, int32_t) | 5862 TYPED_GETTER_SETTER(Int32, int32_t) |
| 5806 TYPED_GETTER_SETTER(Uint32, uint32_t) | 5863 TYPED_GETTER_SETTER(Uint32, uint32_t) |
| 5807 TYPED_GETTER_SETTER(Int64, int64_t) | 5864 TYPED_GETTER_SETTER(Int64, int64_t) |
| 5808 TYPED_GETTER_SETTER(Uint64, uint64_t) | 5865 TYPED_GETTER_SETTER(Uint64, uint64_t) |
| 5809 TYPED_GETTER_SETTER(Float32, float) | 5866 TYPED_GETTER_SETTER(Float32, float) |
| 5810 TYPED_GETTER_SETTER(Float64, double) | 5867 TYPED_GETTER_SETTER(Float64, double) |
| 5811 TYPED_GETTER_SETTER(Float32x4, simd128_value_t) | 5868 TYPED_GETTER_SETTER(Float32x4, simd128_value_t) |
| 5812 TYPED_GETTER_SETTER(Uint32x4, simd128_value_t); | 5869 TYPED_GETTER_SETTER(Int32x4, simd128_value_t); |
| 5813 | 5870 |
| 5814 #undef TYPED_GETTER_SETTER | 5871 #undef TYPED_GETTER_SETTER |
| 5815 | 5872 |
| 5816 FinalizablePersistentHandle* AddFinalizer( | 5873 FinalizablePersistentHandle* AddFinalizer( |
| 5817 void* peer, Dart_WeakPersistentHandleFinalizer callback) const; | 5874 void* peer, Dart_WeakPersistentHandleFinalizer callback) const; |
| 5818 | 5875 |
| 5819 static intptr_t length_offset() { | 5876 static intptr_t length_offset() { |
| 5820 return OFFSET_OF(RawExternalTypedData, length_); | 5877 return OFFSET_OF(RawExternalTypedData, length_); |
| 5821 } | 5878 } |
| 5822 | 5879 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5900 | 5957 |
| 5901 static bool IsExternalTypedDataView(const Instance& view_obj) { | 5958 static bool IsExternalTypedDataView(const Instance& view_obj) { |
| 5902 const Instance& data = Instance::Handle(Data(view_obj)); | 5959 const Instance& data = Instance::Handle(Data(view_obj)); |
| 5903 intptr_t cid = data.raw()->GetClassId(); | 5960 intptr_t cid = data.raw()->GetClassId(); |
| 5904 ASSERT(RawObject::IsTypedDataClassId(cid) || | 5961 ASSERT(RawObject::IsTypedDataClassId(cid) || |
| 5905 RawObject::IsExternalTypedDataClassId(cid)); | 5962 RawObject::IsExternalTypedDataClassId(cid)); |
| 5906 return RawObject::IsExternalTypedDataClassId(cid); | 5963 return RawObject::IsExternalTypedDataClassId(cid); |
| 5907 } | 5964 } |
| 5908 | 5965 |
| 5909 static intptr_t NumberOfFields() { | 5966 static intptr_t NumberOfFields() { |
| 5910 return (kLengthOffset - kTypeArguments); | 5967 return kLengthOffset; |
| 5911 } | 5968 } |
| 5912 | 5969 |
| 5913 static intptr_t data_offset() { | 5970 static intptr_t data_offset() { |
| 5914 return kWordSize * kDataOffset; | 5971 return kWordSize * kDataOffset; |
| 5915 } | 5972 } |
| 5916 | 5973 |
| 5917 static intptr_t offset_in_bytes_offset() { | 5974 static intptr_t offset_in_bytes_offset() { |
| 5918 return kWordSize * kOffsetInBytesOffset; | 5975 return kWordSize * kOffsetInBytesOffset; |
| 5919 } | 5976 } |
| 5920 | 5977 |
| 5921 static intptr_t length_offset() { | 5978 static intptr_t length_offset() { |
| 5922 return kWordSize * kLengthOffset; | 5979 return kWordSize * kLengthOffset; |
| 5923 } | 5980 } |
| 5924 | 5981 |
| 5925 static intptr_t ElementSizeInBytes(intptr_t class_id) { | 5982 static intptr_t ElementSizeInBytes(intptr_t class_id) { |
| 5926 ASSERT(RawObject::IsTypedDataViewClassId(class_id)); | 5983 ASSERT(RawObject::IsTypedDataViewClassId(class_id)); |
| 5927 return (class_id == kByteDataViewCid) ? | 5984 return (class_id == kByteDataViewCid) ? |
| 5928 TypedData::element_size[kTypedDataInt8ArrayCid] : | 5985 TypedData::element_size[kTypedDataInt8ArrayCid] : |
| 5929 TypedData::element_size[class_id - kTypedDataInt8ArrayViewCid]; | 5986 TypedData::element_size[class_id - kTypedDataInt8ArrayViewCid]; |
| 5930 } | 5987 } |
| 5931 | 5988 |
| 5932 private: | 5989 private: |
| 5933 enum { | 5990 enum { |
| 5934 kTypeArguments = 1, | 5991 kDataOffset = 1, |
| 5935 kDataOffset = 2, | 5992 kOffsetInBytesOffset = 2, |
| 5936 kOffsetInBytesOffset = 3, | 5993 kLengthOffset = 3, |
| 5937 kLengthOffset = 4, | |
| 5938 }; | 5994 }; |
| 5939 }; | 5995 }; |
| 5940 | 5996 |
| 5941 | 5997 |
| 5942 class Closure : public AllStatic { | 5998 class Closure : public AllStatic { |
| 5943 public: | 5999 public: |
| 5944 static RawFunction* function(const Instance& closure) { | 6000 static RawFunction* function(const Instance& closure) { |
| 5945 return *FunctionAddr(closure); | 6001 return *FunctionAddr(closure); |
| 5946 } | 6002 } |
| 5947 static intptr_t function_offset() { | 6003 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()); | 6056 reinterpret_cast<intptr_t>(obj.raw_ptr()) + context_offset()); |
| 6001 } | 6057 } |
| 6002 static void set_function(const Instance& closure, | 6058 static void set_function(const Instance& closure, |
| 6003 const Function& value) { | 6059 const Function& value) { |
| 6004 closure.StorePointer(FunctionAddr(closure), value.raw()); | 6060 closure.StorePointer(FunctionAddr(closure), value.raw()); |
| 6005 } | 6061 } |
| 6006 static void set_context(const Instance& closure, | 6062 static void set_context(const Instance& closure, |
| 6007 const Context& value) { | 6063 const Context& value) { |
| 6008 closure.StorePointer(ContextAddr(closure), value.raw()); | 6064 closure.StorePointer(ContextAddr(closure), value.raw()); |
| 6009 } | 6065 } |
| 6066 static intptr_t NextFieldOffset() { |
| 6067 // Indicates this class cannot be extended by dart code. |
| 6068 return -kWordSize; |
| 6069 } |
| 6010 | 6070 |
| 6011 friend class Class; | 6071 friend class Class; |
| 6012 }; | 6072 }; |
| 6013 | 6073 |
| 6014 | 6074 |
| 6015 // Internal stacktrace object used in exceptions for printing stack traces. | 6075 // Internal stacktrace object used in exceptions for printing stack traces. |
| 6016 class Stacktrace : public Instance { | 6076 class Stacktrace : public Instance { |
| 6017 public: | 6077 public: |
| 6018 static const int kPreallocatedStackdepth = 10; | 6078 static const int kPreallocatedStackdepth = 10; |
| 6019 | 6079 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6321 | 6381 |
| 6322 | 6382 |
| 6323 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6383 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6324 intptr_t index) { | 6384 intptr_t index) { |
| 6325 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6385 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6326 } | 6386 } |
| 6327 | 6387 |
| 6328 } // namespace dart | 6388 } // namespace dart |
| 6329 | 6389 |
| 6330 #endif // VM_OBJECT_H_ | 6390 #endif // VM_OBJECT_H_ |
| OLD | NEW |