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

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

Issue 154393003: Implement eager instantiation and canonicalization of type arguments at run (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 return *null_array_; 351 return *null_array_;
352 } 352 }
353 static const String& null_string() { 353 static const String& null_string() {
354 ASSERT(null_string_ != NULL); 354 ASSERT(null_string_ != NULL);
355 return *null_string_; 355 return *null_string_;
356 } 356 }
357 static const Instance& null_instance() { 357 static const Instance& null_instance() {
358 ASSERT(null_instance_ != NULL); 358 ASSERT(null_instance_ != NULL);
359 return *null_instance_; 359 return *null_instance_;
360 } 360 }
361 static const AbstractTypeArguments& null_abstract_type_arguments() { 361 static const TypeArguments& null_type_arguments() {
362 ASSERT(null_abstract_type_arguments_ != NULL); 362 ASSERT(null_type_arguments_ != NULL);
363 return *null_abstract_type_arguments_; 363 return *null_type_arguments_;
364 } 364 }
365 365
366 static const Array& empty_array() { 366 static const Array& empty_array() {
367 ASSERT(empty_array_ != NULL); 367 ASSERT(empty_array_ != NULL);
368 return *empty_array_; 368 return *empty_array_;
369 } 369 }
370 370
371 static const PcDescriptors& empty_descriptors() { 371 static const PcDescriptors& empty_descriptors() {
372 ASSERT(empty_descriptors_ != NULL); 372 ASSERT(empty_descriptors_ != NULL);
373 return *empty_descriptors_; 373 return *empty_descriptors_;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 return *branch_offset_error_; 420 return *branch_offset_error_;
421 } 421 }
422 422
423 static RawClass* class_class() { return class_class_; } 423 static RawClass* class_class() { return class_class_; }
424 static RawClass* dynamic_class() { return dynamic_class_; } 424 static RawClass* dynamic_class() { return dynamic_class_; }
425 static RawClass* void_class() { return void_class_; } 425 static RawClass* void_class() { return void_class_; }
426 static RawType* dynamic_type() { return dynamic_type_; } 426 static RawType* dynamic_type() { return dynamic_type_; }
427 static RawType* void_type() { return void_type_; } 427 static RawType* void_type() { return void_type_; }
428 static RawClass* unresolved_class_class() { return unresolved_class_class_; } 428 static RawClass* unresolved_class_class() { return unresolved_class_class_; }
429 static RawClass* type_arguments_class() { return type_arguments_class_; } 429 static RawClass* type_arguments_class() { return type_arguments_class_; }
430 static RawClass* instantiated_type_arguments_class() {
431 return instantiated_type_arguments_class_;
432 }
433 static RawClass* patch_class_class() { return patch_class_class_; } 430 static RawClass* patch_class_class() { return patch_class_class_; }
434 static RawClass* function_class() { return function_class_; } 431 static RawClass* function_class() { return function_class_; }
435 static RawClass* closure_data_class() { return closure_data_class_; } 432 static RawClass* closure_data_class() { return closure_data_class_; }
436 static RawClass* redirection_data_class() { return redirection_data_class_; } 433 static RawClass* redirection_data_class() { return redirection_data_class_; }
437 static RawClass* field_class() { return field_class_; } 434 static RawClass* field_class() { return field_class_; }
438 static RawClass* literal_token_class() { return literal_token_class_; } 435 static RawClass* literal_token_class() { return literal_token_class_; }
439 static RawClass* token_stream_class() { return token_stream_class_; } 436 static RawClass* token_stream_class() { return token_stream_class_; }
440 static RawClass* script_class() { return script_class_; } 437 static RawClass* script_class() { return script_class_; }
441 static RawClass* library_class() { return library_class_; } 438 static RawClass* library_class() { return library_class_; }
442 static RawClass* library_prefix_class() { return library_prefix_class_; } 439 static RawClass* library_prefix_class() { return library_prefix_class_; }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 // The static values below are singletons shared between the different 570 // The static values below are singletons shared between the different
574 // isolates. They are all allocated in the non-GC'd Dart::vm_isolate_. 571 // isolates. They are all allocated in the non-GC'd Dart::vm_isolate_.
575 static RawObject* null_; 572 static RawObject* null_;
576 573
577 static RawClass* class_class_; // Class of the Class vm object. 574 static RawClass* class_class_; // Class of the Class vm object.
578 static RawClass* dynamic_class_; // Class of the 'dynamic' type. 575 static RawClass* dynamic_class_; // Class of the 'dynamic' type.
579 static RawClass* void_class_; // Class of the 'void' type. 576 static RawClass* void_class_; // Class of the 'void' type.
580 static RawType* dynamic_type_; // Class of the 'dynamic' type. 577 static RawType* dynamic_type_; // Class of the 'dynamic' type.
581 static RawType* void_type_; // Class of the 'void' type. 578 static RawType* void_type_; // Class of the 'void' type.
582 static RawClass* unresolved_class_class_; // Class of UnresolvedClass. 579 static RawClass* unresolved_class_class_; // Class of UnresolvedClass.
583 // Class of the TypeArguments vm object. 580 static RawClass* type_arguments_class_; // Class of TypeArguments vm object.
584 static RawClass* type_arguments_class_;
585 static RawClass* instantiated_type_arguments_class_; // Class of Inst..ments.
586 static RawClass* patch_class_class_; // Class of the PatchClass vm object. 581 static RawClass* patch_class_class_; // Class of the PatchClass vm object.
587 static RawClass* function_class_; // Class of the Function vm object. 582 static RawClass* function_class_; // Class of the Function vm object.
588 static RawClass* closure_data_class_; // Class of ClosureData vm obj. 583 static RawClass* closure_data_class_; // Class of ClosureData vm obj.
589 static RawClass* redirection_data_class_; // Class of RedirectionData vm obj. 584 static RawClass* redirection_data_class_; // Class of RedirectionData vm obj.
590 static RawClass* field_class_; // Class of the Field vm object. 585 static RawClass* field_class_; // Class of the Field vm object.
591 static RawClass* literal_token_class_; // Class of LiteralToken vm object. 586 static RawClass* literal_token_class_; // Class of LiteralToken vm object.
592 static RawClass* token_stream_class_; // Class of the TokenStream vm object. 587 static RawClass* token_stream_class_; // Class of the TokenStream vm object.
593 static RawClass* script_class_; // Class of the Script vm object. 588 static RawClass* script_class_; // Class of the Script vm object.
594 static RawClass* library_class_; // Class of the Library vm object. 589 static RawClass* library_class_; // Class of the Library vm object.
595 static RawClass* library_prefix_class_; // Class of Library prefix vm object. 590 static RawClass* library_prefix_class_; // Class of Library prefix vm object.
(...skipping 14 matching lines...) Expand all
610 static RawClass* language_error_class_; // Class of LanguageError. 605 static RawClass* language_error_class_; // Class of LanguageError.
611 static RawClass* unhandled_exception_class_; // Class of UnhandledException. 606 static RawClass* unhandled_exception_class_; // Class of UnhandledException.
612 static RawClass* unwind_error_class_; // Class of UnwindError. 607 static RawClass* unwind_error_class_; // Class of UnwindError.
613 608
614 // The static values below are read-only handle pointers for singleton 609 // The static values below are read-only handle pointers for singleton
615 // objects that are shared between the different isolates. 610 // objects that are shared between the different isolates.
616 static Object* null_object_; 611 static Object* null_object_;
617 static Array* null_array_; 612 static Array* null_array_;
618 static String* null_string_; 613 static String* null_string_;
619 static Instance* null_instance_; 614 static Instance* null_instance_;
620 static AbstractTypeArguments* null_abstract_type_arguments_; 615 static TypeArguments* null_type_arguments_;
621 static Array* empty_array_; 616 static Array* empty_array_;
622 static PcDescriptors* empty_descriptors_; 617 static PcDescriptors* empty_descriptors_;
623 static Instance* sentinel_; 618 static Instance* sentinel_;
624 static Instance* transition_sentinel_; 619 static Instance* transition_sentinel_;
625 static Instance* unknown_constant_; 620 static Instance* unknown_constant_;
626 static Instance* non_constant_; 621 static Instance* non_constant_;
627 static Bool* bool_true_; 622 static Bool* bool_true_;
628 static Bool* bool_false_; 623 static Bool* bool_false_;
629 static Smi* smi_illegal_cid_; 624 static Smi* smi_illegal_cid_;
630 static LanguageError* snapshot_writer_error_; 625 static LanguageError* snapshot_writer_error_;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 } 845 }
851 static bool IsSignatureClass(RawClass* cls) { 846 static bool IsSignatureClass(RawClass* cls) {
852 return cls->ptr()->signature_function_ != Object::null(); 847 return cls->ptr()->signature_function_ != Object::null();
853 } 848 }
854 849
855 // Check if this class represents a canonical signature class, i.e. not an 850 // Check if this class represents a canonical signature class, i.e. not an
856 // alias as defined in a typedef. 851 // alias as defined in a typedef.
857 bool IsCanonicalSignatureClass() const; 852 bool IsCanonicalSignatureClass() const;
858 853
859 // Check the subtype relationship. 854 // Check the subtype relationship.
860 bool IsSubtypeOf(const AbstractTypeArguments& type_arguments, 855 bool IsSubtypeOf(const TypeArguments& type_arguments,
861 const Class& other, 856 const Class& other,
862 const AbstractTypeArguments& other_type_arguments, 857 const TypeArguments& other_type_arguments,
863 Error* bound_error) const { 858 Error* bound_error) const {
864 return TypeTest(kIsSubtypeOf, 859 return TypeTest(kIsSubtypeOf,
865 type_arguments, 860 type_arguments,
866 other, 861 other,
867 other_type_arguments, 862 other_type_arguments,
868 bound_error); 863 bound_error);
869 } 864 }
870 865
871 // Check the 'more specific' relationship. 866 // Check the 'more specific' relationship.
872 bool IsMoreSpecificThan(const AbstractTypeArguments& type_arguments, 867 bool IsMoreSpecificThan(const TypeArguments& type_arguments,
873 const Class& other, 868 const Class& other,
874 const AbstractTypeArguments& other_type_arguments, 869 const TypeArguments& other_type_arguments,
875 Error* bound_error) const { 870 Error* bound_error) const {
876 return TypeTest(kIsMoreSpecificThan, 871 return TypeTest(kIsMoreSpecificThan,
877 type_arguments, 872 type_arguments,
878 other, 873 other,
879 other_type_arguments, 874 other_type_arguments,
880 bound_error); 875 bound_error);
881 } 876 }
882 877
883 // Check if this is the top level class. 878 // Check if this is the top level class.
884 bool IsTopLevel() const; 879 bool IsTopLevel() const;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 1159
1165 RawFunction* LookupAccessorFunction(const char* prefix, 1160 RawFunction* LookupAccessorFunction(const char* prefix,
1166 intptr_t prefix_length, 1161 intptr_t prefix_length,
1167 const String& name) const; 1162 const String& name) const;
1168 1163
1169 // Allocate an instance class which has a VM implementation. 1164 // Allocate an instance class which has a VM implementation.
1170 template <class FakeInstance> static RawClass* New(intptr_t id); 1165 template <class FakeInstance> static RawClass* New(intptr_t id);
1171 1166
1172 // Check the subtype or 'more specific' relationship. 1167 // Check the subtype or 'more specific' relationship.
1173 bool TypeTest(TypeTestKind test_kind, 1168 bool TypeTest(TypeTestKind test_kind,
1174 const AbstractTypeArguments& type_arguments, 1169 const TypeArguments& type_arguments,
1175 const Class& other, 1170 const Class& other,
1176 const AbstractTypeArguments& other_type_arguments, 1171 const TypeArguments& other_type_arguments,
1177 Error* bound_error) const; 1172 Error* bound_error) const;
1178 1173
1179 static bool TypeTestNonRecursive( 1174 static bool TypeTestNonRecursive(
1180 const Class& cls, 1175 const Class& cls,
1181 TypeTestKind test_kind, 1176 TypeTestKind test_kind,
1182 const AbstractTypeArguments& type_arguments, 1177 const TypeArguments& type_arguments,
1183 const Class& other, 1178 const Class& other,
1184 const AbstractTypeArguments& other_type_arguments, 1179 const TypeArguments& other_type_arguments,
1185 Error* bound_error); 1180 Error* bound_error);
1186 1181
1187 FINAL_HEAP_OBJECT_IMPLEMENTATION(Class, Object); 1182 FINAL_HEAP_OBJECT_IMPLEMENTATION(Class, Object);
1188 friend class AbstractType; 1183 friend class AbstractType;
1189 friend class Instance; 1184 friend class Instance;
1190 friend class Object; 1185 friend class Object;
1191 friend class Type; 1186 friend class Type;
1192 }; 1187 };
1193 1188
1194 1189
(...skipping 22 matching lines...) Expand all
1217 void set_ident(const String& ident) const; 1212 void set_ident(const String& ident) const;
1218 void set_token_pos(intptr_t token_pos) const; 1213 void set_token_pos(intptr_t token_pos) const;
1219 1214
1220 static RawUnresolvedClass* New(); 1215 static RawUnresolvedClass* New();
1221 1216
1222 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object); 1217 FINAL_HEAP_OBJECT_IMPLEMENTATION(UnresolvedClass, Object);
1223 friend class Class; 1218 friend class Class;
1224 }; 1219 };
1225 1220
1226 1221
1227 // AbstractTypeArguments is an abstract superclass. 1222 // A TypeArguments is an array of AbstractType.
1228 // Subclasses of AbstractTypeArguments are TypeArguments and 1223 class TypeArguments : public Object {
1229 // InstantiatedTypeArguments.
1230 class AbstractTypeArguments : public Object {
1231 public: 1224 public:
1232 // Returns true if all types of this vector are finalized. 1225 intptr_t Length() const;
1233 virtual bool IsFinalized() const { return true; } 1226 RawAbstractType* TypeAt(intptr_t index) const;
1234 1227 static intptr_t type_at_offset(intptr_t index) {
1235 // Return 'this' if this type argument vector is instantiated, i.e. if it does 1228 return OFFSET_OF(RawTypeArguments, types_) + index * kWordSize;
1236 // not refer to type parameters. Otherwise, return a new type argument vector
1237 // where each reference to a type parameter is replaced with the corresponding
1238 // type of the instantiator type argument vector.
1239 // If bound_error is not NULL, it may be set to reflect a bound error.
1240 virtual RawAbstractTypeArguments* InstantiateFrom(
1241 const AbstractTypeArguments& instantiator_type_arguments,
1242 Error* bound_error,
1243 GrowableObjectArray* trail = NULL) const;
1244
1245 // Do not clone InstantiatedTypeArguments or null vectors, since they are
1246 // considered finalized.
1247 virtual RawAbstractTypeArguments* CloneUnfinalized() const {
1248 return this->raw();
1249 } 1229 }
1250 1230 void SetTypeAt(intptr_t index, const AbstractType& value) const;
1251 // Null vectors are canonical.
1252 virtual RawAbstractTypeArguments* Canonicalize(
1253 GrowableObjectArray* trail = NULL) const {
1254 return this->raw();
1255 }
1256 1231
1257 // The name of this type argument vector, e.g. "<T, dynamic, List<T>, Smi>". 1232 // The name of this type argument vector, e.g. "<T, dynamic, List<T>, Smi>".
1258 virtual RawString* Name() const { 1233 RawString* Name() const {
1259 return SubvectorName(0, Length(), kInternalName); 1234 return SubvectorName(0, Length(), kInternalName);
1260 } 1235 }
1261 1236
1262 // The name of this type argument vector, e.g. "<T, dynamic, List<T>, int>". 1237 // The name of this type argument vector, e.g. "<T, dynamic, List<T>, int>".
1263 // Names of internal classes are mapped to their public interfaces. 1238 // Names of internal classes are mapped to their public interfaces.
1264 virtual RawString* UserVisibleName() const { 1239 RawString* UserVisibleName() const {
1265 return SubvectorName(0, Length(), kUserVisibleName); 1240 return SubvectorName(0, Length(), kUserVisibleName);
1266 } 1241 }
1267 1242
1268 // Check if the subvector of length 'len' starting at 'from_index' of this 1243 // Check if the subvector of length 'len' starting at 'from_index' of this
1269 // type argument vector consists solely of DynamicType. 1244 // type argument vector consists solely of DynamicType.
1270 bool IsRaw(intptr_t from_index, intptr_t len) const { 1245 bool IsRaw(intptr_t from_index, intptr_t len) const {
1271 return IsDynamicTypes(false, from_index, len); 1246 return IsDynamicTypes(false, from_index, len);
1272 } 1247 }
1273 1248
1274 // Check if this type argument vector would consist solely of DynamicType if 1249 // Check if this type argument vector would consist solely of DynamicType if
1275 // it was instantiated from a raw (null) instantiator, i.e. consider each type 1250 // it was instantiated from a raw (null) instantiator, i.e. consider each type
1276 // parameter as it would be first instantiated from a vector of dynamic types. 1251 // parameter as it would be first instantiated from a vector of dynamic types.
1277 // Consider only a prefix of length 'len'. 1252 // Consider only a prefix of length 'len'.
1278 bool IsRawInstantiatedRaw(intptr_t len) const { 1253 bool IsRawInstantiatedRaw(intptr_t len) const {
1279 return IsDynamicTypes(true, 0, len); 1254 return IsDynamicTypes(true, 0, len);
1280 } 1255 }
1281 1256
1282 // Check the subtype relationship, considering only a subvector of length 1257 // Check the subtype relationship, considering only a subvector of length
1283 // 'len' starting at 'from_index'. 1258 // 'len' starting at 'from_index'.
1284 bool IsSubtypeOf(const AbstractTypeArguments& other, 1259 bool IsSubtypeOf(const TypeArguments& other,
1285 intptr_t from_index, 1260 intptr_t from_index,
1286 intptr_t len, 1261 intptr_t len,
1287 Error* bound_error) const { 1262 Error* bound_error) const {
1288 return TypeTest(kIsSubtypeOf, other, from_index, len, bound_error); 1263 return TypeTest(kIsSubtypeOf, other, from_index, len, bound_error);
1289 } 1264 }
1290 1265
1291 // Check the 'more specific' relationship, considering only a subvector of 1266 // Check the 'more specific' relationship, considering only a subvector of
1292 // length 'len' starting at 'from_index'. 1267 // length 'len' starting at 'from_index'.
1293 bool IsMoreSpecificThan(const AbstractTypeArguments& other, 1268 bool IsMoreSpecificThan(const TypeArguments& other,
1294 intptr_t from_index, 1269 intptr_t from_index,
1295 intptr_t len, 1270 intptr_t len,
1296 Error* bound_error) const { 1271 Error* bound_error) const {
1297 return TypeTest(kIsMoreSpecificThan, other, from_index, len, bound_error); 1272 return TypeTest(kIsMoreSpecificThan, other, from_index, len, bound_error);
1298 } 1273 }
1299 1274
1300 // Check if the vectors are equal. 1275 // Check if the vectors are equal.
1301 bool Equals(const AbstractTypeArguments& other) const { 1276 bool Equals(const TypeArguments& other) const {
1302 return IsEquivalent(other); 1277 return IsEquivalent(other);
1303 } 1278 }
1304 1279
1305 bool IsEquivalent(const AbstractTypeArguments& other, 1280 bool IsEquivalent(const TypeArguments& other,
1306 GrowableObjectArray* trail = NULL) const; 1281 GrowableObjectArray* trail = NULL) const;
1307 1282
1308 // UNREACHABLEs as AbstractTypeArguments is an abstract class. 1283 bool IsResolved() const;
1309 virtual intptr_t Length() const; 1284 bool IsInstantiated(GrowableObjectArray* trail = NULL) const;
1310 virtual RawAbstractType* TypeAt(intptr_t index) const; 1285 bool IsUninstantiatedIdentity() const;
1311 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const; 1286 bool CanShareInstantiatorTypeArguments(const Class& instantiator_class) const;
1312 virtual bool IsResolved() const;
1313 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const;
1314 virtual bool IsUninstantiatedIdentity() const;
1315 virtual bool CanShareInstantiatorTypeArguments(
1316 const Class& instantiator_class) const;
1317 virtual bool IsBounded() const;
1318 1287
1319 virtual intptr_t Hash() const; 1288 // Returns true if all types of this vector are finalized.
1289 bool IsFinalized() const;
1290 bool IsBounded() const;
1320 1291
1321 private: 1292 // Clone this type argument vector and clone all unfinalized type arguments.
1322 // Check if the subvector of length 'len' starting at 'from_index' of this 1293 // Finalized type arguments are shared.
1323 // type argument vector consists solely of DynamicType. 1294 RawTypeArguments* CloneUnfinalized() const;
1324 // If raw_instantiated is true, consider each type parameter to be first
1325 // instantiated from a vector of dynamic types.
1326 bool IsDynamicTypes(bool raw_instantiated,
1327 intptr_t from_index,
1328 intptr_t len) const;
1329 1295
1330 // Check the subtype or 'more specific' relationship, considering only a 1296 // Canonicalize only if instantiated, otherwise returns 'this'.
1331 // subvector of length 'len' starting at 'from_index'. 1297 RawTypeArguments* Canonicalize(GrowableObjectArray* trail = NULL) const;
1332 bool TypeTest(TypeTestKind test_kind,
1333 const AbstractTypeArguments& other,
1334 intptr_t from_index,
1335 intptr_t len,
1336 Error* bound_error) const;
1337 1298
1338 // Return the internal or public name of a subvector of this type argument 1299 // Return 'this' if this type argument vector is instantiated, i.e. if it does
1339 // vector, e.g. "<T, dynamic, List<T>, int>". 1300 // not refer to type parameters. Otherwise, return a new type argument vector
1340 RawString* SubvectorName(intptr_t from_index, 1301 // where each reference to a type parameter is replaced with the corresponding
1341 intptr_t len, 1302 // type of the instantiator type argument vector.
1342 NameVisibility name_visibility) const; 1303 // If bound_error is not NULL, it may be set to reflect a bound error.
1343 1304 RawTypeArguments* InstantiateFrom(
1344 protected: 1305 const TypeArguments& instantiator_type_arguments,
1345 HEAP_OBJECT_IMPLEMENTATION(AbstractTypeArguments, Object); 1306 Error* bound_error,
1346 friend class AbstractType;
1347 friend class Class;
1348 };
1349
1350
1351 // A TypeArguments is an array of AbstractType.
1352 class TypeArguments : public AbstractTypeArguments {
1353 public:
1354 virtual intptr_t Length() const;
1355 virtual RawAbstractType* TypeAt(intptr_t index) const;
1356 static intptr_t type_at_offset(intptr_t index) {
1357 return OFFSET_OF(RawTypeArguments, types_) + index * kWordSize;
1358 }
1359 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const;
1360 virtual bool IsResolved() const;
1361 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const;
1362 virtual bool IsUninstantiatedIdentity() const;
1363 virtual bool CanShareInstantiatorTypeArguments(
1364 const Class& instantiator_class) const;
1365 virtual bool IsFinalized() const;
1366 virtual bool IsBounded() const;
1367 virtual RawAbstractTypeArguments* CloneUnfinalized() const;
1368 // Canonicalize only if instantiated, otherwise returns 'this'.
1369 virtual RawAbstractTypeArguments* Canonicalize(
1370 GrowableObjectArray* trail = NULL) const; 1307 GrowableObjectArray* trail = NULL) const;
1371 1308
1372 virtual RawAbstractTypeArguments* InstantiateFrom( 1309 // Runtime instantiation with canonicalization. Not to be used during type
1373 const AbstractTypeArguments& instantiator_type_arguments, 1310 // finalization at compile time.
1374 Error* bound_error, 1311 RawTypeArguments* InstantiateAndCanonicalizeFrom(
1375 GrowableObjectArray* trail = NULL) const; 1312 const TypeArguments& instantiator_type_arguments,
1313 Error* bound_error) const;
1314
1315 static intptr_t instantiations_offset() {
1316 return OFFSET_OF(RawTypeArguments, instantiations_);
1317 }
1376 1318
1377 static const intptr_t kBytesPerElement = kWordSize; 1319 static const intptr_t kBytesPerElement = kWordSize;
1378 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; 1320 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement;
1379 1321
1380 static intptr_t length_offset() { 1322 static intptr_t length_offset() {
1381 return OFFSET_OF(RawTypeArguments, length_); 1323 return OFFSET_OF(RawTypeArguments, length_);
1382 } 1324 }
1383 1325
1384 static intptr_t InstanceSize() { 1326 static intptr_t InstanceSize() {
1385 ASSERT(sizeof(RawTypeArguments) == OFFSET_OF(RawTypeArguments, types_)); 1327 ASSERT(sizeof(RawTypeArguments) == OFFSET_OF(RawTypeArguments, types_));
1386 return 0; 1328 return 0;
1387 } 1329 }
1388 1330
1389 static intptr_t InstanceSize(intptr_t len) { 1331 static intptr_t InstanceSize(intptr_t len) {
1390 // Ensure that the types_ is not adding to the object length. 1332 // Ensure that the types_ is not adding to the object size, which includes
1391 ASSERT(sizeof(RawTypeArguments) == (sizeof(RawObject) + (1 * kWordSize))); 1333 // 2 fields: instantiations_ and length_.
1334 ASSERT(sizeof(RawTypeArguments) == (sizeof(RawObject) + (2 * kWordSize)));
1392 ASSERT(0 <= len && len <= kMaxElements); 1335 ASSERT(0 <= len && len <= kMaxElements);
1393 return RoundedAllocationSize( 1336 return RoundedAllocationSize(
1394 sizeof(RawTypeArguments) + (len * kBytesPerElement)); 1337 sizeof(RawTypeArguments) + (len * kBytesPerElement));
1395 } 1338 }
1396 1339
1340 intptr_t Hash() const;
1341
1397 static RawTypeArguments* New(intptr_t len, Heap::Space space = Heap::kOld); 1342 static RawTypeArguments* New(intptr_t len, Heap::Space space = Heap::kOld);
1398 1343
1399 private: 1344 private:
1345 // Check if the subvector of length 'len' starting at 'from_index' of this
1346 // type argument vector consists solely of DynamicType.
1347 // If raw_instantiated is true, consider each type parameter to be first
1348 // instantiated from a vector of dynamic types.
1349 bool IsDynamicTypes(bool raw_instantiated,
1350 intptr_t from_index,
1351 intptr_t len) const;
1352
1353 // Check the subtype or 'more specific' relationship, considering only a
1354 // subvector of length 'len' starting at 'from_index'.
1355 bool TypeTest(TypeTestKind test_kind,
1356 const TypeArguments& other,
1357 intptr_t from_index,
1358 intptr_t len,
1359 Error* bound_error) const;
1360
1361 // Return the internal or public name of a subvector of this type argument
1362 // vector, e.g. "<T, dynamic, List<T>, int>".
1363 RawString* SubvectorName(intptr_t from_index,
1364 intptr_t len,
1365 NameVisibility name_visibility) const;
1366
1367 RawArray* instantiations() const;
1368 void set_instantiations(const Array& value) const;
1400 RawAbstractType** TypeAddr(intptr_t index) const; 1369 RawAbstractType** TypeAddr(intptr_t index) const;
1401 void SetLength(intptr_t value) const; 1370 void SetLength(intptr_t value) const;
1402 1371
1403 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeArguments, AbstractTypeArguments); 1372 FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeArguments, Object);
1373 friend class AbstractType;
1404 friend class Class; 1374 friend class Class;
1405 }; 1375 };
1406 1376
1407
1408 // An instance of InstantiatedTypeArguments is never encountered at compile
1409 // time, but only at run time, when type parameters can be matched to actual
1410 // types.
1411 // An instance of InstantiatedTypeArguments consists of a pair of
1412 // AbstractTypeArguments objects. The first type argument vector is
1413 // uninstantiated, because it contains type expressions referring to at least
1414 // one TypeParameter object, i.e. to a type that is not known at compile time.
1415 // The second type argument vector is the instantiator, because each type
1416 // parameter with index i in the first vector can be substituted (or
1417 // "instantiated") with the type at index i in the second type argument vector.
1418 class InstantiatedTypeArguments : public AbstractTypeArguments {
1419 public:
1420 virtual intptr_t Length() const;
1421 virtual RawAbstractType* TypeAt(intptr_t index) const;
1422 virtual void SetTypeAt(intptr_t index, const AbstractType& value) const;
1423 virtual bool IsResolved() const { return true; }
1424 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const {
1425 return true;
1426 }
1427 virtual bool IsUninstantiatedIdentity() const {
1428 UNREACHABLE();
1429 return false;
1430 }
1431 virtual bool CanShareInstantiatorTypeArguments(
1432 const Class& instantiator_class) const {
1433 UNREACHABLE();
1434 return false;
1435 }
1436 virtual bool IsBounded() const { return false; } // Bounds were checked.
1437 virtual RawAbstractTypeArguments* Canonicalize(
1438 GrowableObjectArray* trail = NULL) const;
1439
1440 RawAbstractTypeArguments* uninstantiated_type_arguments() const {
1441 return raw_ptr()->uninstantiated_type_arguments_;
1442 }
1443 static intptr_t uninstantiated_type_arguments_offset() {
1444 return OFFSET_OF(RawInstantiatedTypeArguments,
1445 uninstantiated_type_arguments_);
1446 }
1447
1448 RawAbstractTypeArguments* instantiator_type_arguments() const {
1449 return raw_ptr()->instantiator_type_arguments_;
1450 }
1451 static intptr_t instantiator_type_arguments_offset() {
1452 return OFFSET_OF(RawInstantiatedTypeArguments,
1453 instantiator_type_arguments_);
1454 }
1455
1456 static intptr_t InstanceSize() {
1457 return RoundedAllocationSize(sizeof(RawInstantiatedTypeArguments));
1458 }
1459
1460 static RawInstantiatedTypeArguments* New(
1461 const AbstractTypeArguments& uninstantiated_type_arguments,
1462 const AbstractTypeArguments& instantiator_type_arguments);
1463
1464 private:
1465 void set_uninstantiated_type_arguments(
1466 const AbstractTypeArguments& value) const;
1467 void set_instantiator_type_arguments(
1468 const AbstractTypeArguments& value) const;
1469
1470 static RawInstantiatedTypeArguments* New();
1471
1472 FINAL_HEAP_OBJECT_IMPLEMENTATION(InstantiatedTypeArguments,
1473 AbstractTypeArguments);
1474 friend class Class;
1475 };
1476
1477 1377
1478 class PatchClass : public Object { 1378 class PatchClass : public Object {
1479 public: 1379 public:
1480 RawClass* patched_class() const { return raw_ptr()->patched_class_; } 1380 RawClass* patched_class() const { return raw_ptr()->patched_class_; }
1481 RawClass* source_class() const { return raw_ptr()->source_class_; } 1381 RawClass* source_class() const { return raw_ptr()->source_class_; }
1482 RawScript* Script() const; 1382 RawScript* Script() const;
1483 1383
1484 static intptr_t InstanceSize() { 1384 static intptr_t InstanceSize() {
1485 return RoundedAllocationSize(sizeof(RawPatchClass)); 1385 return RoundedAllocationSize(sizeof(RawPatchClass));
1486 } 1386 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 RawString* UserVisibleSignature() const { 1424 RawString* UserVisibleSignature() const {
1525 const bool instantiate = false; 1425 const bool instantiate = false;
1526 return BuildSignature( 1426 return BuildSignature(
1527 instantiate, kUserVisibleName, TypeArguments::Handle()); 1427 instantiate, kUserVisibleName, TypeArguments::Handle());
1528 } 1428 }
1529 1429
1530 // Build a string of the form '(A, {b: B, c: C}) => D' representing the 1430 // Build a string of the form '(A, {b: B, c: C}) => D' representing the
1531 // signature of the given function, where all generic types (e.g. '<T, R>' in 1431 // signature of the given function, where all generic types (e.g. '<T, R>' in
1532 // 'C<T, R>(T, {b: B, c: C}) => R') are instantiated using the given 1432 // 'C<T, R>(T, {b: B, c: C}) => R') are instantiated using the given
1533 // instantiator type argument vector of a C instance (e.g. '<A, D>'). 1433 // instantiator type argument vector of a C instance (e.g. '<A, D>').
1534 RawString* InstantiatedSignatureFrom( 1434 RawString* InstantiatedSignatureFrom(const TypeArguments& instantiator,
1535 const AbstractTypeArguments& instantiator, 1435 NameVisibility name_visibility) const {
1536 NameVisibility name_visibility) const {
1537 const bool instantiate = true; 1436 const bool instantiate = true;
1538 return BuildSignature(instantiate, name_visibility, instantiator); 1437 return BuildSignature(instantiate, name_visibility, instantiator);
1539 } 1438 }
1540 1439
1541 // Returns true if the signature of this function is instantiated, i.e. if it 1440 // Returns true if the signature of this function is instantiated, i.e. if it
1542 // does not involve generic parameter types or generic result type. 1441 // does not involve generic parameter types or generic result type.
1543 bool HasInstantiatedSignature() const; 1442 bool HasInstantiatedSignature() const;
1544 1443
1545 // Build a string of the form 'T, {b: B, c: C} representing the user 1444 // Build a string of the form 'T, {b: B, c: C} representing the user
1546 // visible formal parameters of the function. 1445 // visible formal parameters of the function.
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 const char* ToFullyQualifiedCString() const; 1744 const char* ToFullyQualifiedCString() const;
1846 1745
1847 // Returns true if this function has parameters that are compatible with the 1746 // Returns true if this function has parameters that are compatible with the
1848 // parameters of the other function in order for this function to override the 1747 // parameters of the other function in order for this function to override the
1849 // other function. 1748 // other function.
1850 bool HasCompatibleParametersWith(const Function& other, 1749 bool HasCompatibleParametersWith(const Function& other,
1851 Error* bound_error) const; 1750 Error* bound_error) const;
1852 1751
1853 // Returns true if the type of this function is a subtype of the type of 1752 // Returns true if the type of this function is a subtype of the type of
1854 // the other function. 1753 // the other function.
1855 bool IsSubtypeOf(const AbstractTypeArguments& type_arguments, 1754 bool IsSubtypeOf(const TypeArguments& type_arguments,
1856 const Function& other, 1755 const Function& other,
1857 const AbstractTypeArguments& other_type_arguments, 1756 const TypeArguments& other_type_arguments,
1858 Error* bound_error) const { 1757 Error* bound_error) const {
1859 return TypeTest(kIsSubtypeOf, 1758 return TypeTest(kIsSubtypeOf,
1860 type_arguments, 1759 type_arguments,
1861 other, 1760 other,
1862 other_type_arguments, 1761 other_type_arguments,
1863 bound_error); 1762 bound_error);
1864 } 1763 }
1865 1764
1866 // Returns true if the type of this function is more specific than the type of 1765 // Returns true if the type of this function is more specific than the type of
1867 // the other function. 1766 // the other function.
1868 bool IsMoreSpecificThan(const AbstractTypeArguments& type_arguments, 1767 bool IsMoreSpecificThan(const TypeArguments& type_arguments,
1869 const Function& other, 1768 const Function& other,
1870 const AbstractTypeArguments& other_type_arguments, 1769 const TypeArguments& other_type_arguments,
1871 Error* bound_error) const { 1770 Error* bound_error) const {
1872 return TypeTest(kIsMoreSpecificThan, 1771 return TypeTest(kIsMoreSpecificThan,
1873 type_arguments, 1772 type_arguments,
1874 other, 1773 other,
1875 other_type_arguments, 1774 other_type_arguments,
1876 bound_error); 1775 bound_error);
1877 } 1776 }
1878 1777
1879 // Returns true if this function represents an explicit getter function. 1778 // Returns true if this function represents an explicit getter function.
1880 bool IsGetterFunction() const { 1779 bool IsGetterFunction() const {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 void set_data(const Object& value) const; 1923 void set_data(const Object& value) const;
2025 bool is_optimizable() const { 1924 bool is_optimizable() const {
2026 return OptimizableBit::decode(raw_ptr()->kind_tag_); 1925 return OptimizableBit::decode(raw_ptr()->kind_tag_);
2027 } 1926 }
2028 void set_is_optimizable(bool value) const; 1927 void set_is_optimizable(bool value) const;
2029 1928
2030 static RawFunction* New(); 1929 static RawFunction* New();
2031 1930
2032 void BuildSignatureParameters(bool instantiate, 1931 void BuildSignatureParameters(bool instantiate,
2033 NameVisibility name_visibility, 1932 NameVisibility name_visibility,
2034 const AbstractTypeArguments& instantiator, 1933 const TypeArguments& instantiator,
2035 const GrowableObjectArray& pieces) const; 1934 const GrowableObjectArray& pieces) const;
2036 RawString* BuildSignature(bool instantiate, 1935 RawString* BuildSignature(bool instantiate,
2037 NameVisibility name_visibility, 1936 NameVisibility name_visibility,
2038 const AbstractTypeArguments& instantiator) const; 1937 const TypeArguments& instantiator) const;
2039 1938
2040 // Check the subtype or 'more specific' relationship. 1939 // Check the subtype or 'more specific' relationship.
2041 bool TypeTest(TypeTestKind test_kind, 1940 bool TypeTest(TypeTestKind test_kind,
2042 const AbstractTypeArguments& type_arguments, 1941 const TypeArguments& type_arguments,
2043 const Function& other, 1942 const Function& other,
2044 const AbstractTypeArguments& other_type_arguments, 1943 const TypeArguments& other_type_arguments,
2045 Error* bound_error) const; 1944 Error* bound_error) const;
2046 1945
2047 // Checks the type of the formal parameter at the given position for 1946 // Checks the type of the formal parameter at the given position for
2048 // subtyping or 'more specific' relationship between the type of this function 1947 // subtyping or 'more specific' relationship between the type of this function
2049 // and the type of the other function. 1948 // and the type of the other function.
2050 bool TestParameterType(TypeTestKind test_kind, 1949 bool TestParameterType(TypeTestKind test_kind,
2051 intptr_t parameter_position, 1950 intptr_t parameter_position,
2052 intptr_t other_parameter_position, 1951 intptr_t other_parameter_position,
2053 const AbstractTypeArguments& type_arguments, 1952 const TypeArguments& type_arguments,
2054 const Function& other, 1953 const Function& other,
2055 const AbstractTypeArguments& other_type_arguments, 1954 const TypeArguments& other_type_arguments,
2056 Error* bound_error) const; 1955 Error* bound_error) const;
2057 1956
2058 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object); 1957 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object);
2059 friend class Class; 1958 friend class Class;
2060 // RawFunction::VisitFunctionPointers accesses the private constructor of 1959 // RawFunction::VisitFunctionPointers accesses the private constructor of
2061 // Function. 1960 // Function.
2062 friend class RawFunction; 1961 friend class RawFunction;
2063 }; 1962 };
2064 1963
2065 1964
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
3827 enum Entries { 3726 enum Entries {
3828 kInstanceClassId = 0, 3727 kInstanceClassId = 0,
3829 kInstanceTypeArguments = 1, 3728 kInstanceTypeArguments = 1,
3830 kInstantiatorTypeArguments = 2, 3729 kInstantiatorTypeArguments = 2,
3831 kTestResult = 3, 3730 kTestResult = 3,
3832 kTestEntryLength = 4, 3731 kTestEntryLength = 4,
3833 }; 3732 };
3834 3733
3835 intptr_t NumberOfChecks() const; 3734 intptr_t NumberOfChecks() const;
3836 void AddCheck(intptr_t class_id, 3735 void AddCheck(intptr_t class_id,
3837 const AbstractTypeArguments& instance_type_arguments, 3736 const TypeArguments& instance_type_arguments,
3838 const AbstractTypeArguments& instantiator_type_arguments, 3737 const TypeArguments& instantiator_type_arguments,
3839 const Bool& test_result) const; 3738 const Bool& test_result) const;
3840 void GetCheck(intptr_t ix, 3739 void GetCheck(intptr_t ix,
3841 intptr_t* class_id, 3740 intptr_t* class_id,
3842 AbstractTypeArguments* instance_type_arguments, 3741 TypeArguments* instance_type_arguments,
3843 AbstractTypeArguments* instantiator_type_arguments, 3742 TypeArguments* instantiator_type_arguments,
3844 Bool* test_result) const; 3743 Bool* test_result) const;
3845 3744
3846 static RawSubtypeTestCache* New(); 3745 static RawSubtypeTestCache* New();
3847 3746
3848 static intptr_t InstanceSize() { 3747 static intptr_t InstanceSize() {
3849 return RoundedAllocationSize(sizeof(RawSubtypeTestCache)); 3748 return RoundedAllocationSize(sizeof(RawSubtypeTestCache));
3850 } 3749 }
3851 3750
3852 static intptr_t cache_offset() { 3751 static intptr_t cache_offset() {
3853 return OFFSET_OF(RawSubtypeTestCache, cache_); 3752 return OFFSET_OF(RawSubtypeTestCache, cache_);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
4036 return *FieldAddr(field); 3935 return *FieldAddr(field);
4037 } 3936 }
4038 3937
4039 void SetField(const Field& field, const Object& value) const { 3938 void SetField(const Field& field, const Object& value) const {
4040 field.UpdateGuardedCidAndLength(value); 3939 field.UpdateGuardedCidAndLength(value);
4041 StorePointer(FieldAddr(field), value.raw()); 3940 StorePointer(FieldAddr(field), value.raw());
4042 } 3941 }
4043 3942
4044 RawType* GetType() const; 3943 RawType* GetType() const;
4045 3944
4046 virtual RawAbstractTypeArguments* GetTypeArguments() const; 3945 virtual RawTypeArguments* GetTypeArguments() const;
4047 virtual void SetTypeArguments(const AbstractTypeArguments& value) const; 3946 virtual void SetTypeArguments(const TypeArguments& value) const;
4048 3947
4049 // Check if the type of this instance is a subtype of the given type. 3948 // Check if the type of this instance is a subtype of the given type.
4050 bool IsInstanceOf(const AbstractType& type, 3949 bool IsInstanceOf(const AbstractType& type,
4051 const AbstractTypeArguments& type_instantiator, 3950 const TypeArguments& type_instantiator,
4052 Error* bound_error) const; 3951 Error* bound_error) const;
4053 3952
4054 // Check whether this instance is identical to the argument according to the 3953 // Check whether this instance is identical to the argument according to the
4055 // specification of dare:core's identical(). 3954 // specification of dare:core's identical().
4056 bool IsIdenticalTo(const Instance& other) const; 3955 bool IsIdenticalTo(const Instance& other) const;
4057 3956
4058 bool IsValidNativeIndex(int index) const { 3957 bool IsValidNativeIndex(int index) const {
4059 return ((index >= 0) && (index < clazz()->ptr()->num_native_fields_)); 3958 return ((index >= 0) && (index < clazz()->ptr()->num_native_fields_));
4060 } 3959 }
4061 3960
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
4128 virtual bool IsBeingFinalized() const; 4027 virtual bool IsBeingFinalized() const;
4129 virtual bool IsMalformed() const; 4028 virtual bool IsMalformed() const;
4130 virtual bool IsMalbounded() const; 4029 virtual bool IsMalbounded() const;
4131 virtual bool IsMalformedOrMalbounded() const; 4030 virtual bool IsMalformedOrMalbounded() const;
4132 virtual RawLanguageError* error() const; 4031 virtual RawLanguageError* error() const;
4133 virtual void set_error(const LanguageError& value) const; 4032 virtual void set_error(const LanguageError& value) const;
4134 virtual bool IsResolved() const; 4033 virtual bool IsResolved() const;
4135 virtual bool HasResolvedTypeClass() const; 4034 virtual bool HasResolvedTypeClass() const;
4136 virtual RawClass* type_class() const; 4035 virtual RawClass* type_class() const;
4137 virtual RawUnresolvedClass* unresolved_class() const; 4036 virtual RawUnresolvedClass* unresolved_class() const;
4138 virtual RawAbstractTypeArguments* arguments() const; 4037 virtual RawTypeArguments* arguments() const;
4139 virtual intptr_t token_pos() const; 4038 virtual intptr_t token_pos() const;
4140 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const; 4039 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const;
4141 virtual bool Equals(const Instance& other) const { 4040 virtual bool Equals(const Instance& other) const {
4142 return IsEquivalent(other); 4041 return IsEquivalent(other);
4143 } 4042 }
4144 virtual bool IsEquivalent(const Instance& other, 4043 virtual bool IsEquivalent(const Instance& other,
4145 GrowableObjectArray* trail = NULL) const; 4044 GrowableObjectArray* trail = NULL) const;
4146 4045
4147 // Instantiate this type using the given type argument vector. 4046 // Instantiate this type using the given type argument vector.
4148 // Return a new type, or return 'this' if it is already instantiated. 4047 // Return a new type, or return 'this' if it is already instantiated.
4149 // If bound_error is not NULL, it may be set to reflect a bound error. 4048 // If bound_error is not NULL, it may be set to reflect a bound error.
4150 virtual RawAbstractType* InstantiateFrom( 4049 virtual RawAbstractType* InstantiateFrom(
4151 const AbstractTypeArguments& instantiator_type_arguments, 4050 const TypeArguments& instantiator_type_arguments,
4152 Error* bound_error, 4051 Error* bound_error,
4153 GrowableObjectArray* trail = NULL) const; 4052 GrowableObjectArray* trail = NULL) const;
4154 4053
4155 // Return a clone of this unfinalized type or the type itself if it is 4054 // Return a clone of this unfinalized type or the type itself if it is
4156 // already finalized. Apply recursively to type arguments, i.e. finalized 4055 // already finalized. Apply recursively to type arguments, i.e. finalized
4157 // type arguments of an unfinalized type are not cloned, but shared. 4056 // type arguments of an unfinalized type are not cloned, but shared.
4158 virtual RawAbstractType* CloneUnfinalized() const; 4057 virtual RawAbstractType* CloneUnfinalized() const;
4159 4058
4160 virtual RawInstance* CheckAndCanonicalize(const char** error_str) const { 4059 virtual RawInstance* CheckAndCanonicalize(const char** error_str) const {
4161 return Canonicalize(); 4060 return Canonicalize();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
4240 bool TypeTest(TypeTestKind test_kind, 4139 bool TypeTest(TypeTestKind test_kind,
4241 const AbstractType& other, 4140 const AbstractType& other,
4242 Error* bound_error) const; 4141 Error* bound_error) const;
4243 4142
4244 // Return the internal or public name of this type, including the names of its 4143 // Return the internal or public name of this type, including the names of its
4245 // type arguments, if any. 4144 // type arguments, if any.
4246 RawString* BuildName(NameVisibility visibility) const; 4145 RawString* BuildName(NameVisibility visibility) const;
4247 4146
4248 protected: 4147 protected:
4249 HEAP_OBJECT_IMPLEMENTATION(AbstractType, Instance); 4148 HEAP_OBJECT_IMPLEMENTATION(AbstractType, Instance);
4250 friend class AbstractTypeArguments;
4251 friend class Class; 4149 friend class Class;
4252 friend class Function; 4150 friend class Function;
4151 friend class TypeArguments;
4253 }; 4152 };
4254 4153
4255 4154
4256 // A Type consists of a class, possibly parameterized with type 4155 // A Type consists of a class, possibly parameterized with type
4257 // arguments. Example: C<T1, T2>. 4156 // arguments. Example: C<T1, T2>.
4258 // An unresolved class is a String specifying the class name. 4157 // An unresolved class is a String specifying the class name.
4259 // 4158 //
4260 // Caution: 'RawType*' denotes a 'raw' pointer to a VM object of class Type, as 4159 // Caution: 'RawType*' denotes a 'raw' pointer to a VM object of class Type, as
4261 // opposed to 'Type' denoting a 'handle' to the same object. 'RawType' does not 4160 // opposed to 'Type' denoting a 'handle' to the same object. 'RawType' does not
4262 // relate to a 'raw type', as opposed to a 'cooked type' or 'rare type'. 4161 // relate to a 'raw type', as opposed to a 'cooked type' or 'rare type'.
(...skipping 16 matching lines...) Expand all
4279 virtual bool IsMalformed() const; 4178 virtual bool IsMalformed() const;
4280 virtual bool IsMalbounded() const; 4179 virtual bool IsMalbounded() const;
4281 virtual bool IsMalformedOrMalbounded() const; 4180 virtual bool IsMalformedOrMalbounded() const;
4282 virtual RawLanguageError* error() const { return raw_ptr()->error_; } 4181 virtual RawLanguageError* error() const { return raw_ptr()->error_; }
4283 virtual void set_error(const LanguageError& value) const; 4182 virtual void set_error(const LanguageError& value) const;
4284 virtual bool IsResolved() const; // Class and all arguments classes resolved. 4183 virtual bool IsResolved() const; // Class and all arguments classes resolved.
4285 virtual bool HasResolvedTypeClass() const; // Own type class resolved. 4184 virtual bool HasResolvedTypeClass() const; // Own type class resolved.
4286 virtual RawClass* type_class() const; 4185 virtual RawClass* type_class() const;
4287 void set_type_class(const Object& value) const; 4186 void set_type_class(const Object& value) const;
4288 virtual RawUnresolvedClass* unresolved_class() const; 4187 virtual RawUnresolvedClass* unresolved_class() const;
4289 virtual RawAbstractTypeArguments* arguments() const; 4188 virtual RawTypeArguments* arguments() const;
4290 void set_arguments(const AbstractTypeArguments& value) const; 4189 void set_arguments(const TypeArguments& value) const;
4291 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 4190 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; }
4292 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const; 4191 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const;
4293 virtual bool IsEquivalent(const Instance& other, 4192 virtual bool IsEquivalent(const Instance& other,
4294 GrowableObjectArray* trail = NULL) const; 4193 GrowableObjectArray* trail = NULL) const;
4295 virtual RawAbstractType* InstantiateFrom( 4194 virtual RawAbstractType* InstantiateFrom(
4296 const AbstractTypeArguments& instantiator_type_arguments, 4195 const TypeArguments& instantiator_type_arguments,
4297 Error* malformed_error, 4196 Error* malformed_error,
4298 GrowableObjectArray* trail = NULL) const; 4197 GrowableObjectArray* trail = NULL) const;
4299 virtual RawAbstractType* CloneUnfinalized() const; 4198 virtual RawAbstractType* CloneUnfinalized() const;
4300 virtual RawAbstractType* Canonicalize( 4199 virtual RawAbstractType* Canonicalize(
4301 GrowableObjectArray* trail = NULL) const; 4200 GrowableObjectArray* trail = NULL) const;
4302 4201
4303 virtual intptr_t Hash() const; 4202 virtual intptr_t Hash() const;
4304 4203
4305 static intptr_t InstanceSize() { 4204 static intptr_t InstanceSize() {
4306 return RoundedAllocationSize(sizeof(RawType)); 4205 return RoundedAllocationSize(sizeof(RawType));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
4348 // The 'Array' type. 4247 // The 'Array' type.
4349 static RawType* ArrayType(); 4248 static RawType* ArrayType();
4350 4249
4351 // The 'Function' type. 4250 // The 'Function' type.
4352 static RawType* Function(); 4251 static RawType* Function();
4353 4252
4354 // The finalized type of the given non-parameterized class. 4253 // The finalized type of the given non-parameterized class.
4355 static RawType* NewNonParameterizedType(const Class& type_class); 4254 static RawType* NewNonParameterizedType(const Class& type_class);
4356 4255
4357 static RawType* New(const Object& clazz, 4256 static RawType* New(const Object& clazz,
4358 const AbstractTypeArguments& arguments, 4257 const TypeArguments& arguments,
4359 intptr_t token_pos, 4258 intptr_t token_pos,
4360 Heap::Space space = Heap::kOld); 4259 Heap::Space space = Heap::kOld);
4361 4260
4362 private: 4261 private:
4363 void set_token_pos(intptr_t token_pos) const; 4262 void set_token_pos(intptr_t token_pos) const;
4364 void set_type_state(int8_t state) const; 4263 void set_type_state(int8_t state) const;
4365 4264
4366 static RawType* New(Heap::Space space = Heap::kOld); 4265 static RawType* New(Heap::Space space = Heap::kOld);
4367 4266
4368 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType); 4267 FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType);
4369 friend class Class; 4268 friend class Class;
4269 friend class TypeArguments;
4370 }; 4270 };
4371 4271
4372 4272
4373 // A TypeRef is used to break cycles in the representation of recursive types. 4273 // A TypeRef is used to break cycles in the representation of recursive types.
4374 // Its only field is the recursive AbstractType it refers to. 4274 // Its only field is the recursive AbstractType it refers to.
4375 // Note that the cycle always involves type arguments. 4275 // Note that the cycle always involves type arguments.
4376 class TypeRef : public AbstractType { 4276 class TypeRef : public AbstractType {
4377 public: 4277 public:
4378 virtual bool IsFinalized() const { 4278 virtual bool IsFinalized() const {
4379 return AbstractType::Handle(type()).IsFinalized(); 4279 return AbstractType::Handle(type()).IsFinalized();
(...skipping 10 matching lines...) Expand all
4390 virtual bool IsMalformedOrMalbounded() const { 4290 virtual bool IsMalformedOrMalbounded() const {
4391 return AbstractType::Handle(type()).IsMalformedOrMalbounded(); 4291 return AbstractType::Handle(type()).IsMalformedOrMalbounded();
4392 } 4292 }
4393 virtual bool IsResolved() const { return true; } 4293 virtual bool IsResolved() const { return true; }
4394 virtual bool HasResolvedTypeClass() const { return true; } 4294 virtual bool HasResolvedTypeClass() const { return true; }
4395 RawAbstractType* type() const { return raw_ptr()->type_; } 4295 RawAbstractType* type() const { return raw_ptr()->type_; }
4396 void set_type(const AbstractType& value) const; 4296 void set_type(const AbstractType& value) const;
4397 virtual RawClass* type_class() const { 4297 virtual RawClass* type_class() const {
4398 return AbstractType::Handle(type()).type_class(); 4298 return AbstractType::Handle(type()).type_class();
4399 } 4299 }
4400 virtual RawAbstractTypeArguments* arguments() const { 4300 virtual RawTypeArguments* arguments() const {
4401 return AbstractType::Handle(type()).arguments(); 4301 return AbstractType::Handle(type()).arguments();
4402 } 4302 }
4403 virtual intptr_t token_pos() const { 4303 virtual intptr_t token_pos() const {
4404 return AbstractType::Handle(type()).token_pos(); 4304 return AbstractType::Handle(type()).token_pos();
4405 } 4305 }
4406 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const; 4306 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const;
4407 virtual bool IsEquivalent(const Instance& other, 4307 virtual bool IsEquivalent(const Instance& other,
4408 GrowableObjectArray* trail = NULL) const; 4308 GrowableObjectArray* trail = NULL) const;
4409 virtual RawAbstractType* InstantiateFrom( 4309 virtual RawAbstractType* InstantiateFrom(
4410 const AbstractTypeArguments& instantiator_type_arguments, 4310 const TypeArguments& instantiator_type_arguments,
4411 Error* bound_error, 4311 Error* bound_error,
4412 GrowableObjectArray* trail = NULL) const; 4312 GrowableObjectArray* trail = NULL) const;
4413 virtual RawAbstractType* Canonicalize( 4313 virtual RawAbstractType* Canonicalize(
4414 GrowableObjectArray* trail = NULL) const; 4314 GrowableObjectArray* trail = NULL) const;
4415 4315
4416 virtual intptr_t Hash() const; 4316 virtual intptr_t Hash() const;
4417 4317
4418 // Return true if the receiver is contained in the trail. 4318 // Return true if the receiver is contained in the trail.
4419 // Otherwise, if the trail is null, allocate a trail, then add the receiver to 4319 // Otherwise, if the trail is null, allocate a trail, then add the receiver to
4420 // the trail and return false. 4320 // the trail and return false.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
4488 bool CheckBound(const AbstractType& bounded_type, 4388 bool CheckBound(const AbstractType& bounded_type,
4489 const AbstractType& upper_bound, 4389 const AbstractType& upper_bound,
4490 Error* bound_error) const; 4390 Error* bound_error) const;
4491 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; } 4391 virtual intptr_t token_pos() const { return raw_ptr()->token_pos_; }
4492 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const { 4392 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const {
4493 return false; 4393 return false;
4494 } 4394 }
4495 virtual bool IsEquivalent(const Instance& other, 4395 virtual bool IsEquivalent(const Instance& other,
4496 GrowableObjectArray* trail = NULL) const; 4396 GrowableObjectArray* trail = NULL) const;
4497 virtual RawAbstractType* InstantiateFrom( 4397 virtual RawAbstractType* InstantiateFrom(
4498 const AbstractTypeArguments& instantiator_type_arguments, 4398 const TypeArguments& instantiator_type_arguments,
4499 Error* bound_error, 4399 Error* bound_error,
4500 GrowableObjectArray* trail = NULL) const; 4400 GrowableObjectArray* trail = NULL) const;
4501 virtual RawAbstractType* CloneUnfinalized() const; 4401 virtual RawAbstractType* CloneUnfinalized() const;
4502 virtual RawAbstractType* Canonicalize( 4402 virtual RawAbstractType* Canonicalize(
4503 GrowableObjectArray* trail = NULL) const { 4403 GrowableObjectArray* trail = NULL) const {
4504 return raw(); 4404 return raw();
4505 } 4405 }
4506 4406
4507 virtual intptr_t Hash() const; 4407 virtual intptr_t Hash() const;
4508 4408
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
4550 virtual bool IsResolved() const { return true; } 4450 virtual bool IsResolved() const { return true; }
4551 virtual bool HasResolvedTypeClass() const { 4451 virtual bool HasResolvedTypeClass() const {
4552 return AbstractType::Handle(type()).HasResolvedTypeClass(); 4452 return AbstractType::Handle(type()).HasResolvedTypeClass();
4553 } 4453 }
4554 virtual RawClass* type_class() const { 4454 virtual RawClass* type_class() const {
4555 return AbstractType::Handle(type()).type_class(); 4455 return AbstractType::Handle(type()).type_class();
4556 } 4456 }
4557 virtual RawUnresolvedClass* unresolved_class() const { 4457 virtual RawUnresolvedClass* unresolved_class() const {
4558 return AbstractType::Handle(type()).unresolved_class(); 4458 return AbstractType::Handle(type()).unresolved_class();
4559 } 4459 }
4560 virtual RawAbstractTypeArguments* arguments() const { 4460 virtual RawTypeArguments* arguments() const {
4561 return AbstractType::Handle(type()).arguments(); 4461 return AbstractType::Handle(type()).arguments();
4562 } 4462 }
4563 RawAbstractType* type() const { return raw_ptr()->type_; } 4463 RawAbstractType* type() const { return raw_ptr()->type_; }
4564 RawAbstractType* bound() const { return raw_ptr()->bound_; } 4464 RawAbstractType* bound() const { return raw_ptr()->bound_; }
4565 RawTypeParameter* type_parameter() const { 4465 RawTypeParameter* type_parameter() const {
4566 return raw_ptr()->type_parameter_; 4466 return raw_ptr()->type_parameter_;
4567 } 4467 }
4568 virtual intptr_t token_pos() const { 4468 virtual intptr_t token_pos() const {
4569 return AbstractType::Handle(type()).token_pos(); 4469 return AbstractType::Handle(type()).token_pos();
4570 } 4470 }
4571 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const { 4471 virtual bool IsInstantiated(GrowableObjectArray* trail = NULL) const {
4572 // It is not possible to encounter an instantiated bounded type with an 4472 // It is not possible to encounter an instantiated bounded type with an
4573 // uninstantiated upper bound. Therefore, we do not need to check if the 4473 // uninstantiated upper bound. Therefore, we do not need to check if the
4574 // bound is instantiated. Moreover, doing so could lead into cycles, as in 4474 // bound is instantiated. Moreover, doing so could lead into cycles, as in
4575 // class C<T extends C<C>> { }. 4475 // class C<T extends C<C>> { }.
4576 return AbstractType::Handle(type()).IsInstantiated(); 4476 return AbstractType::Handle(type()).IsInstantiated();
4577 } 4477 }
4578 virtual bool IsEquivalent(const Instance& other, 4478 virtual bool IsEquivalent(const Instance& other,
4579 GrowableObjectArray* trail = NULL) const; 4479 GrowableObjectArray* trail = NULL) const;
4580 virtual RawAbstractType* InstantiateFrom( 4480 virtual RawAbstractType* InstantiateFrom(
4581 const AbstractTypeArguments& instantiator_type_arguments, 4481 const TypeArguments& instantiator_type_arguments,
4582 Error* bound_error, 4482 Error* bound_error,
4583 GrowableObjectArray* trail = NULL) const; 4483 GrowableObjectArray* trail = NULL) const;
4584 virtual RawAbstractType* CloneUnfinalized() const; 4484 virtual RawAbstractType* CloneUnfinalized() const;
4585 virtual RawAbstractType* Canonicalize( 4485 virtual RawAbstractType* Canonicalize(
4586 GrowableObjectArray* trail = NULL) const { 4486 GrowableObjectArray* trail = NULL) const {
4587 return raw(); 4487 return raw();
4588 } 4488 }
4589 4489
4590 virtual intptr_t Hash() const; 4490 virtual intptr_t Hash() const;
4591 4491
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
5658 } 5558 }
5659 void SetAt(intptr_t index, const Object& value) const { 5559 void SetAt(intptr_t index, const Object& value) const {
5660 // TODO(iposva): Add storing NoGCScope. 5560 // TODO(iposva): Add storing NoGCScope.
5661 StorePointer(ObjectAddr(index), value.raw()); 5561 StorePointer(ObjectAddr(index), value.raw());
5662 } 5562 }
5663 5563
5664 bool IsImmutable() const { 5564 bool IsImmutable() const {
5665 return raw()->GetClassId() == kImmutableArrayCid; 5565 return raw()->GetClassId() == kImmutableArrayCid;
5666 } 5566 }
5667 5567
5668 virtual RawAbstractTypeArguments* GetTypeArguments() const { 5568 virtual RawTypeArguments* GetTypeArguments() const {
5669 return raw_ptr()->type_arguments_; 5569 return raw_ptr()->type_arguments_;
5670 } 5570 }
5671 virtual void SetTypeArguments(const AbstractTypeArguments& value) const { 5571 virtual void SetTypeArguments(const TypeArguments& value) const {
5672 // An Array is raw or takes one type argument. However, its type argument 5572 // An Array is raw or takes one type argument. However, its type argument
5673 // vector may be longer than 1 due to a type optimization reusing the type 5573 // vector may be longer than 1 due to a type optimization reusing the type
5674 // argument vector of the instantiator. 5574 // argument vector of the instantiator.
5675 ASSERT(value.IsNull() || ((value.Length() >= 1) && value.IsInstantiated())); 5575 ASSERT(value.IsNull() || ((value.Length() >= 1) && value.IsInstantiated()));
5676 StorePointer(&raw_ptr()->type_arguments_, value.raw()); 5576 StorePointer(&raw_ptr()->type_arguments_, value.raw());
5677 } 5577 }
5678 5578
5679 virtual bool Equals(const Instance& other) const; 5579 virtual bool Equals(const Instance& other) const;
5680 5580
5681 static const intptr_t kBytesPerElement = kWordSize; 5581 static const intptr_t kBytesPerElement = kWordSize;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
5816 5716
5817 // TODO(iposva): Add storing NoGCScope. 5717 // TODO(iposva): Add storing NoGCScope.
5818 DataStorePointer(ObjectAddr(index), value.raw()); 5718 DataStorePointer(ObjectAddr(index), value.raw());
5819 } 5719 }
5820 5720
5821 void Add(const Object& value, Heap::Space space = Heap::kNew) const; 5721 void Add(const Object& value, Heap::Space space = Heap::kNew) const;
5822 5722
5823 void Grow(intptr_t new_capacity, Heap::Space space = Heap::kNew) const; 5723 void Grow(intptr_t new_capacity, Heap::Space space = Heap::kNew) const;
5824 RawObject* RemoveLast() const; 5724 RawObject* RemoveLast() const;
5825 5725
5826 virtual RawAbstractTypeArguments* GetTypeArguments() const { 5726 virtual RawTypeArguments* GetTypeArguments() const {
5827 return raw_ptr()->type_arguments_; 5727 return raw_ptr()->type_arguments_;
5828 } 5728 }
5829 virtual void SetTypeArguments(const AbstractTypeArguments& value) const { 5729 virtual void SetTypeArguments(const TypeArguments& value) const {
5830 // A GrowableObjectArray is raw or takes one type argument. However, its 5730 // A GrowableObjectArray is raw or takes one type argument. However, its
5831 // type argument vector may be longer than 1 due to a type optimization 5731 // type argument vector may be longer than 1 due to a type optimization
5832 // reusing the type argument vector of the instantiator. 5732 // reusing the type argument vector of the instantiator.
5833 ASSERT(value.IsNull() || ((value.Length() >= 1) && value.IsInstantiated())); 5733 ASSERT(value.IsNull() || ((value.Length() >= 1) && value.IsInstantiated()));
5834 const Array& contents = Array::Handle(data()); 5734 const Array& contents = Array::Handle(data());
5835 contents.SetTypeArguments(value); 5735 contents.SetTypeArguments(value);
5836 StorePointer(&raw_ptr()->type_arguments_, value.raw()); 5736 StorePointer(&raw_ptr()->type_arguments_, value.raw());
5837 } 5737 }
5838 5738
5839 virtual bool Equals(const Instance& other) const; 5739 virtual bool Equals(const Instance& other) const;
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
6314 return static_cast<intptr_t>(kFunctionOffset * kWordSize); 6214 return static_cast<intptr_t>(kFunctionOffset * kWordSize);
6315 } 6215 }
6316 6216
6317 static RawContext* context(const Instance& closure) { 6217 static RawContext* context(const Instance& closure) {
6318 return *ContextAddr(closure); 6218 return *ContextAddr(closure);
6319 } 6219 }
6320 static intptr_t context_offset() { 6220 static intptr_t context_offset() {
6321 return static_cast<intptr_t>(kContextOffset * kWordSize); 6221 return static_cast<intptr_t>(kContextOffset * kWordSize);
6322 } 6222 }
6323 6223
6324 static RawAbstractTypeArguments* GetTypeArguments(const Instance& closure) { 6224 static RawTypeArguments* GetTypeArguments(const Instance& closure) {
6325 return *TypeArgumentsAddr(closure); 6225 return *TypeArgumentsAddr(closure);
6326 } 6226 }
6327 static void SetTypeArguments(const Instance& closure, 6227 static void SetTypeArguments(const Instance& closure,
6328 const AbstractTypeArguments& value) { 6228 const TypeArguments& value) {
6329 closure.StorePointer(TypeArgumentsAddr(closure), value.raw()); 6229 closure.StorePointer(TypeArgumentsAddr(closure), value.raw());
6330 } 6230 }
6331 static intptr_t type_arguments_offset() { 6231 static intptr_t type_arguments_offset() {
6332 return static_cast<intptr_t>(kTypeArgumentsOffset * kWordSize); 6232 return static_cast<intptr_t>(kTypeArgumentsOffset * kWordSize);
6333 } 6233 }
6334 6234
6335 static const char* ToCString(const Instance& closure); 6235 static const char* ToCString(const Instance& closure);
6336 6236
6337 static intptr_t InstanceSize() { 6237 static intptr_t InstanceSize() {
6338 intptr_t size = sizeof(RawInstance) + (kNumFields * kWordSize); 6238 intptr_t size = sizeof(RawInstance) + (kNumFields * kWordSize);
6339 ASSERT(size == Object::RoundedAllocationSize(size)); 6239 ASSERT(size == Object::RoundedAllocationSize(size));
6340 return size; 6240 return size;
6341 } 6241 }
6342 6242
6343 static RawInstance* New(const Function& function, 6243 static RawInstance* New(const Function& function,
6344 const Context& context, 6244 const Context& context,
6345 Heap::Space space = Heap::kNew); 6245 Heap::Space space = Heap::kNew);
6346 6246
6347 private: 6247 private:
6348 static const int kTypeArgumentsOffset = 1; 6248 static const int kTypeArgumentsOffset = 1;
6349 static const int kFunctionOffset = 2; 6249 static const int kFunctionOffset = 2;
6350 static const int kContextOffset = 3; 6250 static const int kContextOffset = 3;
6351 static const int kNumFields = 3; 6251 static const int kNumFields = 3;
6352 6252
6353 static RawAbstractTypeArguments** TypeArgumentsAddr(const Instance& obj) { 6253 static RawTypeArguments** TypeArgumentsAddr(const Instance& obj) {
6354 ASSERT(obj.IsClosure()); 6254 ASSERT(obj.IsClosure());
6355 return reinterpret_cast<RawAbstractTypeArguments**>( 6255 return reinterpret_cast<RawTypeArguments**>(
6356 reinterpret_cast<intptr_t>(obj.raw_ptr()) + type_arguments_offset()); 6256 reinterpret_cast<intptr_t>(obj.raw_ptr()) + type_arguments_offset());
6357 } 6257 }
6358 static RawFunction** FunctionAddr(const Instance& obj) { 6258 static RawFunction** FunctionAddr(const Instance& obj) {
6359 ASSERT(obj.IsClosure()); 6259 ASSERT(obj.IsClosure());
6360 return reinterpret_cast<RawFunction**>( 6260 return reinterpret_cast<RawFunction**>(
6361 reinterpret_cast<intptr_t>(obj.raw_ptr()) + function_offset()); 6261 reinterpret_cast<intptr_t>(obj.raw_ptr()) + function_offset());
6362 } 6262 }
6363 static RawContext** ContextAddr(const Instance& obj) { 6263 static RawContext** ContextAddr(const Instance& obj) {
6364 ASSERT(obj.IsClosure()); 6264 ASSERT(obj.IsClosure());
6365 return reinterpret_cast<RawContext**>( 6265 return reinterpret_cast<RawContext**>(
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
6692 6592
6693 6593
6694 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6594 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6695 intptr_t index) { 6595 intptr_t index) {
6696 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6596 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6697 } 6597 }
6698 6598
6699 } // namespace dart 6599 } // namespace dart
6700 6600
6701 #endif // VM_OBJECT_H_ 6601 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698