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 #include "vm/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/become.h" | 10 #include "vm/become.h" |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 | 906 |
907 cls = dynamic_class_; | 907 cls = dynamic_class_; |
908 *dynamic_type_ = Type::NewNonParameterizedType(cls); | 908 *dynamic_type_ = Type::NewNonParameterizedType(cls); |
909 | 909 |
910 cls = void_class_; | 910 cls = void_class_; |
911 *void_type_ = Type::NewNonParameterizedType(cls); | 911 *void_type_ = Type::NewNonParameterizedType(cls); |
912 | 912 |
913 cls = vector_class_; | 913 cls = vector_class_; |
914 *vector_type_ = Type::NewNonParameterizedType(cls); | 914 *vector_type_ = Type::NewNonParameterizedType(cls); |
915 | 915 |
| 916 // Since TypeArguments objects are passed as function arguments, make them |
| 917 // behave as Dart instances, although they are just VM objects. |
| 918 // Note that we cannot set the super type to ObjectType, which does not live |
| 919 // in the vm isolate. See special handling in Class::SuperClass(). |
| 920 cls = type_arguments_class_; |
| 921 cls.set_interfaces(Object::empty_array()); |
| 922 cls.SetFields(Object::empty_array()); |
| 923 cls.SetFunctions(Object::empty_array()); |
| 924 |
916 // Allocate and initialize singleton true and false boolean objects. | 925 // Allocate and initialize singleton true and false boolean objects. |
917 cls = Class::New<Bool>(); | 926 cls = Class::New<Bool>(); |
918 isolate->object_store()->set_bool_class(cls); | 927 isolate->object_store()->set_bool_class(cls); |
919 *bool_true_ = Bool::New(true); | 928 *bool_true_ = Bool::New(true); |
920 *bool_false_ = Bool::New(false); | 929 *bool_false_ = Bool::New(false); |
921 | 930 |
922 *smi_illegal_cid_ = Smi::New(kIllegalCid); | 931 *smi_illegal_cid_ = Smi::New(kIllegalCid); |
923 | 932 |
924 String& error_str = String::Handle(); | 933 String& error_str = String::Handle(); |
925 error_str = String::New("SnapshotWriter Error", Heap::kOld); | 934 error_str = String::New("SnapshotWriter Error", Heap::kOld); |
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2507 } while (true); | 2516 } while (true); |
2508 set_num_type_arguments(num_type_args); | 2517 set_num_type_arguments(num_type_args); |
2509 return num_type_args; | 2518 return num_type_args; |
2510 } | 2519 } |
2511 | 2520 |
2512 RawClass* Class::SuperClass(bool original_classes) const { | 2521 RawClass* Class::SuperClass(bool original_classes) const { |
2513 Thread* thread = Thread::Current(); | 2522 Thread* thread = Thread::Current(); |
2514 Zone* zone = thread->zone(); | 2523 Zone* zone = thread->zone(); |
2515 Isolate* isolate = thread->isolate(); | 2524 Isolate* isolate = thread->isolate(); |
2516 if (super_type() == AbstractType::null()) { | 2525 if (super_type() == AbstractType::null()) { |
| 2526 if (id() == kTypeArgumentsCid) { |
| 2527 // Pretend TypeArguments objects are Dart instances. |
| 2528 return isolate->class_table()->At(kInstanceCid); |
| 2529 } |
2517 return Class::null(); | 2530 return Class::null(); |
2518 } | 2531 } |
2519 const AbstractType& sup_type = AbstractType::Handle(zone, super_type()); | 2532 const AbstractType& sup_type = AbstractType::Handle(zone, super_type()); |
2520 const intptr_t type_class_id = sup_type.type_class_id(); | 2533 const intptr_t type_class_id = sup_type.type_class_id(); |
2521 if (original_classes) { | 2534 if (original_classes) { |
2522 return isolate->GetClassForHeapWalkAt(type_class_id); | 2535 return isolate->GetClassForHeapWalkAt(type_class_id); |
2523 } else { | 2536 } else { |
2524 return isolate->class_table()->At(type_class_id); | 2537 return isolate->class_table()->At(type_class_id); |
2525 } | 2538 } |
2526 } | 2539 } |
(...skipping 19941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22468 } | 22481 } |
22469 return UserTag::null(); | 22482 return UserTag::null(); |
22470 } | 22483 } |
22471 | 22484 |
22472 const char* UserTag::ToCString() const { | 22485 const char* UserTag::ToCString() const { |
22473 const String& tag_label = String::Handle(label()); | 22486 const String& tag_label = String::Handle(label()); |
22474 return tag_label.ToCString(); | 22487 return tag_label.ToCString(); |
22475 } | 22488 } |
22476 | 22489 |
22477 } // namespace dart | 22490 } // namespace dart |
OLD | NEW |