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/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 Smi* Object::smi_illegal_cid_ = NULL; | 106 Smi* Object::smi_illegal_cid_ = NULL; |
107 LanguageError* Object::snapshot_writer_error_ = NULL; | 107 LanguageError* Object::snapshot_writer_error_ = NULL; |
108 LanguageError* Object::branch_offset_error_ = NULL; | 108 LanguageError* Object::branch_offset_error_ = NULL; |
109 | 109 |
110 RawObject* Object::null_ = reinterpret_cast<RawObject*>(RAW_NULL); | 110 RawObject* Object::null_ = reinterpret_cast<RawObject*>(RAW_NULL); |
111 RawClass* Object::class_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 111 RawClass* Object::class_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
112 RawClass* Object::dynamic_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 112 RawClass* Object::dynamic_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
113 RawClass* Object::void_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 113 RawClass* Object::void_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
114 RawType* Object::dynamic_type_ = reinterpret_cast<RawType*>(RAW_NULL); | 114 RawType* Object::dynamic_type_ = reinterpret_cast<RawType*>(RAW_NULL); |
115 RawType* Object::void_type_ = reinterpret_cast<RawType*>(RAW_NULL); | 115 RawType* Object::void_type_ = reinterpret_cast<RawType*>(RAW_NULL); |
| 116 RawType* Object::function_type_ = reinterpret_cast<RawType*>(RAW_NULL); |
116 RawClass* Object::unresolved_class_class_ = | 117 RawClass* Object::unresolved_class_class_ = |
117 reinterpret_cast<RawClass*>(RAW_NULL); | 118 reinterpret_cast<RawClass*>(RAW_NULL); |
118 RawClass* Object::type_arguments_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 119 RawClass* Object::type_arguments_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
119 RawClass* Object::patch_class_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 120 RawClass* Object::patch_class_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
120 RawClass* Object::function_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 121 RawClass* Object::function_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
121 RawClass* Object::closure_data_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 122 RawClass* Object::closure_data_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
122 RawClass* Object::redirection_data_class_ = | 123 RawClass* Object::redirection_data_class_ = |
123 reinterpret_cast<RawClass*>(RAW_NULL); | 124 reinterpret_cast<RawClass*>(RAW_NULL); |
124 RawClass* Object::field_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 125 RawClass* Object::field_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
125 RawClass* Object::literal_token_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 126 RawClass* Object::literal_token_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 cls.set_is_type_finalized(); | 684 cls.set_is_type_finalized(); |
684 cls.set_is_finalized(); | 685 cls.set_is_finalized(); |
685 isolate->object_store()->set_type_class(cls); | 686 isolate->object_store()->set_type_class(cls); |
686 | 687 |
687 cls = dynamic_class_; | 688 cls = dynamic_class_; |
688 dynamic_type_ = Type::NewNonParameterizedType(cls); | 689 dynamic_type_ = Type::NewNonParameterizedType(cls); |
689 | 690 |
690 cls = void_class_; | 691 cls = void_class_; |
691 void_type_ = Type::NewNonParameterizedType(cls); | 692 void_type_ = Type::NewNonParameterizedType(cls); |
692 | 693 |
| 694 cls = function_class_; |
| 695 function_type_ = Type::NewNonParameterizedType(cls); |
| 696 |
693 // Allocate and initialize singleton true and false boolean objects. | 697 // Allocate and initialize singleton true and false boolean objects. |
694 cls = Class::New<Bool>(); | 698 cls = Class::New<Bool>(); |
695 isolate->object_store()->set_bool_class(cls); | 699 isolate->object_store()->set_bool_class(cls); |
696 *bool_true_ = Bool::New(true); | 700 *bool_true_ = Bool::New(true); |
697 *bool_false_ = Bool::New(false); | 701 *bool_false_ = Bool::New(false); |
698 | 702 |
699 *smi_illegal_cid_ = Smi::New(kIllegalCid); | 703 *smi_illegal_cid_ = Smi::New(kIllegalCid); |
700 | 704 |
701 String& error_str = String::Handle(); | 705 String& error_str = String::Handle(); |
702 error_str = String::New("SnapshotWriter Error", Heap::kOld); | 706 error_str = String::New("SnapshotWriter Error", Heap::kOld); |
(...skipping 13138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13841 if (IsCanonical() || IsMalformed()) { | 13845 if (IsCanonical() || IsMalformed()) { |
13842 ASSERT(IsMalformed() || TypeArguments::Handle(arguments()).IsOld()); | 13846 ASSERT(IsMalformed() || TypeArguments::Handle(arguments()).IsOld()); |
13843 return this->raw(); | 13847 return this->raw(); |
13844 } | 13848 } |
13845 Isolate* isolate = Isolate::Current(); | 13849 Isolate* isolate = Isolate::Current(); |
13846 Type& type = Type::Handle(isolate); | 13850 Type& type = Type::Handle(isolate); |
13847 const Class& cls = Class::Handle(isolate, type_class()); | 13851 const Class& cls = Class::Handle(isolate, type_class()); |
13848 if (cls.raw() == Object::dynamic_class() && (isolate != Dart::vm_isolate())) { | 13852 if (cls.raw() == Object::dynamic_class() && (isolate != Dart::vm_isolate())) { |
13849 return Object::dynamic_type(); | 13853 return Object::dynamic_type(); |
13850 } | 13854 } |
| 13855 if (cls.raw() == Object::function_class() && |
| 13856 (isolate != Dart::vm_isolate())) { |
| 13857 return Object::function_type(); |
| 13858 } |
13851 // Fast canonical lookup/registry for simple types. | 13859 // Fast canonical lookup/registry for simple types. |
13852 if ((cls.NumTypeArguments() == 0) && !cls.IsSignatureClass()) { | 13860 if ((cls.NumTypeArguments() == 0) && !cls.IsSignatureClass()) { |
13853 type = cls.CanonicalType(); | 13861 type = cls.CanonicalType(); |
13854 if (type.IsNull()) { | 13862 if (type.IsNull()) { |
13855 ASSERT(!cls.raw()->IsVMHeapObject() || (isolate == Dart::vm_isolate())); | 13863 ASSERT(!cls.raw()->IsVMHeapObject() || (isolate == Dart::vm_isolate())); |
13856 cls.set_canonical_types(*this); | 13864 cls.set_canonical_types(*this); |
13857 SetCanonical(); | 13865 SetCanonical(); |
13858 return this->raw(); | 13866 return this->raw(); |
13859 } | 13867 } |
13860 ASSERT(this->Equals(type)); | 13868 ASSERT(this->Equals(type)); |
(...skipping 4808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18669 return tag_label.ToCString(); | 18677 return tag_label.ToCString(); |
18670 } | 18678 } |
18671 | 18679 |
18672 | 18680 |
18673 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 18681 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
18674 Instance::PrintJSONImpl(stream, ref); | 18682 Instance::PrintJSONImpl(stream, ref); |
18675 } | 18683 } |
18676 | 18684 |
18677 | 18685 |
18678 } // namespace dart | 18686 } // namespace dart |
OLD | NEW |