| 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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 *extractor_parameter_names_ = Array::New(1, Heap::kOld); | 905 *extractor_parameter_names_ = Array::New(1, Heap::kOld); |
| 906 extractor_parameter_names_->SetAt(0, Symbols::This()); | 906 extractor_parameter_names_->SetAt(0, Symbols::This()); |
| 907 | 907 |
| 908 ASSERT(!extractor_parameter_types_->IsSmi()); | 908 ASSERT(!extractor_parameter_types_->IsSmi()); |
| 909 ASSERT(extractor_parameter_types_->IsArray()); | 909 ASSERT(extractor_parameter_types_->IsArray()); |
| 910 ASSERT(!extractor_parameter_names_->IsSmi()); | 910 ASSERT(!extractor_parameter_names_->IsSmi()); |
| 911 ASSERT(extractor_parameter_names_->IsArray()); | 911 ASSERT(extractor_parameter_names_->IsArray()); |
| 912 | 912 |
| 913 | 913 |
| 914 // Set up names for all VM singleton classes. | 914 // Set up names for all VM singleton classes. |
| 915 Class& cls = Class::Handle(isolate); | 915 Class& cls = Class::Handle(); |
| 916 | 916 |
| 917 SET_CLASS_NAME(class, Class); | 917 SET_CLASS_NAME(class, Class); |
| 918 SET_CLASS_NAME(dynamic, Dynamic); | 918 SET_CLASS_NAME(dynamic, Dynamic); |
| 919 SET_CLASS_NAME(void, Void); | 919 SET_CLASS_NAME(void, Void); |
| 920 SET_CLASS_NAME(unresolved_class, UnresolvedClass); | 920 SET_CLASS_NAME(unresolved_class, UnresolvedClass); |
| 921 SET_CLASS_NAME(type_arguments, TypeArguments); | 921 SET_CLASS_NAME(type_arguments, TypeArguments); |
| 922 SET_CLASS_NAME(patch_class, PatchClass); | 922 SET_CLASS_NAME(patch_class, PatchClass); |
| 923 SET_CLASS_NAME(function, Function); | 923 SET_CLASS_NAME(function, Function); |
| 924 SET_CLASS_NAME(closure_data, ClosureData); | 924 SET_CLASS_NAME(closure_data, ClosureData); |
| 925 SET_CLASS_NAME(redirection_data, RedirectionData); | 925 SET_CLASS_NAME(redirection_data, RedirectionData); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 tags = AtomicOperations::CompareAndSwapWord( | 1016 tags = AtomicOperations::CompareAndSwapWord( |
| 1017 &raw->ptr()->tags_, old_tags, new_tags); | 1017 &raw->ptr()->tags_, old_tags, new_tags); |
| 1018 } while (tags != old_tags); | 1018 } while (tags != old_tags); |
| 1019 } | 1019 } |
| 1020 } | 1020 } |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 | 1023 |
| 1024 void Object::VerifyBuiltinVtables() { | 1024 void Object::VerifyBuiltinVtables() { |
| 1025 #if defined(DEBUG) | 1025 #if defined(DEBUG) |
| 1026 Isolate* isolate = Isolate::Current(); | 1026 Thread* thread = Thread::Current(); |
| 1027 ASSERT(isolate != NULL); | 1027 Isolate* isolate = thread->isolate(); |
| 1028 Class& cls = Class::Handle(isolate, Class::null()); | 1028 Class& cls = Class::Handle(thread->zone(), Class::null()); |
| 1029 for (intptr_t cid = (kIllegalCid + 1); cid < kNumPredefinedCids; cid++) { | 1029 for (intptr_t cid = (kIllegalCid + 1); cid < kNumPredefinedCids; cid++) { |
| 1030 if (isolate->class_table()->HasValidClassAt(cid)) { | 1030 if (isolate->class_table()->HasValidClassAt(cid)) { |
| 1031 cls ^= isolate->class_table()->At(cid); | 1031 cls ^= isolate->class_table()->At(cid); |
| 1032 ASSERT(builtin_vtables_[cid] == cls.raw_ptr()->handle_vtable_); | 1032 ASSERT(builtin_vtables_[cid] == cls.raw_ptr()->handle_vtable_); |
| 1033 } | 1033 } |
| 1034 } | 1034 } |
| 1035 ASSERT(builtin_vtables_[kFreeListElement] == 0); | 1035 ASSERT(builtin_vtables_[kFreeListElement] == 0); |
| 1036 #endif | 1036 #endif |
| 1037 } | 1037 } |
| 1038 | 1038 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1054 ASSERT(public_class_name.CharAt(0) == '_'); | 1054 ASSERT(public_class_name.CharAt(0) == '_'); |
| 1055 String& str = String::Handle(); | 1055 String& str = String::Handle(); |
| 1056 str = lib.PrivateName(public_class_name); | 1056 str = lib.PrivateName(public_class_name); |
| 1057 cls.set_name(str); | 1057 cls.set_name(str); |
| 1058 lib.AddClass(cls); | 1058 lib.AddClass(cls); |
| 1059 } | 1059 } |
| 1060 | 1060 |
| 1061 | 1061 |
| 1062 RawError* Object::Init(Isolate* isolate) { | 1062 RawError* Object::Init(Isolate* isolate) { |
| 1063 Thread* thread = Thread::Current(); | 1063 Thread* thread = Thread::Current(); |
| 1064 Zone* zone = thread->zone(); |
| 1064 ASSERT(isolate == thread->isolate()); | 1065 ASSERT(isolate == thread->isolate()); |
| 1065 TimelineDurationScope tds(thread, | 1066 TimelineDurationScope tds(thread, |
| 1066 isolate->GetIsolateStream(), | 1067 isolate->GetIsolateStream(), |
| 1067 "Object::Init"); | 1068 "Object::Init"); |
| 1068 | 1069 |
| 1069 #if defined(DART_NO_SNAPSHOT) | 1070 #if defined(DART_NO_SNAPSHOT) |
| 1070 // Object::Init version when we are running in a version of dart that does | 1071 // Object::Init version when we are running in a version of dart that does |
| 1071 // not have a full snapshot linked in. | 1072 // not have a full snapshot linked in. |
| 1072 ObjectStore* object_store = isolate->object_store(); | 1073 ObjectStore* object_store = isolate->object_store(); |
| 1073 | 1074 |
| 1074 Class& cls = Class::Handle(isolate); | 1075 Class& cls = Class::Handle(zone); |
| 1075 Type& type = Type::Handle(isolate); | 1076 Type& type = Type::Handle(zone); |
| 1076 Array& array = Array::Handle(isolate); | 1077 Array& array = Array::Handle(zone); |
| 1077 Library& lib = Library::Handle(isolate); | 1078 Library& lib = Library::Handle(zone); |
| 1078 | 1079 |
| 1079 // All RawArray fields will be initialized to an empty array, therefore | 1080 // All RawArray fields will be initialized to an empty array, therefore |
| 1080 // initialize array class first. | 1081 // initialize array class first. |
| 1081 cls = Class::New<Array>(); | 1082 cls = Class::New<Array>(); |
| 1082 object_store->set_array_class(cls); | 1083 object_store->set_array_class(cls); |
| 1083 | 1084 |
| 1084 // VM classes that are parameterized (Array, ImmutableArray, | 1085 // VM classes that are parameterized (Array, ImmutableArray, |
| 1085 // GrowableObjectArray, and LinkedHashMap) are also pre-finalized, | 1086 // GrowableObjectArray, and LinkedHashMap) are also pre-finalized, |
| 1086 // so CalculateFieldOffsets() is not called, so we need to set the | 1087 // so CalculateFieldOffsets() is not called, so we need to set the |
| 1087 // offset of their type_arguments_ field, which is explicitly | 1088 // offset of their type_arguments_ field, which is explicitly |
| 1088 // declared in their respective Raw* classes. | 1089 // declared in their respective Raw* classes. |
| 1089 cls.set_type_arguments_field_offset(Array::type_arguments_offset()); | 1090 cls.set_type_arguments_field_offset(Array::type_arguments_offset()); |
| 1090 cls.set_num_type_arguments(1); | 1091 cls.set_num_type_arguments(1); |
| 1091 | 1092 |
| 1092 // Set up the growable object array class (Has to be done after the array | 1093 // Set up the growable object array class (Has to be done after the array |
| 1093 // class is setup as one of its field is an array object). | 1094 // class is setup as one of its field is an array object). |
| 1094 cls = Class::New<GrowableObjectArray>(); | 1095 cls = Class::New<GrowableObjectArray>(); |
| 1095 object_store->set_growable_object_array_class(cls); | 1096 object_store->set_growable_object_array_class(cls); |
| 1096 cls.set_type_arguments_field_offset( | 1097 cls.set_type_arguments_field_offset( |
| 1097 GrowableObjectArray::type_arguments_offset()); | 1098 GrowableObjectArray::type_arguments_offset()); |
| 1098 cls.set_num_type_arguments(1); | 1099 cls.set_num_type_arguments(1); |
| 1099 | 1100 |
| 1100 // canonical_type_arguments_ are Smi terminated. | 1101 // canonical_type_arguments_ are Smi terminated. |
| 1101 // Last element contains the count of used slots. | 1102 // Last element contains the count of used slots. |
| 1102 const intptr_t kInitialCanonicalTypeArgumentsSize = 4; | 1103 const intptr_t kInitialCanonicalTypeArgumentsSize = 4; |
| 1103 array = Array::New(kInitialCanonicalTypeArgumentsSize + 1); | 1104 array = Array::New(kInitialCanonicalTypeArgumentsSize + 1); |
| 1104 array.SetAt(kInitialCanonicalTypeArgumentsSize, | 1105 array.SetAt(kInitialCanonicalTypeArgumentsSize, |
| 1105 Smi::Handle(isolate, Smi::New(0))); | 1106 Smi::Handle(zone, Smi::New(0))); |
| 1106 object_store->set_canonical_type_arguments(array); | 1107 object_store->set_canonical_type_arguments(array); |
| 1107 | 1108 |
| 1108 // Setup type class early in the process. | 1109 // Setup type class early in the process. |
| 1109 const Class& type_cls = Class::Handle(isolate, Class::New<Type>()); | 1110 const Class& type_cls = Class::Handle(zone, Class::New<Type>()); |
| 1110 const Class& type_ref_cls = Class::Handle(isolate, Class::New<TypeRef>()); | 1111 const Class& type_ref_cls = Class::Handle(zone, Class::New<TypeRef>()); |
| 1111 const Class& type_parameter_cls = Class::Handle(isolate, | 1112 const Class& type_parameter_cls = Class::Handle(zone, |
| 1112 Class::New<TypeParameter>()); | 1113 Class::New<TypeParameter>()); |
| 1113 const Class& bounded_type_cls = Class::Handle(isolate, | 1114 const Class& bounded_type_cls = Class::Handle(zone, |
| 1114 Class::New<BoundedType>()); | 1115 Class::New<BoundedType>()); |
| 1115 const Class& mixin_app_type_cls = Class::Handle(isolate, | 1116 const Class& mixin_app_type_cls = Class::Handle(zone, |
| 1116 Class::New<MixinAppType>()); | 1117 Class::New<MixinAppType>()); |
| 1117 const Class& library_prefix_cls = Class::Handle(isolate, | 1118 const Class& library_prefix_cls = Class::Handle(zone, |
| 1118 Class::New<LibraryPrefix>()); | 1119 Class::New<LibraryPrefix>()); |
| 1119 | 1120 |
| 1120 // Pre-allocate the OneByteString class needed by the symbol table. | 1121 // Pre-allocate the OneByteString class needed by the symbol table. |
| 1121 cls = Class::NewStringClass(kOneByteStringCid); | 1122 cls = Class::NewStringClass(kOneByteStringCid); |
| 1122 object_store->set_one_byte_string_class(cls); | 1123 object_store->set_one_byte_string_class(cls); |
| 1123 | 1124 |
| 1124 // Pre-allocate the TwoByteString class needed by the symbol table. | 1125 // Pre-allocate the TwoByteString class needed by the symbol table. |
| 1125 cls = Class::NewStringClass(kTwoByteStringCid); | 1126 cls = Class::NewStringClass(kTwoByteStringCid); |
| 1126 object_store->set_two_byte_string_class(cls); | 1127 object_store->set_two_byte_string_class(cls); |
| 1127 | 1128 |
| 1128 // Setup the symbol table for the symbols created in the isolate. | 1129 // Setup the symbol table for the symbols created in the isolate. |
| 1129 Symbols::SetupSymbolTable(isolate); | 1130 Symbols::SetupSymbolTable(isolate); |
| 1130 | 1131 |
| 1131 // Set up the libraries array before initializing the core library. | 1132 // Set up the libraries array before initializing the core library. |
| 1132 const GrowableObjectArray& libraries = GrowableObjectArray::Handle( | 1133 const GrowableObjectArray& libraries = GrowableObjectArray::Handle( |
| 1133 isolate, GrowableObjectArray::New(Heap::kOld)); | 1134 zone, GrowableObjectArray::New(Heap::kOld)); |
| 1134 object_store->set_libraries(libraries); | 1135 object_store->set_libraries(libraries); |
| 1135 | 1136 |
| 1136 // Pre-register the core library. | 1137 // Pre-register the core library. |
| 1137 Library::InitCoreLibrary(isolate); | 1138 Library::InitCoreLibrary(isolate); |
| 1138 | 1139 |
| 1139 // Basic infrastructure has been setup, initialize the class dictionary. | 1140 // Basic infrastructure has been setup, initialize the class dictionary. |
| 1140 const Library& core_lib = Library::Handle(isolate, Library::CoreLibrary()); | 1141 const Library& core_lib = Library::Handle(zone, Library::CoreLibrary()); |
| 1141 ASSERT(!core_lib.IsNull()); | 1142 ASSERT(!core_lib.IsNull()); |
| 1142 | 1143 |
| 1143 const GrowableObjectArray& pending_classes = | 1144 const GrowableObjectArray& pending_classes = |
| 1144 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); | 1145 GrowableObjectArray::Handle(zone, GrowableObjectArray::New()); |
| 1145 object_store->set_pending_classes(pending_classes); | 1146 object_store->set_pending_classes(pending_classes); |
| 1146 | 1147 |
| 1147 Context& context = Context::Handle(isolate, Context::New(0, Heap::kOld)); | 1148 Context& context = Context::Handle(zone, Context::New(0, Heap::kOld)); |
| 1148 object_store->set_empty_context(context); | 1149 object_store->set_empty_context(context); |
| 1149 | 1150 |
| 1150 // Now that the symbol table is initialized and that the core dictionary as | 1151 // Now that the symbol table is initialized and that the core dictionary as |
| 1151 // well as the core implementation dictionary have been setup, preallocate | 1152 // well as the core implementation dictionary have been setup, preallocate |
| 1152 // remaining classes and register them by name in the dictionaries. | 1153 // remaining classes and register them by name in the dictionaries. |
| 1153 String& name = String::Handle(isolate); | 1154 String& name = String::Handle(zone); |
| 1154 cls = object_store->array_class(); // Was allocated above. | 1155 cls = object_store->array_class(); // Was allocated above. |
| 1155 RegisterPrivateClass(cls, Symbols::_List(), core_lib); | 1156 RegisterPrivateClass(cls, Symbols::_List(), core_lib); |
| 1156 pending_classes.Add(cls); | 1157 pending_classes.Add(cls); |
| 1157 // We cannot use NewNonParameterizedType(cls), because Array is parameterized. | 1158 // We cannot use NewNonParameterizedType(cls), because Array is parameterized. |
| 1158 // Warning: class _List has not been patched yet. Its declared number of type | 1159 // Warning: class _List has not been patched yet. Its declared number of type |
| 1159 // parameters is still 0. It will become 1 after patching. The array type | 1160 // parameters is still 0. It will become 1 after patching. The array type |
| 1160 // allocated below represents the raw type _List and not _List<E> as we | 1161 // allocated below represents the raw type _List and not _List<E> as we |
| 1161 // could expect. Use with caution. | 1162 // could expect. Use with caution. |
| 1162 type ^= Type::New(Object::Handle(isolate, cls.raw()), | 1163 type ^= Type::New(Object::Handle(zone, cls.raw()), |
| 1163 TypeArguments::Handle(isolate), | 1164 TypeArguments::Handle(zone), |
| 1164 Scanner::kNoSourcePos); | 1165 Scanner::kNoSourcePos); |
| 1165 type.SetIsFinalized(); | 1166 type.SetIsFinalized(); |
| 1166 type ^= type.Canonicalize(); | 1167 type ^= type.Canonicalize(); |
| 1167 object_store->set_array_type(type); | 1168 object_store->set_array_type(type); |
| 1168 | 1169 |
| 1169 cls = object_store->growable_object_array_class(); // Was allocated above. | 1170 cls = object_store->growable_object_array_class(); // Was allocated above. |
| 1170 RegisterPrivateClass(cls, Symbols::_GrowableList(), core_lib); | 1171 RegisterPrivateClass(cls, Symbols::_GrowableList(), core_lib); |
| 1171 pending_classes.Add(cls); | 1172 pending_classes.Add(cls); |
| 1172 | 1173 |
| 1173 cls = Class::New<Array>(kImmutableArrayCid); | 1174 cls = Class::New<Array>(kImmutableArrayCid); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1193 pending_classes.Add(cls); | 1194 pending_classes.Add(cls); |
| 1194 | 1195 |
| 1195 cls = Class::NewStringClass(kExternalTwoByteStringCid); | 1196 cls = Class::NewStringClass(kExternalTwoByteStringCid); |
| 1196 object_store->set_external_two_byte_string_class(cls); | 1197 object_store->set_external_two_byte_string_class(cls); |
| 1197 RegisterPrivateClass(cls, Symbols::ExternalTwoByteString(), core_lib); | 1198 RegisterPrivateClass(cls, Symbols::ExternalTwoByteString(), core_lib); |
| 1198 pending_classes.Add(cls); | 1199 pending_classes.Add(cls); |
| 1199 | 1200 |
| 1200 // Pre-register the isolate library so the native class implementations | 1201 // Pre-register the isolate library so the native class implementations |
| 1201 // can be hooked up before compiling it. | 1202 // can be hooked up before compiling it. |
| 1202 Library& isolate_lib = | 1203 Library& isolate_lib = |
| 1203 Library::Handle(isolate, Library::LookupLibrary(Symbols::DartIsolate())); | 1204 Library::Handle(zone, Library::LookupLibrary(Symbols::DartIsolate())); |
| 1204 if (isolate_lib.IsNull()) { | 1205 if (isolate_lib.IsNull()) { |
| 1205 isolate_lib = Library::NewLibraryHelper(Symbols::DartIsolate(), true); | 1206 isolate_lib = Library::NewLibraryHelper(Symbols::DartIsolate(), true); |
| 1206 isolate_lib.SetLoadRequested(); | 1207 isolate_lib.SetLoadRequested(); |
| 1207 isolate_lib.Register(); | 1208 isolate_lib.Register(); |
| 1208 object_store->set_bootstrap_library(ObjectStore::kIsolate, isolate_lib); | 1209 object_store->set_bootstrap_library(ObjectStore::kIsolate, isolate_lib); |
| 1209 } | 1210 } |
| 1210 ASSERT(!isolate_lib.IsNull()); | 1211 ASSERT(!isolate_lib.IsNull()); |
| 1211 ASSERT(isolate_lib.raw() == Library::IsolateLibrary()); | 1212 ASSERT(isolate_lib.raw() == Library::IsolateLibrary()); |
| 1212 | 1213 |
| 1213 cls = Class::New<Capability>(); | 1214 cls = Class::New<Capability>(); |
| 1214 RegisterPrivateClass(cls, Symbols::_CapabilityImpl(), isolate_lib); | 1215 RegisterPrivateClass(cls, Symbols::_CapabilityImpl(), isolate_lib); |
| 1215 pending_classes.Add(cls); | 1216 pending_classes.Add(cls); |
| 1216 | 1217 |
| 1217 cls = Class::New<ReceivePort>(); | 1218 cls = Class::New<ReceivePort>(); |
| 1218 RegisterPrivateClass(cls, Symbols::_RawReceivePortImpl(), isolate_lib); | 1219 RegisterPrivateClass(cls, Symbols::_RawReceivePortImpl(), isolate_lib); |
| 1219 pending_classes.Add(cls); | 1220 pending_classes.Add(cls); |
| 1220 | 1221 |
| 1221 cls = Class::New<SendPort>(); | 1222 cls = Class::New<SendPort>(); |
| 1222 RegisterPrivateClass(cls, Symbols::_SendPortImpl(), isolate_lib); | 1223 RegisterPrivateClass(cls, Symbols::_SendPortImpl(), isolate_lib); |
| 1223 pending_classes.Add(cls); | 1224 pending_classes.Add(cls); |
| 1224 | 1225 |
| 1225 const Class& stacktrace_cls = Class::Handle(isolate, | 1226 const Class& stacktrace_cls = Class::Handle(zone, |
| 1226 Class::New<Stacktrace>()); | 1227 Class::New<Stacktrace>()); |
| 1227 RegisterPrivateClass(stacktrace_cls, Symbols::_StackTrace(), core_lib); | 1228 RegisterPrivateClass(stacktrace_cls, Symbols::_StackTrace(), core_lib); |
| 1228 pending_classes.Add(stacktrace_cls); | 1229 pending_classes.Add(stacktrace_cls); |
| 1229 // Super type set below, after Object is allocated. | 1230 // Super type set below, after Object is allocated. |
| 1230 | 1231 |
| 1231 cls = Class::New<JSRegExp>(); | 1232 cls = Class::New<JSRegExp>(); |
| 1232 RegisterPrivateClass(cls, Symbols::JSSyntaxRegExp(), core_lib); | 1233 RegisterPrivateClass(cls, Symbols::JSSyntaxRegExp(), core_lib); |
| 1233 pending_classes.Add(cls); | 1234 pending_classes.Add(cls); |
| 1234 | 1235 |
| 1235 // Initialize the base interfaces used by the core VM classes. | 1236 // Initialize the base interfaces used by the core VM classes. |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 Intrinsifier::InitializeState(); | 1543 Intrinsifier::InitializeState(); |
| 1543 | 1544 |
| 1544 // Set up recognized state of all functions (core, math and typed data). | 1545 // Set up recognized state of all functions (core, math and typed data). |
| 1545 MethodRecognizer::InitializeState(); | 1546 MethodRecognizer::InitializeState(); |
| 1546 | 1547 |
| 1547 // Adds static const fields (class ids) to the class 'ClassID'); | 1548 // Adds static const fields (class ids) to the class 'ClassID'); |
| 1548 lib = Library::LookupLibrary(Symbols::DartInternal()); | 1549 lib = Library::LookupLibrary(Symbols::DartInternal()); |
| 1549 ASSERT(!lib.IsNull()); | 1550 ASSERT(!lib.IsNull()); |
| 1550 cls = lib.LookupClassAllowPrivate(Symbols::ClassID()); | 1551 cls = lib.LookupClassAllowPrivate(Symbols::ClassID()); |
| 1551 ASSERT(!cls.IsNull()); | 1552 ASSERT(!cls.IsNull()); |
| 1552 Field& field = Field::Handle(isolate); | 1553 Field& field = Field::Handle(zone); |
| 1553 Smi& value = Smi::Handle(isolate); | 1554 Smi& value = Smi::Handle(zone); |
| 1554 String& field_name = String::Handle(isolate); | 1555 String& field_name = String::Handle(zone); |
| 1555 | 1556 |
| 1556 #define CLASS_LIST_WITH_NULL(V) \ | 1557 #define CLASS_LIST_WITH_NULL(V) \ |
| 1557 V(Null) \ | 1558 V(Null) \ |
| 1558 CLASS_LIST_NO_OBJECT(V) | 1559 CLASS_LIST_NO_OBJECT(V) |
| 1559 | 1560 |
| 1560 #define ADD_SET_FIELD(clazz) \ | 1561 #define ADD_SET_FIELD(clazz) \ |
| 1561 field_name = Symbols::New("cid"#clazz); \ | 1562 field_name = Symbols::New("cid"#clazz); \ |
| 1562 field = Field::New(field_name, true, false, true, false, cls, 0); \ | 1563 field = Field::New(field_name, true, false, true, false, cls, 0); \ |
| 1563 value = Smi::New(k##clazz##Cid); \ | 1564 value = Smi::New(k##clazz##Cid); \ |
| 1564 field.SetStaticValue(value, true); \ | 1565 field.SetStaticValue(value, true); \ |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 cls = Class::New<Stacktrace>(); | 1673 cls = Class::New<Stacktrace>(); |
| 1673 cls = Class::New<JSRegExp>(); | 1674 cls = Class::New<JSRegExp>(); |
| 1674 cls = Class::New<Number>(); | 1675 cls = Class::New<Number>(); |
| 1675 | 1676 |
| 1676 cls = Class::New<WeakProperty>(); | 1677 cls = Class::New<WeakProperty>(); |
| 1677 object_store->set_weak_property_class(cls); | 1678 object_store->set_weak_property_class(cls); |
| 1678 | 1679 |
| 1679 cls = Class::New<MirrorReference>(); | 1680 cls = Class::New<MirrorReference>(); |
| 1680 cls = Class::New<UserTag>(); | 1681 cls = Class::New<UserTag>(); |
| 1681 | 1682 |
| 1682 const Context& context = Context::Handle(isolate, | 1683 const Context& context = Context::Handle(zone, |
| 1683 Context::New(0, Heap::kOld)); | 1684 Context::New(0, Heap::kOld)); |
| 1684 object_store->set_empty_context(context); | 1685 object_store->set_empty_context(context); |
| 1685 | 1686 |
| 1686 #endif // defined(DART_NO_SNAPSHOT). | 1687 #endif // defined(DART_NO_SNAPSHOT). |
| 1687 | 1688 |
| 1688 return Error::null(); | 1689 return Error::null(); |
| 1689 } | 1690 } |
| 1690 | 1691 |
| 1691 | 1692 |
| 1692 void Object::Print() const { | 1693 void Object::Print() const { |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2446 type_params = type_parameters(); | 2447 type_params = type_parameters(); |
| 2447 return type_params.Length(); | 2448 return type_params.Length(); |
| 2448 } | 2449 } |
| 2449 | 2450 |
| 2450 | 2451 |
| 2451 intptr_t Class::NumOwnTypeArguments() const { | 2452 intptr_t Class::NumOwnTypeArguments() const { |
| 2452 // Return cached value if already calculated. | 2453 // Return cached value if already calculated. |
| 2453 if (num_own_type_arguments() != kUnknownNumTypeArguments) { | 2454 if (num_own_type_arguments() != kUnknownNumTypeArguments) { |
| 2454 return num_own_type_arguments(); | 2455 return num_own_type_arguments(); |
| 2455 } | 2456 } |
| 2456 Isolate* isolate = Isolate::Current(); | 2457 Thread* thread = Thread::Current(); |
| 2458 Isolate* isolate = thread->isolate(); |
| 2459 Zone* zone = thread->zone(); |
| 2457 const intptr_t num_type_params = NumTypeParameters(); | 2460 const intptr_t num_type_params = NumTypeParameters(); |
| 2458 if (!FLAG_overlap_type_arguments || | 2461 if (!FLAG_overlap_type_arguments || |
| 2459 (num_type_params == 0) || | 2462 (num_type_params == 0) || |
| 2460 (super_type() == AbstractType::null()) || | 2463 (super_type() == AbstractType::null()) || |
| 2461 (super_type() == isolate->object_store()->object_type())) { | 2464 (super_type() == isolate->object_store()->object_type())) { |
| 2462 set_num_own_type_arguments(num_type_params); | 2465 set_num_own_type_arguments(num_type_params); |
| 2463 return num_type_params; | 2466 return num_type_params; |
| 2464 } | 2467 } |
| 2465 ASSERT(!IsMixinApplication() || is_mixin_type_applied()); | 2468 ASSERT(!IsMixinApplication() || is_mixin_type_applied()); |
| 2466 const AbstractType& sup_type = AbstractType::Handle(isolate, super_type()); | 2469 const AbstractType& sup_type = AbstractType::Handle(zone, super_type()); |
| 2467 const TypeArguments& sup_type_args = | 2470 const TypeArguments& sup_type_args = |
| 2468 TypeArguments::Handle(isolate, sup_type.arguments()); | 2471 TypeArguments::Handle(zone, sup_type.arguments()); |
| 2469 if (sup_type_args.IsNull()) { | 2472 if (sup_type_args.IsNull()) { |
| 2470 // The super type is raw or the super class is non generic. | 2473 // The super type is raw or the super class is non generic. |
| 2471 // In either case, overlapping is not possible. | 2474 // In either case, overlapping is not possible. |
| 2472 set_num_own_type_arguments(num_type_params); | 2475 set_num_own_type_arguments(num_type_params); |
| 2473 return num_type_params; | 2476 return num_type_params; |
| 2474 } | 2477 } |
| 2475 const intptr_t num_sup_type_args = sup_type_args.Length(); | 2478 const intptr_t num_sup_type_args = sup_type_args.Length(); |
| 2476 // At this point, the super type may or may not be finalized. In either case, | 2479 // At this point, the super type may or may not be finalized. In either case, |
| 2477 // the result of this function must remain the same. | 2480 // the result of this function must remain the same. |
| 2478 // The value of num_sup_type_args may increase when the super type is | 2481 // The value of num_sup_type_args may increase when the super type is |
| 2479 // finalized, but the last num_sup_type_args type arguments will not be | 2482 // finalized, but the last num_sup_type_args type arguments will not be |
| 2480 // modified by finalization, only shifted to higher indices in the vector. | 2483 // modified by finalization, only shifted to higher indices in the vector. |
| 2481 // They may however get wrapped in a BoundedType, which we skip. | 2484 // They may however get wrapped in a BoundedType, which we skip. |
| 2482 // The super type may not even be resolved yet. This is not necessary, since | 2485 // The super type may not even be resolved yet. This is not necessary, since |
| 2483 // we only check for matching type parameters, which are resolved by default. | 2486 // we only check for matching type parameters, which are resolved by default. |
| 2484 const TypeArguments& type_params = | 2487 const TypeArguments& type_params = |
| 2485 TypeArguments::Handle(isolate, type_parameters()); | 2488 TypeArguments::Handle(zone, type_parameters()); |
| 2486 // Determine the maximum overlap of a prefix of the vector consisting of the | 2489 // Determine the maximum overlap of a prefix of the vector consisting of the |
| 2487 // type parameters of this class with a suffix of the vector consisting of the | 2490 // type parameters of this class with a suffix of the vector consisting of the |
| 2488 // type arguments of the super type of this class. | 2491 // type arguments of the super type of this class. |
| 2489 // The number of own type arguments of this class is the number of its type | 2492 // The number of own type arguments of this class is the number of its type |
| 2490 // parameters minus the number of type arguments in the overlap. | 2493 // parameters minus the number of type arguments in the overlap. |
| 2491 // Attempt to overlap the whole vector of type parameters; reduce the size | 2494 // Attempt to overlap the whole vector of type parameters; reduce the size |
| 2492 // of the vector (keeping the first type parameter) until it fits or until | 2495 // of the vector (keeping the first type parameter) until it fits or until |
| 2493 // its size is zero. | 2496 // its size is zero. |
| 2494 TypeParameter& type_param = TypeParameter::Handle(isolate); | 2497 TypeParameter& type_param = TypeParameter::Handle(zone); |
| 2495 AbstractType& sup_type_arg = AbstractType::Handle(isolate); | 2498 AbstractType& sup_type_arg = AbstractType::Handle(zone); |
| 2496 for (intptr_t num_overlapping_type_args = | 2499 for (intptr_t num_overlapping_type_args = |
| 2497 (num_type_params < num_sup_type_args) ? | 2500 (num_type_params < num_sup_type_args) ? |
| 2498 num_type_params : num_sup_type_args; | 2501 num_type_params : num_sup_type_args; |
| 2499 num_overlapping_type_args > 0; num_overlapping_type_args--) { | 2502 num_overlapping_type_args > 0; num_overlapping_type_args--) { |
| 2500 intptr_t i = 0; | 2503 intptr_t i = 0; |
| 2501 for (; i < num_overlapping_type_args; i++) { | 2504 for (; i < num_overlapping_type_args; i++) { |
| 2502 type_param ^= type_params.TypeAt(i); | 2505 type_param ^= type_params.TypeAt(i); |
| 2503 sup_type_arg = sup_type_args.TypeAt( | 2506 sup_type_arg = sup_type_args.TypeAt( |
| 2504 num_sup_type_args - num_overlapping_type_args + i); | 2507 num_sup_type_args - num_overlapping_type_args + i); |
| 2505 // BoundedType can nest in case the finalized super type has bounded type | 2508 // BoundedType can nest in case the finalized super type has bounded type |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2527 | 2530 |
| 2528 | 2531 |
| 2529 intptr_t Class::NumTypeArguments() const { | 2532 intptr_t Class::NumTypeArguments() const { |
| 2530 // Return cached value if already calculated. | 2533 // Return cached value if already calculated. |
| 2531 if (num_type_arguments() != kUnknownNumTypeArguments) { | 2534 if (num_type_arguments() != kUnknownNumTypeArguments) { |
| 2532 return num_type_arguments(); | 2535 return num_type_arguments(); |
| 2533 } | 2536 } |
| 2534 // To work properly, this call requires the super class of this class to be | 2537 // To work properly, this call requires the super class of this class to be |
| 2535 // resolved, which is checked by the type_class() call on the super type. | 2538 // resolved, which is checked by the type_class() call on the super type. |
| 2536 // Note that calling type_class() on a MixinAppType fails. | 2539 // Note that calling type_class() on a MixinAppType fails. |
| 2537 Isolate* isolate = Isolate::Current(); | 2540 Thread* thread = Thread::Current(); |
| 2538 Class& cls = Class::Handle(isolate); | 2541 Zone* zone = thread->zone(); |
| 2539 AbstractType& sup_type = AbstractType::Handle(isolate); | 2542 Isolate* isolate = thread->isolate(); |
| 2543 Class& cls = Class::Handle(zone); |
| 2544 AbstractType& sup_type = AbstractType::Handle(zone); |
| 2540 cls = raw(); | 2545 cls = raw(); |
| 2541 intptr_t num_type_args = 0; | 2546 intptr_t num_type_args = 0; |
| 2542 do { | 2547 do { |
| 2543 if (cls.IsSignatureClass()) { | 2548 if (cls.IsSignatureClass()) { |
| 2544 Function& signature_fun = Function::Handle(isolate); | 2549 Function& signature_fun = Function::Handle(zone); |
| 2545 signature_fun ^= cls.signature_function(); | 2550 signature_fun ^= cls.signature_function(); |
| 2546 if (!signature_fun.is_static() && | 2551 if (!signature_fun.is_static() && |
| 2547 !signature_fun.HasInstantiatedSignature()) { | 2552 !signature_fun.HasInstantiatedSignature()) { |
| 2548 cls = signature_fun.Owner(); | 2553 cls = signature_fun.Owner(); |
| 2549 } | 2554 } |
| 2550 } | 2555 } |
| 2551 // Calling NumOwnTypeArguments() on a mixin application class will setup the | 2556 // Calling NumOwnTypeArguments() on a mixin application class will setup the |
| 2552 // type parameters if not already done. | 2557 // type parameters if not already done. |
| 2553 num_type_args += cls.NumOwnTypeArguments(); | 2558 num_type_args += cls.NumOwnTypeArguments(); |
| 2554 // Super type of Object class is null. | 2559 // Super type of Object class is null. |
| (...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3796 // be resolved as well as their interfaces. | 3801 // be resolved as well as their interfaces. |
| 3797 bool Class::TypeTestNonRecursive(const Class& cls, | 3802 bool Class::TypeTestNonRecursive(const Class& cls, |
| 3798 Class::TypeTestKind test_kind, | 3803 Class::TypeTestKind test_kind, |
| 3799 const TypeArguments& type_arguments, | 3804 const TypeArguments& type_arguments, |
| 3800 const Class& other, | 3805 const Class& other, |
| 3801 const TypeArguments& other_type_arguments, | 3806 const TypeArguments& other_type_arguments, |
| 3802 Error* bound_error, | 3807 Error* bound_error, |
| 3803 Heap::Space space) { | 3808 Heap::Space space) { |
| 3804 // Use the thsi object as if it was the receiver of this method, but instead | 3809 // Use the thsi object as if it was the receiver of this method, but instead |
| 3805 // of recursing reset it to the super class and loop. | 3810 // of recursing reset it to the super class and loop. |
| 3806 Isolate* isolate = Isolate::Current(); | 3811 Zone* zone = Thread::Current()->zone(); |
| 3807 Class& thsi = Class::Handle(isolate, cls.raw()); | 3812 Class& thsi = Class::Handle(zone, cls.raw()); |
| 3808 while (true) { | 3813 while (true) { |
| 3809 ASSERT(!thsi.IsVoidClass()); | 3814 ASSERT(!thsi.IsVoidClass()); |
| 3810 // Check for DynamicType. | 3815 // Check for DynamicType. |
| 3811 // Each occurrence of DynamicType in type T is interpreted as the dynamic | 3816 // Each occurrence of DynamicType in type T is interpreted as the dynamic |
| 3812 // type, a supertype of all types. | 3817 // type, a supertype of all types. |
| 3813 if (other.IsDynamicClass()) { | 3818 if (other.IsDynamicClass()) { |
| 3814 return true; | 3819 return true; |
| 3815 } | 3820 } |
| 3816 // In the case of a subtype test, each occurrence of DynamicType in type S | 3821 // In the case of a subtype test, each occurrence of DynamicType in type S |
| 3817 // is interpreted as the bottom type, a subtype of all types. | 3822 // is interpreted as the bottom type, a subtype of all types. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3855 } | 3860 } |
| 3856 return type_arguments.TypeTest(test_kind, | 3861 return type_arguments.TypeTest(test_kind, |
| 3857 other_type_arguments, | 3862 other_type_arguments, |
| 3858 from_index, | 3863 from_index, |
| 3859 num_type_params, | 3864 num_type_params, |
| 3860 bound_error, | 3865 bound_error, |
| 3861 space); | 3866 space); |
| 3862 } | 3867 } |
| 3863 const bool other_is_function_class = other.IsFunctionClass(); | 3868 const bool other_is_function_class = other.IsFunctionClass(); |
| 3864 if (other.IsSignatureClass() || other_is_function_class) { | 3869 if (other.IsSignatureClass() || other_is_function_class) { |
| 3865 const Function& other_fun = Function::Handle(isolate, | 3870 const Function& other_fun = Function::Handle(zone, |
| 3866 other.signature_function()); | 3871 other.signature_function()); |
| 3867 if (thsi.IsSignatureClass()) { | 3872 if (thsi.IsSignatureClass()) { |
| 3868 if (other_is_function_class) { | 3873 if (other_is_function_class) { |
| 3869 return true; | 3874 return true; |
| 3870 } | 3875 } |
| 3871 // Check for two function types. | 3876 // Check for two function types. |
| 3872 const Function& fun = | 3877 const Function& fun = |
| 3873 Function::Handle(isolate, thsi.signature_function()); | 3878 Function::Handle(zone, thsi.signature_function()); |
| 3874 return fun.TypeTest(test_kind, | 3879 return fun.TypeTest(test_kind, |
| 3875 type_arguments, | 3880 type_arguments, |
| 3876 other_fun, | 3881 other_fun, |
| 3877 other_type_arguments, | 3882 other_type_arguments, |
| 3878 bound_error, | 3883 bound_error, |
| 3879 space); | 3884 space); |
| 3880 } | 3885 } |
| 3881 // Check if type S has a call() method of function type T. | 3886 // Check if type S has a call() method of function type T. |
| 3882 Function& function = | 3887 Function& function = |
| 3883 Function::Handle(isolate, | 3888 Function::Handle(zone, thsi.LookupDynamicFunction(Symbols::Call())); |
| 3884 thsi.LookupDynamicFunction(Symbols::Call())); | |
| 3885 if (function.IsNull()) { | 3889 if (function.IsNull()) { |
| 3886 // Walk up the super_class chain. | 3890 // Walk up the super_class chain. |
| 3887 Class& cls = Class::Handle(isolate, thsi.SuperClass()); | 3891 Class& cls = Class::Handle(zone, thsi.SuperClass()); |
| 3888 while (!cls.IsNull() && function.IsNull()) { | 3892 while (!cls.IsNull() && function.IsNull()) { |
| 3889 function = cls.LookupDynamicFunction(Symbols::Call()); | 3893 function = cls.LookupDynamicFunction(Symbols::Call()); |
| 3890 cls = cls.SuperClass(); | 3894 cls = cls.SuperClass(); |
| 3891 } | 3895 } |
| 3892 } | 3896 } |
| 3893 if (!function.IsNull()) { | 3897 if (!function.IsNull()) { |
| 3894 if (other_is_function_class || | 3898 if (other_is_function_class || |
| 3895 function.TypeTest(test_kind, | 3899 function.TypeTest(test_kind, |
| 3896 type_arguments, | 3900 type_arguments, |
| 3897 other_fun, | 3901 other_fun, |
| 3898 other_type_arguments, | 3902 other_type_arguments, |
| 3899 bound_error, | 3903 bound_error, |
| 3900 space)) { | 3904 space)) { |
| 3901 return true; | 3905 return true; |
| 3902 } | 3906 } |
| 3903 } | 3907 } |
| 3904 } | 3908 } |
| 3905 // Check for 'direct super type' specified in the implements clause | 3909 // Check for 'direct super type' specified in the implements clause |
| 3906 // and check for transitivity at the same time. | 3910 // and check for transitivity at the same time. |
| 3907 Array& interfaces = Array::Handle(isolate, thsi.interfaces()); | 3911 Array& interfaces = Array::Handle(zone, thsi.interfaces()); |
| 3908 AbstractType& interface = AbstractType::Handle(isolate); | 3912 AbstractType& interface = AbstractType::Handle(zone); |
| 3909 Class& interface_class = Class::Handle(isolate); | 3913 Class& interface_class = Class::Handle(zone); |
| 3910 TypeArguments& interface_args = TypeArguments::Handle(isolate); | 3914 TypeArguments& interface_args = TypeArguments::Handle(zone); |
| 3911 Error& error = Error::Handle(isolate); | 3915 Error& error = Error::Handle(zone); |
| 3912 for (intptr_t i = 0; i < interfaces.Length(); i++) { | 3916 for (intptr_t i = 0; i < interfaces.Length(); i++) { |
| 3913 interface ^= interfaces.At(i); | 3917 interface ^= interfaces.At(i); |
| 3914 if (!interface.IsFinalized()) { | 3918 if (!interface.IsFinalized()) { |
| 3915 // We may be checking bounds at finalization time and can encounter | 3919 // We may be checking bounds at finalization time and can encounter |
| 3916 // a still unfinalized interface. | 3920 // a still unfinalized interface. |
| 3917 ClassFinalizer::FinalizeType( | 3921 ClassFinalizer::FinalizeType( |
| 3918 thsi, interface, ClassFinalizer::kCanonicalize); | 3922 thsi, interface, ClassFinalizer::kCanonicalize); |
| 3919 interfaces.SetAt(i, interface); | 3923 interfaces.SetAt(i, interface); |
| 3920 } | 3924 } |
| 3921 if (interface.IsMalbounded()) { | 3925 if (interface.IsMalbounded()) { |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4209 | 4213 |
| 4210 // No function found. | 4214 // No function found. |
| 4211 return Function::null(); | 4215 return Function::null(); |
| 4212 } | 4216 } |
| 4213 | 4217 |
| 4214 | 4218 |
| 4215 RawFunction* Class::LookupFunctionAtToken(intptr_t token_pos) const { | 4219 RawFunction* Class::LookupFunctionAtToken(intptr_t token_pos) const { |
| 4216 // TODO(hausner): we can shortcut the negative case if we knew the | 4220 // TODO(hausner): we can shortcut the negative case if we knew the |
| 4217 // beginning and end token position of the class. | 4221 // beginning and end token position of the class. |
| 4218 Thread* thread = Thread::Current(); | 4222 Thread* thread = Thread::Current(); |
| 4219 Isolate* isolate = thread->isolate(); | 4223 Zone* zone = thread->zone(); |
| 4220 if (EnsureIsFinalized(thread) != Error::null()) { | 4224 if (EnsureIsFinalized(thread) != Error::null()) { |
| 4221 return Function::null(); | 4225 return Function::null(); |
| 4222 } | 4226 } |
| 4223 Function& func = Function::Handle(isolate); | 4227 Function& func = Function::Handle(zone); |
| 4224 func = LookupClosureFunction(token_pos); | 4228 func = LookupClosureFunction(token_pos); |
| 4225 if (!func.IsNull()) { | 4229 if (!func.IsNull()) { |
| 4226 return func.raw(); | 4230 return func.raw(); |
| 4227 } | 4231 } |
| 4228 Array& funcs = Array::Handle(isolate, functions()); | 4232 Array& funcs = Array::Handle(zone, functions()); |
| 4229 intptr_t len = funcs.Length(); | 4233 intptr_t len = funcs.Length(); |
| 4230 for (intptr_t i = 0; i < len; i++) { | 4234 for (intptr_t i = 0; i < len; i++) { |
| 4231 func ^= funcs.At(i); | 4235 func ^= funcs.At(i); |
| 4232 if ((func.token_pos() <= token_pos) && | 4236 if ((func.token_pos() <= token_pos) && |
| 4233 (token_pos <= func.end_token_pos())) { | 4237 (token_pos <= func.end_token_pos())) { |
| 4234 return func.raw(); | 4238 return func.raw(); |
| 4235 } | 4239 } |
| 4236 } | 4240 } |
| 4237 // No function found. | 4241 // No function found. |
| 4238 return Function::null(); | 4242 return Function::null(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4285 } | 4289 } |
| 4286 return Field::null(); | 4290 return Field::null(); |
| 4287 } | 4291 } |
| 4288 } | 4292 } |
| 4289 // No field found. | 4293 // No field found. |
| 4290 return Field::null(); | 4294 return Field::null(); |
| 4291 } | 4295 } |
| 4292 | 4296 |
| 4293 | 4297 |
| 4294 RawLibraryPrefix* Class::LookupLibraryPrefix(const String& name) const { | 4298 RawLibraryPrefix* Class::LookupLibraryPrefix(const String& name) const { |
| 4295 Isolate* isolate = Isolate::Current(); | 4299 Zone* zone = Thread::Current()->zone(); |
| 4296 const Library& lib = Library::Handle(isolate, library()); | 4300 const Library& lib = Library::Handle(zone, library()); |
| 4297 const Object& obj = Object::Handle(isolate, lib.LookupLocalObject(name)); | 4301 const Object& obj = Object::Handle(zone, lib.LookupLocalObject(name)); |
| 4298 if (!obj.IsNull() && obj.IsLibraryPrefix()) { | 4302 if (!obj.IsNull() && obj.IsLibraryPrefix()) { |
| 4299 return LibraryPrefix::Cast(obj).raw(); | 4303 return LibraryPrefix::Cast(obj).raw(); |
| 4300 } | 4304 } |
| 4301 return LibraryPrefix::null(); | 4305 return LibraryPrefix::null(); |
| 4302 } | 4306 } |
| 4303 | 4307 |
| 4304 | 4308 |
| 4305 const char* Class::ToCString() const { | 4309 const char* Class::ToCString() const { |
| 4306 const Library& lib = Library::Handle(library()); | 4310 const Library& lib = Library::Handle(library()); |
| 4307 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); | 4311 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5022 | 5026 |
| 5023 | 5027 |
| 5024 void TypeArguments::SetLength(intptr_t value) const { | 5028 void TypeArguments::SetLength(intptr_t value) const { |
| 5025 ASSERT(!IsCanonical()); | 5029 ASSERT(!IsCanonical()); |
| 5026 // This is only safe because we create a new Smi, which does not cause | 5030 // This is only safe because we create a new Smi, which does not cause |
| 5027 // heap allocation. | 5031 // heap allocation. |
| 5028 StoreSmi(&raw_ptr()->length_, Smi::New(value)); | 5032 StoreSmi(&raw_ptr()->length_, Smi::New(value)); |
| 5029 } | 5033 } |
| 5030 | 5034 |
| 5031 | 5035 |
| 5032 static void GrowCanonicalTypeArguments(Isolate* isolate, const Array& table) { | 5036 static void GrowCanonicalTypeArguments(Thread* thread, const Array& table) { |
| 5037 Isolate* isolate = thread->isolate(); |
| 5038 Zone* zone = thread->zone(); |
| 5033 // Last element of the array is the number of used elements. | 5039 // Last element of the array is the number of used elements. |
| 5034 const intptr_t table_size = table.Length() - 1; | 5040 const intptr_t table_size = table.Length() - 1; |
| 5035 const intptr_t new_table_size = table_size * 2; | 5041 const intptr_t new_table_size = table_size * 2; |
| 5036 Array& new_table = Array::Handle(isolate, Array::New(new_table_size + 1)); | 5042 Array& new_table = Array::Handle(zone, Array::New(new_table_size + 1)); |
| 5037 // Copy all elements from the original table to the newly allocated | 5043 // Copy all elements from the original table to the newly allocated |
| 5038 // array. | 5044 // array. |
| 5039 TypeArguments& element = TypeArguments::Handle(isolate); | 5045 TypeArguments& element = TypeArguments::Handle(zone); |
| 5040 Object& new_element = Object::Handle(isolate); | 5046 Object& new_element = Object::Handle(zone); |
| 5041 for (intptr_t i = 0; i < table_size; i++) { | 5047 for (intptr_t i = 0; i < table_size; i++) { |
| 5042 element ^= table.At(i); | 5048 element ^= table.At(i); |
| 5043 if (!element.IsNull()) { | 5049 if (!element.IsNull()) { |
| 5044 const intptr_t hash = element.Hash(); | 5050 const intptr_t hash = element.Hash(); |
| 5045 ASSERT(Utils::IsPowerOfTwo(new_table_size)); | 5051 ASSERT(Utils::IsPowerOfTwo(new_table_size)); |
| 5046 intptr_t index = hash & (new_table_size - 1); | 5052 intptr_t index = hash & (new_table_size - 1); |
| 5047 new_element = new_table.At(index); | 5053 new_element = new_table.At(index); |
| 5048 while (!new_element.IsNull()) { | 5054 while (!new_element.IsNull()) { |
| 5049 index = (index + 1) & (new_table_size - 1); // Move to next element. | 5055 index = (index + 1) & (new_table_size - 1); // Move to next element. |
| 5050 new_element = new_table.At(index); | 5056 new_element = new_table.At(index); |
| 5051 } | 5057 } |
| 5052 new_table.SetAt(index, element); | 5058 new_table.SetAt(index, element); |
| 5053 } | 5059 } |
| 5054 } | 5060 } |
| 5055 // Copy used count. | 5061 // Copy used count. |
| 5056 new_element = table.At(table_size); | 5062 new_element = table.At(table_size); |
| 5057 new_table.SetAt(new_table_size, new_element); | 5063 new_table.SetAt(new_table_size, new_element); |
| 5058 // Remember the new table now. | 5064 // Remember the new table now. |
| 5059 isolate->object_store()->set_canonical_type_arguments(new_table); | 5065 isolate->object_store()->set_canonical_type_arguments(new_table); |
| 5060 } | 5066 } |
| 5061 | 5067 |
| 5062 | 5068 |
| 5063 static void InsertIntoCanonicalTypeArguments(Isolate* isolate, | 5069 static void InsertIntoCanonicalTypeArguments(Thread* thread, |
| 5064 const Array& table, | 5070 const Array& table, |
| 5065 const TypeArguments& arguments, | 5071 const TypeArguments& arguments, |
| 5066 intptr_t index) { | 5072 intptr_t index) { |
| 5073 Zone* zone = thread->zone(); |
| 5067 arguments.SetCanonical(); // Mark object as being canonical. | 5074 arguments.SetCanonical(); // Mark object as being canonical. |
| 5068 table.SetAt(index, arguments); // Remember the new element. | 5075 table.SetAt(index, arguments); // Remember the new element. |
| 5069 // Update used count. | 5076 // Update used count. |
| 5070 // Last element of the array is the number of used elements. | 5077 // Last element of the array is the number of used elements. |
| 5071 const intptr_t table_size = table.Length() - 1; | 5078 const intptr_t table_size = table.Length() - 1; |
| 5072 const intptr_t used_elements = | 5079 const intptr_t used_elements = |
| 5073 Smi::Value(Smi::RawCast(table.At(table_size))) + 1; | 5080 Smi::Value(Smi::RawCast(table.At(table_size))) + 1; |
| 5074 const Smi& used = Smi::Handle(isolate, Smi::New(used_elements)); | 5081 const Smi& used = Smi::Handle(zone, Smi::New(used_elements)); |
| 5075 table.SetAt(table_size, used); | 5082 table.SetAt(table_size, used); |
| 5076 | 5083 |
| 5077 #ifdef DEBUG | 5084 #ifdef DEBUG |
| 5078 // Verify that there are no duplicates. | 5085 // Verify that there are no duplicates. |
| 5079 // Duplicates could appear if hash values are not kept constant across | 5086 // Duplicates could appear if hash values are not kept constant across |
| 5080 // snapshots, e.g. if class ids are not preserved by the snapshots. | 5087 // snapshots, e.g. if class ids are not preserved by the snapshots. |
| 5081 TypeArguments& other_arguments = TypeArguments::Handle(); | 5088 TypeArguments& other_arguments = TypeArguments::Handle(); |
| 5082 for (intptr_t i = 0; i < table_size; i++) { | 5089 for (intptr_t i = 0; i < table_size; i++) { |
| 5083 if ((i != index) && (table.At(i) != TypeArguments::null())) { | 5090 if ((i != index) && (table.At(i) != TypeArguments::null())) { |
| 5084 other_arguments ^= table.At(i); | 5091 other_arguments ^= table.At(i); |
| 5085 if (arguments.Equals(other_arguments)) { | 5092 if (arguments.Equals(other_arguments)) { |
| 5086 // Recursive types may be equal, but have different hashes. | 5093 // Recursive types may be equal, but have different hashes. |
| 5087 ASSERT(arguments.IsRecursive()); | 5094 ASSERT(arguments.IsRecursive()); |
| 5088 ASSERT(other_arguments.IsRecursive()); | 5095 ASSERT(other_arguments.IsRecursive()); |
| 5089 ASSERT(arguments.Hash() != other_arguments.Hash()); | 5096 ASSERT(arguments.Hash() != other_arguments.Hash()); |
| 5090 } | 5097 } |
| 5091 } | 5098 } |
| 5092 } | 5099 } |
| 5093 #endif | 5100 #endif |
| 5094 | 5101 |
| 5095 // Rehash if table is 75% full. | 5102 // Rehash if table is 75% full. |
| 5096 if (used_elements > ((table_size / 4) * 3)) { | 5103 if (used_elements > ((table_size / 4) * 3)) { |
| 5097 GrowCanonicalTypeArguments(isolate, table); | 5104 GrowCanonicalTypeArguments(thread, table); |
| 5098 } | 5105 } |
| 5099 } | 5106 } |
| 5100 | 5107 |
| 5101 | 5108 |
| 5102 static intptr_t FindIndexInCanonicalTypeArguments( | 5109 static intptr_t FindIndexInCanonicalTypeArguments( |
| 5103 Isolate* isolate, | 5110 Zone* zone, |
| 5104 const Array& table, | 5111 const Array& table, |
| 5105 const TypeArguments& arguments, | 5112 const TypeArguments& arguments, |
| 5106 intptr_t hash) { | 5113 intptr_t hash) { |
| 5107 // Last element of the array is the number of used elements. | 5114 // Last element of the array is the number of used elements. |
| 5108 const intptr_t table_size = table.Length() - 1; | 5115 const intptr_t table_size = table.Length() - 1; |
| 5109 ASSERT(Utils::IsPowerOfTwo(table_size)); | 5116 ASSERT(Utils::IsPowerOfTwo(table_size)); |
| 5110 intptr_t index = hash & (table_size - 1); | 5117 intptr_t index = hash & (table_size - 1); |
| 5111 | 5118 |
| 5112 TypeArguments& current = TypeArguments::Handle(isolate); | 5119 TypeArguments& current = TypeArguments::Handle(zone); |
| 5113 current ^= table.At(index); | 5120 current ^= table.At(index); |
| 5114 while (!current.IsNull() && !current.Equals(arguments)) { | 5121 while (!current.IsNull() && !current.Equals(arguments)) { |
| 5115 index = (index + 1) & (table_size - 1); // Move to next element. | 5122 index = (index + 1) & (table_size - 1); // Move to next element. |
| 5116 current ^= table.At(index); | 5123 current ^= table.At(index); |
| 5117 } | 5124 } |
| 5118 return index; // Index of element if found or slot into which to add it. | 5125 return index; // Index of element if found or slot into which to add it. |
| 5119 } | 5126 } |
| 5120 | 5127 |
| 5121 | 5128 |
| 5122 RawTypeArguments* TypeArguments::CloneUnfinalized() const { | 5129 RawTypeArguments* TypeArguments::CloneUnfinalized() const { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5162 | 5169 |
| 5163 RawTypeArguments* TypeArguments::Canonicalize(TrailPtr trail) const { | 5170 RawTypeArguments* TypeArguments::Canonicalize(TrailPtr trail) const { |
| 5164 if (IsNull() || IsCanonical()) { | 5171 if (IsNull() || IsCanonical()) { |
| 5165 ASSERT(IsOld()); | 5172 ASSERT(IsOld()); |
| 5166 return this->raw(); | 5173 return this->raw(); |
| 5167 } | 5174 } |
| 5168 const intptr_t num_types = Length(); | 5175 const intptr_t num_types = Length(); |
| 5169 if (IsRaw(0, num_types)) { | 5176 if (IsRaw(0, num_types)) { |
| 5170 return TypeArguments::null(); | 5177 return TypeArguments::null(); |
| 5171 } | 5178 } |
| 5172 Isolate* isolate = Isolate::Current(); | 5179 Thread* thread = Thread::Current(); |
| 5180 Zone* zone = thread->zone(); |
| 5181 Isolate* isolate = thread->isolate(); |
| 5173 ObjectStore* object_store = isolate->object_store(); | 5182 ObjectStore* object_store = isolate->object_store(); |
| 5174 Array& table = Array::Handle(isolate, | 5183 Array& table = Array::Handle(zone, |
| 5175 object_store->canonical_type_arguments()); | 5184 object_store->canonical_type_arguments()); |
| 5176 // Last element of the array is the number of used elements. | 5185 // Last element of the array is the number of used elements. |
| 5177 const intptr_t num_used = | 5186 const intptr_t num_used = |
| 5178 Smi::Value(Smi::RawCast(table.At(table.Length() - 1))); | 5187 Smi::Value(Smi::RawCast(table.At(table.Length() - 1))); |
| 5179 const intptr_t hash = Hash(); | 5188 const intptr_t hash = Hash(); |
| 5180 intptr_t index = | 5189 intptr_t index = FindIndexInCanonicalTypeArguments(zone, table, *this, hash); |
| 5181 FindIndexInCanonicalTypeArguments(isolate, table, *this, hash); | 5190 TypeArguments& result = TypeArguments::Handle(zone); |
| 5182 TypeArguments& result = TypeArguments::Handle(isolate); | |
| 5183 result ^= table.At(index); | 5191 result ^= table.At(index); |
| 5184 if (result.IsNull()) { | 5192 if (result.IsNull()) { |
| 5185 // Canonicalize each type argument. | 5193 // Canonicalize each type argument. |
| 5186 AbstractType& type_arg = AbstractType::Handle(isolate); | 5194 AbstractType& type_arg = AbstractType::Handle(zone); |
| 5187 for (intptr_t i = 0; i < num_types; i++) { | 5195 for (intptr_t i = 0; i < num_types; i++) { |
| 5188 type_arg = TypeAt(i); | 5196 type_arg = TypeAt(i); |
| 5189 type_arg = type_arg.Canonicalize(trail); | 5197 type_arg = type_arg.Canonicalize(trail); |
| 5190 SetTypeAt(i, type_arg); | 5198 SetTypeAt(i, type_arg); |
| 5191 } | 5199 } |
| 5192 // Canonicalization of a recursive type may change its hash. | 5200 // Canonicalization of a recursive type may change its hash. |
| 5193 intptr_t canonical_hash = hash; | 5201 intptr_t canonical_hash = hash; |
| 5194 if (IsRecursive()) { | 5202 if (IsRecursive()) { |
| 5195 canonical_hash = Hash(); | 5203 canonical_hash = Hash(); |
| 5196 } | 5204 } |
| 5197 // Canonicalization of the type argument's own type arguments may add an | 5205 // Canonicalization of the type argument's own type arguments may add an |
| 5198 // entry to the table, or even grow the table, and thereby change the | 5206 // entry to the table, or even grow the table, and thereby change the |
| 5199 // previously calculated index. | 5207 // previously calculated index. |
| 5200 table = object_store->canonical_type_arguments(); | 5208 table = object_store->canonical_type_arguments(); |
| 5201 if ((canonical_hash != hash) || | 5209 if ((canonical_hash != hash) || |
| 5202 (Smi::Value(Smi::RawCast(table.At(table.Length() - 1))) != num_used)) { | 5210 (Smi::Value(Smi::RawCast(table.At(table.Length() - 1))) != num_used)) { |
| 5203 index = FindIndexInCanonicalTypeArguments( | 5211 index = FindIndexInCanonicalTypeArguments( |
| 5204 isolate, table, *this, canonical_hash); | 5212 zone, table, *this, canonical_hash); |
| 5205 result ^= table.At(index); | 5213 result ^= table.At(index); |
| 5206 } | 5214 } |
| 5207 if (result.IsNull()) { | 5215 if (result.IsNull()) { |
| 5208 // Make sure we have an old space object and add it to the table. | 5216 // Make sure we have an old space object and add it to the table. |
| 5209 if (this->IsNew()) { | 5217 if (this->IsNew()) { |
| 5210 result ^= Object::Clone(*this, Heap::kOld); | 5218 result ^= Object::Clone(*this, Heap::kOld); |
| 5211 } else { | 5219 } else { |
| 5212 result ^= this->raw(); | 5220 result ^= this->raw(); |
| 5213 } | 5221 } |
| 5214 ASSERT(result.IsOld()); | 5222 ASSERT(result.IsOld()); |
| 5215 InsertIntoCanonicalTypeArguments(isolate, table, result, index); | 5223 InsertIntoCanonicalTypeArguments(thread, table, result, index); |
| 5216 } | 5224 } |
| 5217 } | 5225 } |
| 5218 ASSERT(result.Equals(*this)); | 5226 ASSERT(result.Equals(*this)); |
| 5219 ASSERT(!result.IsNull()); | 5227 ASSERT(!result.IsNull()); |
| 5220 ASSERT(result.IsTypeArguments()); | 5228 ASSERT(result.IsTypeArguments()); |
| 5221 ASSERT(result.IsCanonical()); | 5229 ASSERT(result.IsCanonical()); |
| 5222 return result.raw(); | 5230 return result.raw(); |
| 5223 } | 5231 } |
| 5224 | 5232 |
| 5225 | 5233 |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5922 const Array& argument_names, | 5930 const Array& argument_names, |
| 5923 String* error_message) const { | 5931 String* error_message) const { |
| 5924 const intptr_t num_named_arguments = | 5932 const intptr_t num_named_arguments = |
| 5925 argument_names.IsNull() ? 0 : argument_names.Length(); | 5933 argument_names.IsNull() ? 0 : argument_names.Length(); |
| 5926 if (!AreValidArgumentCounts(num_arguments, | 5934 if (!AreValidArgumentCounts(num_arguments, |
| 5927 num_named_arguments, | 5935 num_named_arguments, |
| 5928 error_message)) { | 5936 error_message)) { |
| 5929 return false; | 5937 return false; |
| 5930 } | 5938 } |
| 5931 // Verify that all argument names are valid parameter names. | 5939 // Verify that all argument names are valid parameter names. |
| 5932 Isolate* isolate = Isolate::Current(); | 5940 Zone* zone = Thread::Current()->zone(); |
| 5933 String& argument_name = String::Handle(isolate); | 5941 String& argument_name = String::Handle(zone); |
| 5934 String& parameter_name = String::Handle(isolate); | 5942 String& parameter_name = String::Handle(zone); |
| 5935 for (intptr_t i = 0; i < num_named_arguments; i++) { | 5943 for (intptr_t i = 0; i < num_named_arguments; i++) { |
| 5936 argument_name ^= argument_names.At(i); | 5944 argument_name ^= argument_names.At(i); |
| 5937 ASSERT(argument_name.IsSymbol()); | 5945 ASSERT(argument_name.IsSymbol()); |
| 5938 bool found = false; | 5946 bool found = false; |
| 5939 const intptr_t num_positional_args = num_arguments - num_named_arguments; | 5947 const intptr_t num_positional_args = num_arguments - num_named_arguments; |
| 5940 const intptr_t num_parameters = NumParameters(); | 5948 const intptr_t num_parameters = NumParameters(); |
| 5941 for (intptr_t j = num_positional_args; | 5949 for (intptr_t j = num_positional_args; |
| 5942 !found && (j < num_parameters); | 5950 !found && (j < num_parameters); |
| 5943 j++) { | 5951 j++) { |
| 5944 parameter_name = ParameterNameAt(j); | 5952 parameter_name = ParameterNameAt(j); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 5970 String* error_message) const { | 5978 String* error_message) const { |
| 5971 const intptr_t num_arguments = args_desc.Count(); | 5979 const intptr_t num_arguments = args_desc.Count(); |
| 5972 const intptr_t num_named_arguments = args_desc.NamedCount(); | 5980 const intptr_t num_named_arguments = args_desc.NamedCount(); |
| 5973 | 5981 |
| 5974 if (!AreValidArgumentCounts(num_arguments, | 5982 if (!AreValidArgumentCounts(num_arguments, |
| 5975 num_named_arguments, | 5983 num_named_arguments, |
| 5976 error_message)) { | 5984 error_message)) { |
| 5977 return false; | 5985 return false; |
| 5978 } | 5986 } |
| 5979 // Verify that all argument names are valid parameter names. | 5987 // Verify that all argument names are valid parameter names. |
| 5980 Isolate* isolate = Isolate::Current(); | 5988 Zone* zone = Thread::Current()->zone(); |
| 5981 String& argument_name = String::Handle(isolate); | 5989 String& argument_name = String::Handle(zone); |
| 5982 String& parameter_name = String::Handle(isolate); | 5990 String& parameter_name = String::Handle(zone); |
| 5983 for (intptr_t i = 0; i < num_named_arguments; i++) { | 5991 for (intptr_t i = 0; i < num_named_arguments; i++) { |
| 5984 argument_name ^= args_desc.NameAt(i); | 5992 argument_name ^= args_desc.NameAt(i); |
| 5985 ASSERT(argument_name.IsSymbol()); | 5993 ASSERT(argument_name.IsSymbol()); |
| 5986 bool found = false; | 5994 bool found = false; |
| 5987 const intptr_t num_positional_args = num_arguments - num_named_arguments; | 5995 const intptr_t num_positional_args = num_arguments - num_named_arguments; |
| 5988 const int num_parameters = NumParameters(); | 5996 const int num_parameters = NumParameters(); |
| 5989 for (intptr_t j = num_positional_args; | 5997 for (intptr_t j = num_positional_args; |
| 5990 !found && (j < num_parameters); | 5998 !found && (j < num_parameters); |
| 5991 j++) { | 5999 j++) { |
| 5992 parameter_name = ParameterNameAt(j); | 6000 parameter_name = ParameterNameAt(j); |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6651 pieces->Add(Symbols::RBracket()); | 6659 pieces->Add(Symbols::RBracket()); |
| 6652 } else { | 6660 } else { |
| 6653 pieces->Add(Symbols::RBrace()); | 6661 pieces->Add(Symbols::RBrace()); |
| 6654 } | 6662 } |
| 6655 } | 6663 } |
| 6656 } | 6664 } |
| 6657 | 6665 |
| 6658 | 6666 |
| 6659 RawInstance* Function::ImplicitStaticClosure() const { | 6667 RawInstance* Function::ImplicitStaticClosure() const { |
| 6660 if (implicit_static_closure() == Instance::null()) { | 6668 if (implicit_static_closure() == Instance::null()) { |
| 6661 Isolate* isolate = Isolate::Current(); | 6669 Thread* thread = Thread::Current(); |
| 6670 Isolate* isolate = thread->isolate(); |
| 6671 Zone* zone = thread->zone(); |
| 6662 ObjectStore* object_store = isolate->object_store(); | 6672 ObjectStore* object_store = isolate->object_store(); |
| 6663 const Context& context = | 6673 const Context& context = |
| 6664 Context::Handle(isolate, object_store->empty_context()); | 6674 Context::Handle(zone, object_store->empty_context()); |
| 6665 Instance& closure = | 6675 Instance& closure = |
| 6666 Instance::Handle(isolate, Closure::New(*this, context, Heap::kOld)); | 6676 Instance::Handle(zone, Closure::New(*this, context, Heap::kOld)); |
| 6667 const char* error_str = NULL; | 6677 const char* error_str = NULL; |
| 6668 closure ^= closure.CheckAndCanonicalize(&error_str); | 6678 closure ^= closure.CheckAndCanonicalize(&error_str); |
| 6669 ASSERT(!closure.IsNull()); | 6679 ASSERT(!closure.IsNull()); |
| 6670 set_implicit_static_closure(closure); | 6680 set_implicit_static_closure(closure); |
| 6671 } | 6681 } |
| 6672 return implicit_static_closure(); | 6682 return implicit_static_closure(); |
| 6673 } | 6683 } |
| 6674 | 6684 |
| 6675 | 6685 |
| 6676 RawInstance* Function::ImplicitInstanceClosure(const Instance& receiver) const { | 6686 RawInstance* Function::ImplicitInstanceClosure(const Instance& receiver) const { |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8171 } | 8181 } |
| 8172 | 8182 |
| 8173 | 8183 |
| 8174 RawTokenStream* TokenStream::New(intptr_t len) { | 8184 RawTokenStream* TokenStream::New(intptr_t len) { |
| 8175 if (len < 0 || len > kMaxElements) { | 8185 if (len < 0 || len > kMaxElements) { |
| 8176 // This should be caught before we reach here. | 8186 // This should be caught before we reach here. |
| 8177 FATAL1("Fatal error in TokenStream::New: invalid len %" Pd "\n", len); | 8187 FATAL1("Fatal error in TokenStream::New: invalid len %" Pd "\n", len); |
| 8178 } | 8188 } |
| 8179 uint8_t* data = reinterpret_cast<uint8_t*>(::malloc(len)); | 8189 uint8_t* data = reinterpret_cast<uint8_t*>(::malloc(len)); |
| 8180 ASSERT(data != NULL); | 8190 ASSERT(data != NULL); |
| 8181 Isolate* isolate = Isolate::Current(); | 8191 Zone* zone = Thread::Current()->zone(); |
| 8182 const ExternalTypedData& stream = ExternalTypedData::Handle( | 8192 const ExternalTypedData& stream = ExternalTypedData::Handle( |
| 8183 isolate, | 8193 zone, |
| 8184 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, | 8194 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, |
| 8185 data, len, Heap::kOld)); | 8195 data, len, Heap::kOld)); |
| 8186 stream.AddFinalizer(data, DataFinalizer); | 8196 stream.AddFinalizer(data, DataFinalizer); |
| 8187 const TokenStream& result = TokenStream::Handle(isolate, TokenStream::New()); | 8197 const TokenStream& result = TokenStream::Handle(zone, TokenStream::New()); |
| 8188 result.SetStream(stream); | 8198 result.SetStream(stream); |
| 8189 return result.raw(); | 8199 return result.raw(); |
| 8190 } | 8200 } |
| 8191 | 8201 |
| 8192 | 8202 |
| 8193 // CompressedTokenMap maps String and LiteralToken keys to Smi values. | 8203 // CompressedTokenMap maps String and LiteralToken keys to Smi values. |
| 8194 // It also supports lookup by Scanner::TokenDescriptor. | 8204 // It also supports lookup by Scanner::TokenDescriptor. |
| 8195 class CompressedTokenTraits { | 8205 class CompressedTokenTraits { |
| 8196 public: | 8206 public: |
| 8197 static bool IsMatch(const Scanner::TokenDescriptor& descriptor, | 8207 static bool IsMatch(const Scanner::TokenDescriptor& descriptor, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8304 uint8_t* buffer_; | 8314 uint8_t* buffer_; |
| 8305 WriteStream stream_; | 8315 WriteStream stream_; |
| 8306 CompressedTokenMap tokens_; | 8316 CompressedTokenMap tokens_; |
| 8307 | 8317 |
| 8308 DISALLOW_COPY_AND_ASSIGN(CompressedTokenStreamData); | 8318 DISALLOW_COPY_AND_ASSIGN(CompressedTokenStreamData); |
| 8309 }; | 8319 }; |
| 8310 | 8320 |
| 8311 | 8321 |
| 8312 RawTokenStream* TokenStream::New(const Scanner::GrowableTokenStream& tokens, | 8322 RawTokenStream* TokenStream::New(const Scanner::GrowableTokenStream& tokens, |
| 8313 const String& private_key) { | 8323 const String& private_key) { |
| 8314 Isolate* isolate = Isolate::Current(); | 8324 Zone* zone = Thread::Current()->zone(); |
| 8315 // Copy the relevant data out of the scanner into a compressed stream of | 8325 // Copy the relevant data out of the scanner into a compressed stream of |
| 8316 // tokens. | 8326 // tokens. |
| 8317 CompressedTokenStreamData data; | 8327 CompressedTokenStreamData data; |
| 8318 intptr_t len = tokens.length(); | 8328 intptr_t len = tokens.length(); |
| 8319 for (intptr_t i = 0; i < len; i++) { | 8329 for (intptr_t i = 0; i < len; i++) { |
| 8320 Scanner::TokenDescriptor token = tokens[i]; | 8330 Scanner::TokenDescriptor token = tokens[i]; |
| 8321 if (token.kind == Token::kIDENT) { // Identifier token. | 8331 if (token.kind == Token::kIDENT) { // Identifier token. |
| 8322 data.AddIdentToken(token.literal); | 8332 data.AddIdentToken(token.literal); |
| 8323 } else if (Token::NeedsLiteralToken(token.kind)) { // Literal token. | 8333 } else if (Token::NeedsLiteralToken(token.kind)) { // Literal token. |
| 8324 data.AddLiteralToken(token); | 8334 data.AddLiteralToken(token); |
| 8325 } else { // Keyword, pseudo keyword etc. | 8335 } else { // Keyword, pseudo keyword etc. |
| 8326 ASSERT(token.kind < Token::kNumTokens); | 8336 ASSERT(token.kind < Token::kNumTokens); |
| 8327 data.AddSimpleToken(token.kind); | 8337 data.AddSimpleToken(token.kind); |
| 8328 } | 8338 } |
| 8329 } | 8339 } |
| 8330 data.AddSimpleToken(Token::kEOS); // End of stream. | 8340 data.AddSimpleToken(Token::kEOS); // End of stream. |
| 8331 | 8341 |
| 8332 // Create and setup the token stream object. | 8342 // Create and setup the token stream object. |
| 8333 const ExternalTypedData& stream = ExternalTypedData::Handle( | 8343 const ExternalTypedData& stream = ExternalTypedData::Handle( |
| 8334 isolate, | 8344 zone, |
| 8335 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, | 8345 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, |
| 8336 data.GetStream(), data.Length(), Heap::kOld)); | 8346 data.GetStream(), data.Length(), Heap::kOld)); |
| 8337 stream.AddFinalizer(data.GetStream(), DataFinalizer); | 8347 stream.AddFinalizer(data.GetStream(), DataFinalizer); |
| 8338 const TokenStream& result = TokenStream::Handle(isolate, New()); | 8348 const TokenStream& result = TokenStream::Handle(zone, New()); |
| 8339 result.SetPrivateKey(private_key); | 8349 result.SetPrivateKey(private_key); |
| 8340 const Array& token_objects = | 8350 const Array& token_objects = |
| 8341 Array::Handle(isolate, data.MakeTokenObjectsArray()); | 8351 Array::Handle(zone, data.MakeTokenObjectsArray()); |
| 8342 { | 8352 { |
| 8343 NoSafepointScope no_safepoint; | 8353 NoSafepointScope no_safepoint; |
| 8344 result.SetStream(stream); | 8354 result.SetStream(stream); |
| 8345 result.SetTokenObjects(token_objects); | 8355 result.SetTokenObjects(token_objects); |
| 8346 } | 8356 } |
| 8347 return result.raw(); | 8357 return result.raw(); |
| 8348 } | 8358 } |
| 8349 | 8359 |
| 8350 | 8360 |
| 8351 const char* TokenStream::ToCString() const { | 8361 const char* TokenStream::ToCString() const { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8519 } | 8529 } |
| 8520 | 8530 |
| 8521 | 8531 |
| 8522 RawString* Script::GenerateSource() const { | 8532 RawString* Script::GenerateSource() const { |
| 8523 const TokenStream& token_stream = TokenStream::Handle(tokens()); | 8533 const TokenStream& token_stream = TokenStream::Handle(tokens()); |
| 8524 return token_stream.GenerateSource(); | 8534 return token_stream.GenerateSource(); |
| 8525 } | 8535 } |
| 8526 | 8536 |
| 8527 | 8537 |
| 8528 RawGrowableObjectArray* Script::GenerateLineNumberArray() const { | 8538 RawGrowableObjectArray* Script::GenerateLineNumberArray() const { |
| 8529 Isolate* isolate = Isolate::Current(); | 8539 Zone* zone = Thread::Current()->zone(); |
| 8530 const GrowableObjectArray& info = | 8540 const GrowableObjectArray& info = |
| 8531 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); | 8541 GrowableObjectArray::Handle(zone, GrowableObjectArray::New()); |
| 8532 const String& source = String::Handle(isolate, Source()); | 8542 const String& source = String::Handle(zone, Source()); |
| 8533 const String& key = Symbols::Empty(); | 8543 const String& key = Symbols::Empty(); |
| 8534 const Object& line_separator = Object::Handle(isolate); | 8544 const Object& line_separator = Object::Handle(zone); |
| 8535 const TokenStream& tkns = TokenStream::Handle(isolate, tokens()); | 8545 const TokenStream& tkns = TokenStream::Handle(zone, tokens()); |
| 8536 Smi& value = Smi::Handle(isolate); | 8546 Smi& value = Smi::Handle(zone); |
| 8537 String& tokenValue = String::Handle(isolate); | 8547 String& tokenValue = String::Handle(zone); |
| 8538 ASSERT(!tkns.IsNull()); | 8548 ASSERT(!tkns.IsNull()); |
| 8539 TokenStream::Iterator tkit(tkns, 0, TokenStream::Iterator::kAllTokens); | 8549 TokenStream::Iterator tkit(tkns, 0, TokenStream::Iterator::kAllTokens); |
| 8540 int current_line = -1; | 8550 int current_line = -1; |
| 8541 Scanner s(source, key); | 8551 Scanner s(source, key); |
| 8542 s.Scan(); | 8552 s.Scan(); |
| 8543 bool skippedNewline = false; | 8553 bool skippedNewline = false; |
| 8544 while (tkit.CurrentTokenKind() != Token::kEOS) { | 8554 while (tkit.CurrentTokenKind() != Token::kEOS) { |
| 8545 if (tkit.CurrentTokenKind() == Token::kNEWLINE) { | 8555 if (tkit.CurrentTokenKind() == Token::kNEWLINE) { |
| 8546 // Skip newlines from the token stream. | 8556 // Skip newlines from the token stream. |
| 8547 skippedNewline = true; | 8557 skippedNewline = true; |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8870 return result.raw(); | 8880 return result.raw(); |
| 8871 } | 8881 } |
| 8872 | 8882 |
| 8873 | 8883 |
| 8874 const char* Script::ToCString() const { | 8884 const char* Script::ToCString() const { |
| 8875 return "Script"; | 8885 return "Script"; |
| 8876 } | 8886 } |
| 8877 | 8887 |
| 8878 | 8888 |
| 8879 RawLibrary* Script::FindLibrary() const { | 8889 RawLibrary* Script::FindLibrary() const { |
| 8880 Isolate* isolate = Isolate::Current(); | 8890 Thread* thread = Thread::Current(); |
| 8891 Zone* zone = thread->zone(); |
| 8892 Isolate* isolate = thread->isolate(); |
| 8881 const GrowableObjectArray& libs = GrowableObjectArray::Handle( | 8893 const GrowableObjectArray& libs = GrowableObjectArray::Handle( |
| 8882 isolate, isolate->object_store()->libraries()); | 8894 zone, isolate->object_store()->libraries()); |
| 8883 Library& lib = Library::Handle(); | 8895 Library& lib = Library::Handle(); |
| 8884 Array& scripts = Array::Handle(); | 8896 Array& scripts = Array::Handle(); |
| 8885 for (intptr_t i = 0; i < libs.Length(); i++) { | 8897 for (intptr_t i = 0; i < libs.Length(); i++) { |
| 8886 lib ^= libs.At(i); | 8898 lib ^= libs.At(i); |
| 8887 scripts = lib.LoadedScripts(); | 8899 scripts = lib.LoadedScripts(); |
| 8888 for (intptr_t j = 0; j < scripts.Length(); j++) { | 8900 for (intptr_t j = 0; j < scripts.Length(); j++) { |
| 8889 if (scripts.At(j) == raw()) { | 8901 if (scripts.At(j) == raw()) { |
| 8890 return lib.raw(); | 8902 return lib.raw(); |
| 8891 } | 8903 } |
| 8892 } | 8904 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9119 | 9131 |
| 9120 typedef UnorderedHashSet<LibraryUrlTraits> LibraryLoadErrorSet; | 9132 typedef UnorderedHashSet<LibraryUrlTraits> LibraryLoadErrorSet; |
| 9121 | 9133 |
| 9122 | 9134 |
| 9123 RawInstance* Library::TransitiveLoadError() const { | 9135 RawInstance* Library::TransitiveLoadError() const { |
| 9124 if (LoadError() != Instance::null()) { | 9136 if (LoadError() != Instance::null()) { |
| 9125 return LoadError(); | 9137 return LoadError(); |
| 9126 } | 9138 } |
| 9127 Thread* thread = Thread::Current(); | 9139 Thread* thread = Thread::Current(); |
| 9128 Isolate* isolate = thread->isolate(); | 9140 Isolate* isolate = thread->isolate(); |
| 9141 Zone* zone = thread->zone(); |
| 9129 ObjectStore* object_store = isolate->object_store(); | 9142 ObjectStore* object_store = isolate->object_store(); |
| 9130 LibraryLoadErrorSet set(object_store->library_load_error_table()); | 9143 LibraryLoadErrorSet set(object_store->library_load_error_table()); |
| 9131 bool present = false; | 9144 bool present = false; |
| 9132 if (set.GetOrNull(*this, &present) != Object::null()) { | 9145 if (set.GetOrNull(*this, &present) != Object::null()) { |
| 9133 object_store->set_library_load_error_table(set.Release()); | 9146 object_store->set_library_load_error_table(set.Release()); |
| 9134 return Instance::null(); | 9147 return Instance::null(); |
| 9135 } | 9148 } |
| 9136 // Ensure we don't repeatedly visit the same library again. | 9149 // Ensure we don't repeatedly visit the same library again. |
| 9137 set.Insert(*this); | 9150 set.Insert(*this); |
| 9138 object_store->set_library_load_error_table(set.Release()); | 9151 object_store->set_library_load_error_table(set.Release()); |
| 9139 intptr_t num_imp = num_imports(); | 9152 intptr_t num_imp = num_imports(); |
| 9140 Library& lib = Library::Handle(isolate); | 9153 Library& lib = Library::Handle(zone); |
| 9141 Instance& error = Instance::Handle(isolate); | 9154 Instance& error = Instance::Handle(zone); |
| 9142 for (intptr_t i = 0; i < num_imp; i++) { | 9155 for (intptr_t i = 0; i < num_imp; i++) { |
| 9143 HANDLESCOPE(thread); | 9156 HANDLESCOPE(thread); |
| 9144 lib = ImportLibraryAt(i); | 9157 lib = ImportLibraryAt(i); |
| 9145 error = lib.TransitiveLoadError(); | 9158 error = lib.TransitiveLoadError(); |
| 9146 if (!error.IsNull()) { | 9159 if (!error.IsNull()) { |
| 9147 break; | 9160 break; |
| 9148 } | 9161 } |
| 9149 } | 9162 } |
| 9150 return error.raw(); | 9163 return error.raw(); |
| 9151 } | 9164 } |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9703 RawFunction* Library::LookupLocalFunction(const String& name) const { | 9716 RawFunction* Library::LookupLocalFunction(const String& name) const { |
| 9704 Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); | 9717 Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); |
| 9705 if (obj.IsFunction()) { | 9718 if (obj.IsFunction()) { |
| 9706 return Function::Cast(obj).raw(); | 9719 return Function::Cast(obj).raw(); |
| 9707 } | 9720 } |
| 9708 return Function::null(); | 9721 return Function::null(); |
| 9709 } | 9722 } |
| 9710 | 9723 |
| 9711 | 9724 |
| 9712 RawObject* Library::LookupLocalObjectAllowPrivate(const String& name) const { | 9725 RawObject* Library::LookupLocalObjectAllowPrivate(const String& name) const { |
| 9713 Isolate* isolate = Isolate::Current(); | 9726 Thread* thread = Thread::Current(); |
| 9714 Object& obj = Object::Handle(isolate, Object::null()); | 9727 Zone* zone = thread->zone(); |
| 9728 Object& obj = Object::Handle(zone, Object::null()); |
| 9715 obj = LookupLocalObject(name); | 9729 obj = LookupLocalObject(name); |
| 9716 if (obj.IsNull() && ShouldBePrivate(name)) { | 9730 if (obj.IsNull() && ShouldBePrivate(name)) { |
| 9717 String& private_name = String::Handle(isolate, PrivateName(name)); | 9731 String& private_name = String::Handle(zone, PrivateName(name)); |
| 9718 obj = LookupLocalObject(private_name); | 9732 obj = LookupLocalObject(private_name); |
| 9719 } | 9733 } |
| 9720 return obj.raw(); | 9734 return obj.raw(); |
| 9721 } | 9735 } |
| 9722 | 9736 |
| 9723 | 9737 |
| 9724 RawObject* Library::LookupObjectAllowPrivate(const String& name) const { | 9738 RawObject* Library::LookupObjectAllowPrivate(const String& name) const { |
| 9725 // First check if name is found in the local scope of the library. | 9739 // First check if name is found in the local scope of the library. |
| 9726 Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); | 9740 Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); |
| 9727 if (!obj.IsNull()) { | 9741 if (!obj.IsNull()) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9806 if (obj.IsClass()) { | 9820 if (obj.IsClass()) { |
| 9807 return Class::Cast(obj).raw(); | 9821 return Class::Cast(obj).raw(); |
| 9808 } | 9822 } |
| 9809 return Class::null(); | 9823 return Class::null(); |
| 9810 } | 9824 } |
| 9811 | 9825 |
| 9812 | 9826 |
| 9813 RawClass* Library::LookupClassAllowPrivate(const String& name) const { | 9827 RawClass* Library::LookupClassAllowPrivate(const String& name) const { |
| 9814 // See if the class is available in this library or in the top level | 9828 // See if the class is available in this library or in the top level |
| 9815 // scope of any imported library. | 9829 // scope of any imported library. |
| 9816 Isolate* isolate = Isolate::Current(); | 9830 Zone* zone = Thread::Current()->zone(); |
| 9817 const Class& cls = Class::Handle(isolate, LookupClass(name)); | 9831 const Class& cls = Class::Handle(zone, LookupClass(name)); |
| 9818 if (!cls.IsNull()) { | 9832 if (!cls.IsNull()) { |
| 9819 return cls.raw(); | 9833 return cls.raw(); |
| 9820 } | 9834 } |
| 9821 | 9835 |
| 9822 // Now try to lookup the class using its private name, but only in | 9836 // Now try to lookup the class using its private name, but only in |
| 9823 // this library (not in imported libraries). | 9837 // this library (not in imported libraries). |
| 9824 if (ShouldBePrivate(name)) { | 9838 if (ShouldBePrivate(name)) { |
| 9825 String& private_name = String::Handle(isolate, PrivateName(name)); | 9839 String& private_name = String::Handle(zone, PrivateName(name)); |
| 9826 const Object& obj = Object::Handle(LookupLocalObject(private_name)); | 9840 const Object& obj = Object::Handle(LookupLocalObject(private_name)); |
| 9827 if (obj.IsClass()) { | 9841 if (obj.IsClass()) { |
| 9828 return Class::Cast(obj).raw(); | 9842 return Class::Cast(obj).raw(); |
| 9829 } | 9843 } |
| 9830 } | 9844 } |
| 9831 return Class::null(); | 9845 return Class::null(); |
| 9832 } | 9846 } |
| 9833 | 9847 |
| 9834 | 9848 |
| 9835 RawLibraryPrefix* Library::LookupLocalLibraryPrefix(const String& name) const { | 9849 RawLibraryPrefix* Library::LookupLocalLibraryPrefix(const String& name) const { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9867 RawNamespace* Library::ImportAt(intptr_t index) const { | 9881 RawNamespace* Library::ImportAt(intptr_t index) const { |
| 9868 if ((index < 0) || index >= num_imports()) { | 9882 if ((index < 0) || index >= num_imports()) { |
| 9869 return Namespace::null(); | 9883 return Namespace::null(); |
| 9870 } | 9884 } |
| 9871 const Array& import_list = Array::Handle(imports()); | 9885 const Array& import_list = Array::Handle(imports()); |
| 9872 return Namespace::RawCast(import_list.At(index)); | 9886 return Namespace::RawCast(import_list.At(index)); |
| 9873 } | 9887 } |
| 9874 | 9888 |
| 9875 | 9889 |
| 9876 bool Library::ImportsCorelib() const { | 9890 bool Library::ImportsCorelib() const { |
| 9877 Isolate* isolate = Isolate::Current(); | 9891 Zone* zone = Thread::Current()->zone(); |
| 9878 Library& imported = Library::Handle(isolate); | 9892 Library& imported = Library::Handle(zone); |
| 9879 intptr_t count = num_imports(); | 9893 intptr_t count = num_imports(); |
| 9880 for (int i = 0; i < count; i++) { | 9894 for (int i = 0; i < count; i++) { |
| 9881 imported = ImportLibraryAt(i); | 9895 imported = ImportLibraryAt(i); |
| 9882 if (imported.IsCoreLibrary()) { | 9896 if (imported.IsCoreLibrary()) { |
| 9883 return true; | 9897 return true; |
| 9884 } | 9898 } |
| 9885 } | 9899 } |
| 9886 LibraryPrefix& prefix = LibraryPrefix::Handle(isolate); | 9900 LibraryPrefix& prefix = LibraryPrefix::Handle(zone); |
| 9887 LibraryPrefixIterator it(*this); | 9901 LibraryPrefixIterator it(*this); |
| 9888 while (it.HasNext()) { | 9902 while (it.HasNext()) { |
| 9889 prefix = it.GetNext(); | 9903 prefix = it.GetNext(); |
| 9890 count = prefix.num_imports(); | 9904 count = prefix.num_imports(); |
| 9891 for (int i = 0; i < count; i++) { | 9905 for (int i = 0; i < count; i++) { |
| 9892 imported = prefix.GetLibrary(i); | 9906 imported = prefix.GetLibrary(i); |
| 9893 if (imported.IsCoreLibrary()) { | 9907 if (imported.IsCoreLibrary()) { |
| 9894 return true; | 9908 return true; |
| 9895 } | 9909 } |
| 9896 } | 9910 } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10074 fld_cnt); | 10088 fld_cnt); |
| 10075 cls_name = Symbols::New(name_buffer); | 10089 cls_name = Symbols::New(name_buffer); |
| 10076 Class::NewNativeWrapper(native_flds_lib, cls_name, fld_cnt); | 10090 Class::NewNativeWrapper(native_flds_lib, cls_name, fld_cnt); |
| 10077 } | 10091 } |
| 10078 native_flds_lib.SetLoaded(); | 10092 native_flds_lib.SetLoaded(); |
| 10079 } | 10093 } |
| 10080 | 10094 |
| 10081 | 10095 |
| 10082 // Returns library with given url in current isolate, or NULL. | 10096 // Returns library with given url in current isolate, or NULL. |
| 10083 RawLibrary* Library::LookupLibrary(const String &url) { | 10097 RawLibrary* Library::LookupLibrary(const String &url) { |
| 10084 Isolate* isolate = Isolate::Current(); | 10098 Thread* thread = Thread::Current(); |
| 10085 Library& lib = Library::Handle(isolate, Library::null()); | 10099 Zone* zone = thread->zone(); |
| 10086 String& lib_url = String::Handle(isolate, String::null()); | 10100 Isolate* isolate = thread->isolate(); |
| 10101 Library& lib = Library::Handle(zone, Library::null()); |
| 10102 String& lib_url = String::Handle(zone, String::null()); |
| 10087 GrowableObjectArray& libs = GrowableObjectArray::Handle( | 10103 GrowableObjectArray& libs = GrowableObjectArray::Handle( |
| 10088 isolate, isolate->object_store()->libraries()); | 10104 zone, isolate->object_store()->libraries()); |
| 10089 for (int i = 0; i < libs.Length(); i++) { | 10105 for (int i = 0; i < libs.Length(); i++) { |
| 10090 lib ^= libs.At(i); | 10106 lib ^= libs.At(i); |
| 10091 lib_url ^= lib.url(); | 10107 lib_url ^= lib.url(); |
| 10092 if (lib_url.Equals(url)) { | 10108 if (lib_url.Equals(url)) { |
| 10093 return lib.raw(); | 10109 return lib.raw(); |
| 10094 } | 10110 } |
| 10095 } | 10111 } |
| 10096 return Library::null(); | 10112 return Library::null(); |
| 10097 } | 10113 } |
| 10098 | 10114 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10407 import ^= imports.At(index); | 10423 import ^= imports.At(index); |
| 10408 return import.library(); | 10424 return import.library(); |
| 10409 } | 10425 } |
| 10410 return Library::null(); | 10426 return Library::null(); |
| 10411 } | 10427 } |
| 10412 | 10428 |
| 10413 | 10429 |
| 10414 RawInstance* LibraryPrefix::LoadError() const { | 10430 RawInstance* LibraryPrefix::LoadError() const { |
| 10415 Thread* thread = Thread::Current(); | 10431 Thread* thread = Thread::Current(); |
| 10416 Isolate* isolate = thread->isolate(); | 10432 Isolate* isolate = thread->isolate(); |
| 10433 Zone* zone = thread->zone(); |
| 10417 ObjectStore* object_store = isolate->object_store(); | 10434 ObjectStore* object_store = isolate->object_store(); |
| 10418 GrowableObjectArray& libs = | 10435 GrowableObjectArray& libs = |
| 10419 GrowableObjectArray::Handle(isolate, object_store->libraries()); | 10436 GrowableObjectArray::Handle(zone, object_store->libraries()); |
| 10420 ASSERT(!libs.IsNull()); | 10437 ASSERT(!libs.IsNull()); |
| 10421 LibraryLoadErrorSet set(HashTables::New<LibraryLoadErrorSet>(libs.Length())); | 10438 LibraryLoadErrorSet set(HashTables::New<LibraryLoadErrorSet>(libs.Length())); |
| 10422 object_store->set_library_load_error_table(set.Release()); | 10439 object_store->set_library_load_error_table(set.Release()); |
| 10423 Library& lib = Library::Handle(isolate); | 10440 Library& lib = Library::Handle(zone); |
| 10424 Instance& error = Instance::Handle(isolate); | 10441 Instance& error = Instance::Handle(zone); |
| 10425 for (int32_t i = 0; i < num_imports(); i++) { | 10442 for (int32_t i = 0; i < num_imports(); i++) { |
| 10426 lib = GetLibrary(i); | 10443 lib = GetLibrary(i); |
| 10427 ASSERT(!lib.IsNull()); | 10444 ASSERT(!lib.IsNull()); |
| 10428 HANDLESCOPE(thread); | 10445 HANDLESCOPE(thread); |
| 10429 error = lib.TransitiveLoadError(); | 10446 error = lib.TransitiveLoadError(); |
| 10430 if (!error.IsNull()) { | 10447 if (!error.IsNull()) { |
| 10431 break; | 10448 break; |
| 10432 } | 10449 } |
| 10433 } | 10450 } |
| 10434 object_store->set_library_load_error_table(Object::empty_array()); | 10451 object_store->set_library_load_error_table(Object::empty_array()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10543 // loading. Once all outstanding load requests have completed, the embedder | 10560 // loading. Once all outstanding load requests have completed, the embedder |
| 10544 // will call the core library to: | 10561 // will call the core library to: |
| 10545 // - invalidate dependent code of this prefix; | 10562 // - invalidate dependent code of this prefix; |
| 10546 // - mark this prefixes as loaded; | 10563 // - mark this prefixes as loaded; |
| 10547 // - complete the future associated with this prefix. | 10564 // - complete the future associated with this prefix. |
| 10548 const Library& deferred_lib = Library::Handle(GetLibrary(0)); | 10565 const Library& deferred_lib = Library::Handle(GetLibrary(0)); |
| 10549 if (deferred_lib.Loaded()) { | 10566 if (deferred_lib.Loaded()) { |
| 10550 this->set_is_loaded(); | 10567 this->set_is_loaded(); |
| 10551 return true; | 10568 return true; |
| 10552 } else if (deferred_lib.LoadNotStarted()) { | 10569 } else if (deferred_lib.LoadNotStarted()) { |
| 10553 Isolate* isolate = Isolate::Current(); | 10570 Thread* thread = Thread::Current(); |
| 10571 Isolate* isolate = thread->isolate(); |
| 10554 Api::Scope api_scope(isolate); | 10572 Api::Scope api_scope(isolate); |
| 10573 Zone* zone = thread->zone(); |
| 10555 deferred_lib.SetLoadRequested(); | 10574 deferred_lib.SetLoadRequested(); |
| 10556 const GrowableObjectArray& pending_deferred_loads = | 10575 const GrowableObjectArray& pending_deferred_loads = |
| 10557 GrowableObjectArray::Handle( | 10576 GrowableObjectArray::Handle( |
| 10558 isolate->object_store()->pending_deferred_loads()); | 10577 isolate->object_store()->pending_deferred_loads()); |
| 10559 pending_deferred_loads.Add(deferred_lib); | 10578 pending_deferred_loads.Add(deferred_lib); |
| 10560 const String& lib_url = String::Handle(isolate, deferred_lib.url()); | 10579 const String& lib_url = String::Handle(zone, deferred_lib.url()); |
| 10561 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); | 10580 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); |
| 10562 handler(Dart_kImportTag, | 10581 handler(Dart_kImportTag, |
| 10563 Api::NewHandle(isolate, importer()), | 10582 Api::NewHandle(isolate, importer()), |
| 10564 Api::NewHandle(isolate, lib_url.raw())); | 10583 Api::NewHandle(isolate, lib_url.raw())); |
| 10565 } else { | 10584 } else { |
| 10566 // Another load request is in flight. | 10585 // Another load request is in flight. |
| 10567 ASSERT(deferred_lib.LoadRequested()); | 10586 ASSERT(deferred_lib.LoadRequested()); |
| 10568 } | 10587 } |
| 10569 return false; // Load request not yet completed. | 10588 return false; // Load request not yet completed. |
| 10570 } | 10589 } |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10783 return true; | 10802 return true; |
| 10784 } | 10803 } |
| 10785 // The name is not filtered out. | 10804 // The name is not filtered out. |
| 10786 return false; | 10805 return false; |
| 10787 } | 10806 } |
| 10788 | 10807 |
| 10789 | 10808 |
| 10790 // Look up object with given name in library and filter out hidden | 10809 // Look up object with given name in library and filter out hidden |
| 10791 // names. Also look up getters and setters. | 10810 // names. Also look up getters and setters. |
| 10792 RawObject* Namespace::Lookup(const String& name) const { | 10811 RawObject* Namespace::Lookup(const String& name) const { |
| 10793 Isolate* isolate = Isolate::Current(); | 10812 Zone* zone = Thread::Current()->zone(); |
| 10794 const Library& lib = Library::Handle(isolate, library()); | 10813 const Library& lib = Library::Handle(zone, library()); |
| 10795 intptr_t ignore = 0; | 10814 intptr_t ignore = 0; |
| 10796 | 10815 |
| 10797 // Lookup the name in the library's symbols. | 10816 // Lookup the name in the library's symbols. |
| 10798 Object& obj = Object::Handle(isolate, lib.LookupEntry(name, &ignore)); | 10817 Object& obj = Object::Handle(zone, lib.LookupEntry(name, &ignore)); |
| 10799 if (!Field::IsGetterName(name) && | 10818 if (!Field::IsGetterName(name) && |
| 10800 !Field::IsSetterName(name) && | 10819 !Field::IsSetterName(name) && |
| 10801 (obj.IsNull() || obj.IsLibraryPrefix())) { | 10820 (obj.IsNull() || obj.IsLibraryPrefix())) { |
| 10802 const String& getter_name = String::Handle(Field::LookupGetterSymbol(name)); | 10821 const String& getter_name = String::Handle(Field::LookupGetterSymbol(name)); |
| 10803 if (!getter_name.IsNull()) { | 10822 if (!getter_name.IsNull()) { |
| 10804 obj = lib.LookupEntry(getter_name, &ignore); | 10823 obj = lib.LookupEntry(getter_name, &ignore); |
| 10805 } | 10824 } |
| 10806 if (obj.IsNull()) { | 10825 if (obj.IsNull()) { |
| 10807 const String& setter_name = | 10826 const String& setter_name = |
| 10808 String::Handle(Field::LookupSetterSymbol(name)); | 10827 String::Handle(Field::LookupSetterSymbol(name)); |
| (...skipping 3754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14563 bool Instance::IsInstanceOf(const AbstractType& other, | 14582 bool Instance::IsInstanceOf(const AbstractType& other, |
| 14564 const TypeArguments& other_instantiator, | 14583 const TypeArguments& other_instantiator, |
| 14565 Error* bound_error) const { | 14584 Error* bound_error) const { |
| 14566 ASSERT(other.IsFinalized()); | 14585 ASSERT(other.IsFinalized()); |
| 14567 ASSERT(!other.IsDynamicType()); | 14586 ASSERT(!other.IsDynamicType()); |
| 14568 ASSERT(!other.IsMalformed()); | 14587 ASSERT(!other.IsMalformed()); |
| 14569 ASSERT(!other.IsMalbounded()); | 14588 ASSERT(!other.IsMalbounded()); |
| 14570 if (other.IsVoidType()) { | 14589 if (other.IsVoidType()) { |
| 14571 return false; | 14590 return false; |
| 14572 } | 14591 } |
| 14573 Isolate* isolate = Isolate::Current(); | 14592 Zone* zone = Thread::Current()->zone(); |
| 14574 const Class& cls = Class::Handle(isolate, clazz()); | 14593 const Class& cls = Class::Handle(zone, clazz()); |
| 14575 TypeArguments& type_arguments = TypeArguments::Handle(isolate); | 14594 TypeArguments& type_arguments = TypeArguments::Handle(zone); |
| 14576 if (cls.NumTypeArguments() > 0) { | 14595 if (cls.NumTypeArguments() > 0) { |
| 14577 type_arguments = GetTypeArguments(); | 14596 type_arguments = GetTypeArguments(); |
| 14578 ASSERT(type_arguments.IsNull() || type_arguments.IsCanonical()); | 14597 ASSERT(type_arguments.IsNull() || type_arguments.IsCanonical()); |
| 14579 // The number of type arguments in the instance must be greater or equal to | 14598 // The number of type arguments in the instance must be greater or equal to |
| 14580 // the number of type arguments expected by the instance class. | 14599 // the number of type arguments expected by the instance class. |
| 14581 // A discrepancy is allowed for closures, which borrow the type argument | 14600 // A discrepancy is allowed for closures, which borrow the type argument |
| 14582 // vector of their instantiator, which may be of a subclass of the class | 14601 // vector of their instantiator, which may be of a subclass of the class |
| 14583 // defining the closure. Truncating the vector to the correct length on | 14602 // defining the closure. Truncating the vector to the correct length on |
| 14584 // instantiation is unnecessary. The vector may therefore be longer. | 14603 // instantiation is unnecessary. The vector may therefore be longer. |
| 14585 // Also, an optimization reuses the type argument vector of the instantiator | 14604 // Also, an optimization reuses the type argument vector of the instantiator |
| 14586 // of generic instances when its layout is compatible. | 14605 // of generic instances when its layout is compatible. |
| 14587 ASSERT(type_arguments.IsNull() || | 14606 ASSERT(type_arguments.IsNull() || |
| 14588 (type_arguments.Length() >= cls.NumTypeArguments())); | 14607 (type_arguments.Length() >= cls.NumTypeArguments())); |
| 14589 } | 14608 } |
| 14590 Class& other_class = Class::Handle(isolate); | 14609 Class& other_class = Class::Handle(zone); |
| 14591 TypeArguments& other_type_arguments = TypeArguments::Handle(isolate); | 14610 TypeArguments& other_type_arguments = TypeArguments::Handle(zone); |
| 14592 // Note that we may encounter a bound error in checked mode. | 14611 // Note that we may encounter a bound error in checked mode. |
| 14593 if (!other.IsInstantiated()) { | 14612 if (!other.IsInstantiated()) { |
| 14594 const AbstractType& instantiated_other = AbstractType::Handle( | 14613 const AbstractType& instantiated_other = AbstractType::Handle( |
| 14595 isolate, other.InstantiateFrom(other_instantiator, bound_error)); | 14614 zone, other.InstantiateFrom(other_instantiator, bound_error)); |
| 14596 if ((bound_error != NULL) && !bound_error->IsNull()) { | 14615 if ((bound_error != NULL) && !bound_error->IsNull()) { |
| 14597 ASSERT(Isolate::Current()->flags().type_checks()); | 14616 ASSERT(Isolate::Current()->flags().type_checks()); |
| 14598 return false; | 14617 return false; |
| 14599 } | 14618 } |
| 14600 other_class = instantiated_other.type_class(); | 14619 other_class = instantiated_other.type_class(); |
| 14601 other_type_arguments = instantiated_other.arguments(); | 14620 other_type_arguments = instantiated_other.arguments(); |
| 14602 } else { | 14621 } else { |
| 14603 other_class = other.type_class(); | 14622 other_class = other.type_class(); |
| 14604 other_type_arguments = other.arguments(); | 14623 other_type_arguments = other.arguments(); |
| 14605 } | 14624 } |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15772 return clone.raw(); | 15791 return clone.raw(); |
| 15773 } | 15792 } |
| 15774 | 15793 |
| 15775 | 15794 |
| 15776 RawAbstractType* Type::Canonicalize(TrailPtr trail) const { | 15795 RawAbstractType* Type::Canonicalize(TrailPtr trail) const { |
| 15777 ASSERT(IsFinalized()); | 15796 ASSERT(IsFinalized()); |
| 15778 if (IsCanonical() || IsMalformed()) { | 15797 if (IsCanonical() || IsMalformed()) { |
| 15779 ASSERT(IsMalformed() || TypeArguments::Handle(arguments()).IsOld()); | 15798 ASSERT(IsMalformed() || TypeArguments::Handle(arguments()).IsOld()); |
| 15780 return this->raw(); | 15799 return this->raw(); |
| 15781 } | 15800 } |
| 15782 Isolate* isolate = Isolate::Current(); | 15801 Thread* thread = Thread::Current(); |
| 15783 Type& type = Type::Handle(isolate); | 15802 Zone* zone = thread->zone(); |
| 15784 const Class& cls = Class::Handle(isolate, type_class()); | 15803 Isolate* isolate = thread->isolate(); |
| 15804 Type& type = Type::Handle(zone); |
| 15805 const Class& cls = Class::Handle(zone, type_class()); |
| 15785 if (cls.raw() == Object::dynamic_class() && (isolate != Dart::vm_isolate())) { | 15806 if (cls.raw() == Object::dynamic_class() && (isolate != Dart::vm_isolate())) { |
| 15786 return Object::dynamic_type(); | 15807 return Object::dynamic_type(); |
| 15787 } | 15808 } |
| 15788 // Fast canonical lookup/registry for simple types. | 15809 // Fast canonical lookup/registry for simple types. |
| 15789 if (cls.NumTypeArguments() == 0) { | 15810 if (cls.NumTypeArguments() == 0) { |
| 15790 type = cls.CanonicalType(); | 15811 type = cls.CanonicalType(); |
| 15791 if (type.IsNull()) { | 15812 if (type.IsNull()) { |
| 15792 ASSERT(!cls.raw()->IsVMHeapObject() || (isolate == Dart::vm_isolate())); | 15813 ASSERT(!cls.raw()->IsVMHeapObject() || (isolate == Dart::vm_isolate())); |
| 15793 cls.set_canonical_types(*this); | 15814 cls.set_canonical_types(*this); |
| 15794 SetCanonical(); | 15815 SetCanonical(); |
| 15795 return this->raw(); | 15816 return this->raw(); |
| 15796 } | 15817 } |
| 15797 ASSERT(this->Equals(type)); | 15818 ASSERT(this->Equals(type)); |
| 15798 ASSERT(type.IsCanonical()); | 15819 ASSERT(type.IsCanonical()); |
| 15799 return type.raw(); | 15820 return type.raw(); |
| 15800 } | 15821 } |
| 15801 | 15822 |
| 15802 Array& canonical_types = Array::Handle(isolate); | 15823 Array& canonical_types = Array::Handle(zone); |
| 15803 canonical_types ^= cls.canonical_types(); | 15824 canonical_types ^= cls.canonical_types(); |
| 15804 if (canonical_types.IsNull()) { | 15825 if (canonical_types.IsNull()) { |
| 15805 canonical_types = empty_array().raw(); | 15826 canonical_types = empty_array().raw(); |
| 15806 } | 15827 } |
| 15807 intptr_t length = canonical_types.Length(); | 15828 intptr_t length = canonical_types.Length(); |
| 15808 // Linear search to see whether this type is already present in the | 15829 // Linear search to see whether this type is already present in the |
| 15809 // list of canonicalized types. | 15830 // list of canonicalized types. |
| 15810 // TODO(asiva): Try to re-factor this lookup code to make sharing | 15831 // TODO(asiva): Try to re-factor this lookup code to make sharing |
| 15811 // easy between the 4 versions of this loop. | 15832 // easy between the 4 versions of this loop. |
| 15812 intptr_t index = 1; // Slot 0 is reserved for CanonicalType(). | 15833 intptr_t index = 1; // Slot 0 is reserved for CanonicalType(). |
| 15813 while (index < length) { | 15834 while (index < length) { |
| 15814 type ^= canonical_types.At(index); | 15835 type ^= canonical_types.At(index); |
| 15815 if (type.IsNull()) { | 15836 if (type.IsNull()) { |
| 15816 break; | 15837 break; |
| 15817 } | 15838 } |
| 15818 ASSERT(type.IsFinalized()); | 15839 ASSERT(type.IsFinalized()); |
| 15819 if (this->Equals(type)) { | 15840 if (this->Equals(type)) { |
| 15820 ASSERT(type.IsCanonical()); | 15841 ASSERT(type.IsCanonical()); |
| 15821 return type.raw(); | 15842 return type.raw(); |
| 15822 } | 15843 } |
| 15823 index++; | 15844 index++; |
| 15824 } | 15845 } |
| 15825 // The type was not found in the table. It is not canonical yet. | 15846 // The type was not found in the table. It is not canonical yet. |
| 15826 | 15847 |
| 15827 // Canonicalize the type arguments. | 15848 // Canonicalize the type arguments. |
| 15828 TypeArguments& type_args = TypeArguments::Handle(isolate, arguments()); | 15849 TypeArguments& type_args = TypeArguments::Handle(zone, arguments()); |
| 15829 // In case the type is first canonicalized at runtime, its type argument | 15850 // In case the type is first canonicalized at runtime, its type argument |
| 15830 // vector may be longer than necessary. This is not an issue. | 15851 // vector may be longer than necessary. This is not an issue. |
| 15831 ASSERT(type_args.IsNull() || (type_args.Length() >= cls.NumTypeArguments())); | 15852 ASSERT(type_args.IsNull() || (type_args.Length() >= cls.NumTypeArguments())); |
| 15832 type_args = type_args.Canonicalize(trail); | 15853 type_args = type_args.Canonicalize(trail); |
| 15833 set_arguments(type_args); | 15854 set_arguments(type_args); |
| 15834 | 15855 |
| 15835 // Canonicalizing the type arguments may have changed the index, may have | 15856 // Canonicalizing the type arguments may have changed the index, may have |
| 15836 // grown the table, or may even have canonicalized this type. | 15857 // grown the table, or may even have canonicalized this type. |
| 15837 canonical_types ^= cls.canonical_types(); | 15858 canonical_types ^= cls.canonical_types(); |
| 15838 if (canonical_types.IsNull()) { | 15859 if (canonical_types.IsNull()) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 15852 index++; | 15873 index++; |
| 15853 } | 15874 } |
| 15854 | 15875 |
| 15855 // The type needs to be added to the list. Grow the list if it is full. | 15876 // The type needs to be added to the list. Grow the list if it is full. |
| 15856 if (index >= length) { | 15877 if (index >= length) { |
| 15857 ASSERT((index == length) || ((index == 1) && (length == 0))); | 15878 ASSERT((index == length) || ((index == 1) && (length == 0))); |
| 15858 const intptr_t new_length = (length > 64) ? | 15879 const intptr_t new_length = (length > 64) ? |
| 15859 (length + 64) : | 15880 (length + 64) : |
| 15860 ((length == 0) ? 2 : (length * 2)); | 15881 ((length == 0) ? 2 : (length * 2)); |
| 15861 const Array& new_canonical_types = Array::Handle( | 15882 const Array& new_canonical_types = Array::Handle( |
| 15862 isolate, Array::Grow(canonical_types, new_length, Heap::kOld)); | 15883 zone, Array::Grow(canonical_types, new_length, Heap::kOld)); |
| 15863 cls.set_canonical_types(new_canonical_types); | 15884 cls.set_canonical_types(new_canonical_types); |
| 15864 canonical_types = new_canonical_types.raw(); | 15885 canonical_types = new_canonical_types.raw(); |
| 15865 } | 15886 } |
| 15866 canonical_types.SetAt(index, *this); | 15887 canonical_types.SetAt(index, *this); |
| 15867 if ((index == 1) && cls.IsCanonicalSignatureClass()) { | 15888 if ((index == 1) && cls.IsCanonicalSignatureClass()) { |
| 15868 canonical_types.SetAt(0, *this); // Also set canonical signature type at 0. | 15889 canonical_types.SetAt(0, *this); // Also set canonical signature type at 0. |
| 15869 #ifdef DEBUG | 15890 #ifdef DEBUG |
| 15870 // Verify that the first canonical type is the signature type by checking | 15891 // Verify that the first canonical type is the signature type by checking |
| 15871 // that the type argument vector of the canonical type ends with the | 15892 // that the type argument vector of the canonical type ends with the |
| 15872 // uninstantiated type parameters of the signature class. Note that these | 15893 // uninstantiated type parameters of the signature class. Note that these |
| 15873 // type parameters may be bounded if the super class of the owner class | 15894 // type parameters may be bounded if the super class of the owner class |
| 15874 // declares bounds. | 15895 // declares bounds. |
| 15875 // The signature type is finalized during class finalization, before the | 15896 // The signature type is finalized during class finalization, before the |
| 15876 // optimizer may canonicalize instantiated function types of the same | 15897 // optimizer may canonicalize instantiated function types of the same |
| 15877 // signature class. | 15898 // signature class. |
| 15878 // Although the signature class extends class Instance, the type arguments | 15899 // Although the signature class extends class Instance, the type arguments |
| 15879 // of the super class of the owner class of its signature function will be | 15900 // of the super class of the owner class of its signature function will be |
| 15880 // prepended to the type argument vector during class finalization. | 15901 // prepended to the type argument vector during class finalization. |
| 15881 const TypeArguments& type_params = | 15902 const TypeArguments& type_params = |
| 15882 TypeArguments::Handle(isolate, cls.type_parameters()); | 15903 TypeArguments::Handle(zone, cls.type_parameters()); |
| 15883 const intptr_t num_type_params = cls.NumTypeParameters(); | 15904 const intptr_t num_type_params = cls.NumTypeParameters(); |
| 15884 const intptr_t num_type_args = cls.NumTypeArguments(); | 15905 const intptr_t num_type_args = cls.NumTypeArguments(); |
| 15885 AbstractType& type_arg = AbstractType::Handle(isolate); | 15906 AbstractType& type_arg = AbstractType::Handle(zone); |
| 15886 TypeParameter& type_param = TypeParameter::Handle(isolate); | 15907 TypeParameter& type_param = TypeParameter::Handle(zone); |
| 15887 for (intptr_t i = 0; i < num_type_params; i++) { | 15908 for (intptr_t i = 0; i < num_type_params; i++) { |
| 15888 type_arg = type_args.TypeAt(num_type_args - num_type_params + i); | 15909 type_arg = type_args.TypeAt(num_type_args - num_type_params + i); |
| 15889 while (type_arg.IsBoundedType()) { | 15910 while (type_arg.IsBoundedType()) { |
| 15890 type_arg = BoundedType::Cast(type_arg).type(); | 15911 type_arg = BoundedType::Cast(type_arg).type(); |
| 15891 } | 15912 } |
| 15892 type_param ^= type_params.TypeAt(i); | 15913 type_param ^= type_params.TypeAt(i); |
| 15893 ASSERT(type_arg.Equals(type_param)); | 15914 ASSERT(type_arg.Equals(type_param)); |
| 15894 } | 15915 } |
| 15895 #endif | 15916 #endif |
| 15896 } | 15917 } |
| (...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17520 ASSERT(!digits_.IsNull()); | 17541 ASSERT(!digits_.IsNull()); |
| 17521 set_digits(digits_); | 17542 set_digits(digits_); |
| 17522 } else { | 17543 } else { |
| 17523 ASSERT(digits() == TypedData::EmptyUint32Array(Isolate::Current())); | 17544 ASSERT(digits() == TypedData::EmptyUint32Array(Isolate::Current())); |
| 17524 } | 17545 } |
| 17525 return true; | 17546 return true; |
| 17526 } | 17547 } |
| 17527 | 17548 |
| 17528 | 17549 |
| 17529 RawBigint* Bigint::New(Heap::Space space) { | 17550 RawBigint* Bigint::New(Heap::Space space) { |
| 17530 Isolate* isolate = Isolate::Current(); | 17551 Thread* thread = Thread::Current(); |
| 17552 Zone* zone = thread->zone(); |
| 17553 Isolate* isolate = thread->isolate(); |
| 17531 ASSERT(isolate->object_store()->bigint_class() != Class::null()); | 17554 ASSERT(isolate->object_store()->bigint_class() != Class::null()); |
| 17532 Bigint& result = Bigint::Handle(isolate); | 17555 Bigint& result = Bigint::Handle(zone); |
| 17533 { | 17556 { |
| 17534 RawObject* raw = Object::Allocate(Bigint::kClassId, | 17557 RawObject* raw = Object::Allocate(Bigint::kClassId, |
| 17535 Bigint::InstanceSize(), | 17558 Bigint::InstanceSize(), |
| 17536 space); | 17559 space); |
| 17537 NoSafepointScope no_safepoint; | 17560 NoSafepointScope no_safepoint; |
| 17538 result ^= raw; | 17561 result ^= raw; |
| 17539 } | 17562 } |
| 17540 result.SetNeg(false); | 17563 result.SetNeg(false); |
| 17541 result.SetUsed(0); | 17564 result.SetUsed(0); |
| 17542 result.set_digits( | 17565 result.set_digits( |
| 17543 TypedData::Handle(isolate, TypedData::EmptyUint32Array(isolate))); | 17566 TypedData::Handle(zone, TypedData::EmptyUint32Array(isolate))); |
| 17544 return result.raw(); | 17567 return result.raw(); |
| 17545 } | 17568 } |
| 17546 | 17569 |
| 17547 | 17570 |
| 17548 RawBigint* Bigint::New(bool neg, intptr_t used, const TypedData& digits, | 17571 RawBigint* Bigint::New(bool neg, intptr_t used, const TypedData& digits, |
| 17549 Heap::Space space) { | 17572 Heap::Space space) { |
| 17550 ASSERT((used == 0) || | 17573 ASSERT((used == 0) || |
| 17551 (!digits.IsNull() && (digits.Length() >= (used + (used & 1))))); | 17574 (!digits.IsNull() && (digits.Length() >= (used + (used & 1))))); |
| 17552 Isolate* isolate = Isolate::Current(); | 17575 Thread* thread = Thread::Current(); |
| 17576 Zone* zone = thread->zone(); |
| 17577 Isolate* isolate = thread->isolate(); |
| 17553 ASSERT(isolate->object_store()->bigint_class() != Class::null()); | 17578 ASSERT(isolate->object_store()->bigint_class() != Class::null()); |
| 17554 Bigint& result = Bigint::Handle(isolate); | 17579 Bigint& result = Bigint::Handle(zone); |
| 17555 { | 17580 { |
| 17556 RawObject* raw = Object::Allocate(Bigint::kClassId, | 17581 RawObject* raw = Object::Allocate(Bigint::kClassId, |
| 17557 Bigint::InstanceSize(), | 17582 Bigint::InstanceSize(), |
| 17558 space); | 17583 space); |
| 17559 NoSafepointScope no_safepoint; | 17584 NoSafepointScope no_safepoint; |
| 17560 result ^= raw; | 17585 result ^= raw; |
| 17561 } | 17586 } |
| 17562 // Clamp the digits array. | 17587 // Clamp the digits array. |
| 17563 while ((used > 0) && (digits.GetUint32((used - 1) << 2) == 0)) { | 17588 while ((used > 0) && (digits.GetUint32((used - 1) << 2) == 0)) { |
| 17564 --used; | 17589 --used; |
| 17565 } | 17590 } |
| 17566 if (used > 0) { | 17591 if (used > 0) { |
| 17567 if ((used & 1) != 0) { | 17592 if ((used & 1) != 0) { |
| 17568 // Set leading zero for 64-bit processing of digit pairs. | 17593 // Set leading zero for 64-bit processing of digit pairs. |
| 17569 digits.SetUint32(used << 2, 0); | 17594 digits.SetUint32(used << 2, 0); |
| 17570 } | 17595 } |
| 17571 result.set_digits(digits); | 17596 result.set_digits(digits); |
| 17572 } else { | 17597 } else { |
| 17573 neg = false; | 17598 neg = false; |
| 17574 result.set_digits( | 17599 result.set_digits( |
| 17575 TypedData::Handle(isolate, TypedData::EmptyUint32Array(isolate))); | 17600 TypedData::Handle(zone, TypedData::EmptyUint32Array(isolate))); |
| 17576 } | 17601 } |
| 17577 result.SetNeg(neg); | 17602 result.SetNeg(neg); |
| 17578 result.SetUsed(used); | 17603 result.SetUsed(used); |
| 17579 return result.raw(); | 17604 return result.raw(); |
| 17580 } | 17605 } |
| 17581 | 17606 |
| 17582 | 17607 |
| 17583 RawBigint* Bigint::NewFromInt64(int64_t value, Heap::Space space) { | 17608 RawBigint* Bigint::NewFromInt64(int64_t value, Heap::Space space) { |
| 17584 const TypedData& digits = TypedData::Handle(NewDigits(2, space)); | 17609 const TypedData& digits = TypedData::Handle(NewDigits(2, space)); |
| 17585 bool neg; | 17610 bool neg; |
| (...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20050 element = At(index); | 20075 element = At(index); |
| 20051 jsarr.AddValue(element); | 20076 jsarr.AddValue(element); |
| 20052 } | 20077 } |
| 20053 } | 20078 } |
| 20054 } | 20079 } |
| 20055 | 20080 |
| 20056 | 20081 |
| 20057 RawArray* Array::Grow(const Array& source, | 20082 RawArray* Array::Grow(const Array& source, |
| 20058 intptr_t new_length, | 20083 intptr_t new_length, |
| 20059 Heap::Space space) { | 20084 Heap::Space space) { |
| 20060 Isolate* isolate = Isolate::Current(); | 20085 Zone* zone = Thread::Current()->zone(); |
| 20061 const Array& result = Array::Handle(isolate, Array::New(new_length, space)); | 20086 const Array& result = Array::Handle(zone, Array::New(new_length, space)); |
| 20062 intptr_t len = 0; | 20087 intptr_t len = 0; |
| 20063 if (!source.IsNull()) { | 20088 if (!source.IsNull()) { |
| 20064 len = source.Length(); | 20089 len = source.Length(); |
| 20065 result.SetTypeArguments( | 20090 result.SetTypeArguments( |
| 20066 TypeArguments::Handle(isolate, source.GetTypeArguments())); | 20091 TypeArguments::Handle(zone, source.GetTypeArguments())); |
| 20067 } | 20092 } |
| 20068 ASSERT(new_length >= len); // Cannot copy 'source' into new array. | 20093 ASSERT(new_length >= len); // Cannot copy 'source' into new array. |
| 20069 ASSERT(new_length != len); // Unnecessary copying of array. | 20094 ASSERT(new_length != len); // Unnecessary copying of array. |
| 20070 PassiveObject& obj = PassiveObject::Handle(isolate); | 20095 PassiveObject& obj = PassiveObject::Handle(zone); |
| 20071 for (int i = 0; i < len; i++) { | 20096 for (int i = 0; i < len; i++) { |
| 20072 obj = source.At(i); | 20097 obj = source.At(i); |
| 20073 result.SetAt(i, obj); | 20098 result.SetAt(i, obj); |
| 20074 } | 20099 } |
| 20075 return result.raw(); | 20100 return result.raw(); |
| 20076 } | 20101 } |
| 20077 | 20102 |
| 20078 | 20103 |
| 20079 RawArray* Array::MakeArray(const GrowableObjectArray& growable_array) { | 20104 RawArray* Array::MakeArray(const GrowableObjectArray& growable_array) { |
| 20080 ASSERT(!growable_array.IsNull()); | 20105 ASSERT(!growable_array.IsNull()); |
| 20081 intptr_t used_len = growable_array.Length(); | 20106 intptr_t used_len = growable_array.Length(); |
| 20082 // Get the type arguments and prepare to copy them. | 20107 // Get the type arguments and prepare to copy them. |
| 20083 const TypeArguments& type_arguments = | 20108 const TypeArguments& type_arguments = |
| 20084 TypeArguments::Handle(growable_array.GetTypeArguments()); | 20109 TypeArguments::Handle(growable_array.GetTypeArguments()); |
| 20085 if ((used_len == 0) && (type_arguments.IsNull())) { | 20110 if ((used_len == 0) && (type_arguments.IsNull())) { |
| 20086 // This is a raw List (as in no type arguments), so we can return the | 20111 // This is a raw List (as in no type arguments), so we can return the |
| 20087 // simple empty array. | 20112 // simple empty array. |
| 20088 return Object::empty_array().raw(); | 20113 return Object::empty_array().raw(); |
| 20089 } | 20114 } |
| 20090 intptr_t capacity_len = growable_array.Capacity(); | 20115 intptr_t capacity_len = growable_array.Capacity(); |
| 20091 Isolate* isolate = Isolate::Current(); | 20116 Zone* zone = Thread::Current()->zone(); |
| 20092 const Array& array = Array::Handle(isolate, growable_array.data()); | 20117 const Array& array = Array::Handle(zone, growable_array.data()); |
| 20093 array.SetTypeArguments(type_arguments); | 20118 array.SetTypeArguments(type_arguments); |
| 20094 intptr_t capacity_size = Array::InstanceSize(capacity_len); | 20119 intptr_t capacity_size = Array::InstanceSize(capacity_len); |
| 20095 intptr_t used_size = Array::InstanceSize(used_len); | 20120 intptr_t used_size = Array::InstanceSize(used_len); |
| 20096 NoSafepointScope no_safepoint; | 20121 NoSafepointScope no_safepoint; |
| 20097 | 20122 |
| 20098 // If there is any left over space fill it with either an Array object or | 20123 // If there is any left over space fill it with either an Array object or |
| 20099 // just a plain object (depending on the amount of left over space) so | 20124 // just a plain object (depending on the amount of left over space) so |
| 20100 // that it can be traversed over successfully during garbage collection. | 20125 // that it can be traversed over successfully during garbage collection. |
| 20101 Object::MakeUnusedSpaceTraversable(array, capacity_size, used_size); | 20126 Object::MakeUnusedSpaceTraversable(array, capacity_size, used_size); |
| 20102 | 20127 |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20758 } | 20783 } |
| 20759 | 20784 |
| 20760 | 20785 |
| 20761 RawTypedData* TypedData::EmptyUint32Array(Isolate* isolate) { | 20786 RawTypedData* TypedData::EmptyUint32Array(Isolate* isolate) { |
| 20762 ASSERT(isolate != NULL); | 20787 ASSERT(isolate != NULL); |
| 20763 ASSERT(isolate->object_store() != NULL); | 20788 ASSERT(isolate->object_store() != NULL); |
| 20764 if (isolate->object_store()->empty_uint32_array() != TypedData::null()) { | 20789 if (isolate->object_store()->empty_uint32_array() != TypedData::null()) { |
| 20765 // Already created. | 20790 // Already created. |
| 20766 return isolate->object_store()->empty_uint32_array(); | 20791 return isolate->object_store()->empty_uint32_array(); |
| 20767 } | 20792 } |
| 20768 const TypedData& array = TypedData::Handle(isolate, | 20793 const TypedData& array = TypedData::Handle(isolate->current_zone(), |
| 20769 TypedData::New(kTypedDataUint32ArrayCid, 0, Heap::kOld)); | 20794 TypedData::New(kTypedDataUint32ArrayCid, 0, Heap::kOld)); |
| 20770 isolate->object_store()->set_empty_uint32_array(array); | 20795 isolate->object_store()->set_empty_uint32_array(array); |
| 20771 return array.raw(); | 20796 return array.raw(); |
| 20772 } | 20797 } |
| 20773 | 20798 |
| 20774 | 20799 |
| 20775 const char* TypedData::ToCString() const { | 20800 const char* TypedData::ToCString() const { |
| 20776 return "TypedData"; | 20801 return "TypedData"; |
| 20777 } | 20802 } |
| 20778 | 20803 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20870 | 20895 |
| 20871 void Capability::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20896 void Capability::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20872 Instance::PrintJSONImpl(stream, ref); | 20897 Instance::PrintJSONImpl(stream, ref); |
| 20873 } | 20898 } |
| 20874 | 20899 |
| 20875 | 20900 |
| 20876 RawReceivePort* ReceivePort::New(Dart_Port id, | 20901 RawReceivePort* ReceivePort::New(Dart_Port id, |
| 20877 bool is_control_port, | 20902 bool is_control_port, |
| 20878 Heap::Space space) { | 20903 Heap::Space space) { |
| 20879 ASSERT(id != ILLEGAL_PORT); | 20904 ASSERT(id != ILLEGAL_PORT); |
| 20880 Isolate* isolate = Isolate::Current(); | 20905 Thread* thread = Thread::Current(); |
| 20906 Zone* zone = thread->zone(); |
| 20881 const SendPort& send_port = | 20907 const SendPort& send_port = |
| 20882 SendPort::Handle(isolate, SendPort::New(id, isolate->origin_id())); | 20908 SendPort::Handle(zone, SendPort::New(id, thread->isolate()->origin_id())); |
| 20883 | 20909 |
| 20884 ReceivePort& result = ReceivePort::Handle(isolate); | 20910 ReceivePort& result = ReceivePort::Handle(zone); |
| 20885 { | 20911 { |
| 20886 RawObject* raw = Object::Allocate(ReceivePort::kClassId, | 20912 RawObject* raw = Object::Allocate(ReceivePort::kClassId, |
| 20887 ReceivePort::InstanceSize(), | 20913 ReceivePort::InstanceSize(), |
| 20888 space); | 20914 space); |
| 20889 NoSafepointScope no_safepoint; | 20915 NoSafepointScope no_safepoint; |
| 20890 result ^= raw; | 20916 result ^= raw; |
| 20891 result.StorePointer(&result.raw_ptr()->send_port_, send_port.raw()); | 20917 result.StorePointer(&result.raw_ptr()->send_port_, send_port.raw()); |
| 20892 } | 20918 } |
| 20893 if (is_control_port) { | 20919 if (is_control_port) { |
| 20894 PortMap::SetPortState(id, PortMap::kControlPort); | 20920 PortMap::SetPortState(id, PortMap::kControlPort); |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21429 NoSafepointScope no_safepoint; | 21455 NoSafepointScope no_safepoint; |
| 21430 result ^= raw; | 21456 result ^= raw; |
| 21431 } | 21457 } |
| 21432 result.set_label(label); | 21458 result.set_label(label); |
| 21433 AddTagToIsolate(isolate, result); | 21459 AddTagToIsolate(isolate, result); |
| 21434 return result.raw(); | 21460 return result.raw(); |
| 21435 } | 21461 } |
| 21436 | 21462 |
| 21437 | 21463 |
| 21438 RawUserTag* UserTag::DefaultTag() { | 21464 RawUserTag* UserTag::DefaultTag() { |
| 21439 Isolate* isolate = Isolate::Current(); | 21465 Thread* thread = Thread::Current(); |
| 21466 Zone* zone = thread->zone(); |
| 21467 Isolate* isolate = thread->isolate(); |
| 21440 ASSERT(isolate != NULL); | 21468 ASSERT(isolate != NULL); |
| 21441 if (isolate->default_tag() != UserTag::null()) { | 21469 if (isolate->default_tag() != UserTag::null()) { |
| 21442 // Already created. | 21470 // Already created. |
| 21443 return isolate->default_tag(); | 21471 return isolate->default_tag(); |
| 21444 } | 21472 } |
| 21445 // Create default tag. | 21473 // Create default tag. |
| 21446 const UserTag& result = UserTag::Handle(isolate, | 21474 const UserTag& result = UserTag::Handle(zone, |
| 21447 UserTag::New(Symbols::Default())); | 21475 UserTag::New(Symbols::Default())); |
| 21448 ASSERT(result.tag() == UserTags::kDefaultUserTag); | 21476 ASSERT(result.tag() == UserTags::kDefaultUserTag); |
| 21449 isolate->set_default_tag(result); | 21477 isolate->set_default_tag(result); |
| 21450 return result.raw(); | 21478 return result.raw(); |
| 21451 } | 21479 } |
| 21452 | 21480 |
| 21453 | 21481 |
| 21454 RawUserTag* UserTag::FindTagInIsolate(Isolate* isolate, const String& label) { | 21482 RawUserTag* UserTag::FindTagInIsolate(Isolate* isolate, const String& label) { |
| 21455 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); | 21483 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); |
| 21456 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( | 21484 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( |
| 21457 isolate, isolate->tag_table()); | 21485 isolate->current_zone(), isolate->tag_table()); |
| 21458 UserTag& other = UserTag::Handle(isolate); | 21486 UserTag& other = UserTag::Handle(isolate->current_zone()); |
| 21459 String& tag_label = String::Handle(isolate); | 21487 String& tag_label = String::Handle(isolate->current_zone()); |
| 21460 for (intptr_t i = 0; i < tag_table.Length(); i++) { | 21488 for (intptr_t i = 0; i < tag_table.Length(); i++) { |
| 21461 other ^= tag_table.At(i); | 21489 other ^= tag_table.At(i); |
| 21462 ASSERT(!other.IsNull()); | 21490 ASSERT(!other.IsNull()); |
| 21463 tag_label ^= other.label(); | 21491 tag_label ^= other.label(); |
| 21464 ASSERT(!tag_label.IsNull()); | 21492 ASSERT(!tag_label.IsNull()); |
| 21465 if (tag_label.Equals(label)) { | 21493 if (tag_label.Equals(label)) { |
| 21466 return other.raw(); | 21494 return other.raw(); |
| 21467 } | 21495 } |
| 21468 } | 21496 } |
| 21469 return UserTag::null(); | 21497 return UserTag::null(); |
| 21470 } | 21498 } |
| 21471 | 21499 |
| 21472 | 21500 |
| 21473 void UserTag::AddTagToIsolate(Isolate* isolate, const UserTag& tag) { | 21501 void UserTag::AddTagToIsolate(Isolate* isolate, const UserTag& tag) { |
| 21474 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); | 21502 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); |
| 21475 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( | 21503 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( |
| 21476 isolate, isolate->tag_table()); | 21504 isolate->current_zone(), isolate->tag_table()); |
| 21477 ASSERT(!TagTableIsFull(isolate)); | 21505 ASSERT(!TagTableIsFull(isolate)); |
| 21478 #if defined(DEBUG) | 21506 #if defined(DEBUG) |
| 21479 // Verify that no existing tag has the same tag id. | 21507 // Verify that no existing tag has the same tag id. |
| 21480 UserTag& other = UserTag::Handle(isolate); | 21508 UserTag& other = UserTag::Handle(isolate->current_zone()); |
| 21481 for (intptr_t i = 0; i < tag_table.Length(); i++) { | 21509 for (intptr_t i = 0; i < tag_table.Length(); i++) { |
| 21482 other ^= tag_table.At(i); | 21510 other ^= tag_table.At(i); |
| 21483 ASSERT(!other.IsNull()); | 21511 ASSERT(!other.IsNull()); |
| 21484 ASSERT(tag.tag() != other.tag()); | 21512 ASSERT(tag.tag() != other.tag()); |
| 21485 } | 21513 } |
| 21486 #endif | 21514 #endif |
| 21487 // Generate the UserTag tag id by taking the length of the isolate's | 21515 // Generate the UserTag tag id by taking the length of the isolate's |
| 21488 // tag table + kUserTagIdOffset. | 21516 // tag table + kUserTagIdOffset. |
| 21489 uword tag_id = tag_table.Length() + UserTags::kUserTagIdOffset; | 21517 uword tag_id = tag_table.Length() + UserTags::kUserTagIdOffset; |
| 21490 ASSERT(tag_id >= UserTags::kUserTagIdOffset); | 21518 ASSERT(tag_id >= UserTags::kUserTagIdOffset); |
| 21491 ASSERT(tag_id < (UserTags::kUserTagIdOffset + UserTags::kMaxUserTags)); | 21519 ASSERT(tag_id < (UserTags::kUserTagIdOffset + UserTags::kMaxUserTags)); |
| 21492 tag.set_tag(tag_id); | 21520 tag.set_tag(tag_id); |
| 21493 tag_table.Add(tag); | 21521 tag_table.Add(tag); |
| 21494 } | 21522 } |
| 21495 | 21523 |
| 21496 | 21524 |
| 21497 bool UserTag::TagTableIsFull(Isolate* isolate) { | 21525 bool UserTag::TagTableIsFull(Isolate* isolate) { |
| 21498 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); | 21526 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); |
| 21499 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( | 21527 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( |
| 21500 isolate, isolate->tag_table()); | 21528 isolate->current_zone(), isolate->tag_table()); |
| 21501 ASSERT(tag_table.Length() <= UserTags::kMaxUserTags); | 21529 ASSERT(tag_table.Length() <= UserTags::kMaxUserTags); |
| 21502 return tag_table.Length() == UserTags::kMaxUserTags; | 21530 return tag_table.Length() == UserTags::kMaxUserTags; |
| 21503 } | 21531 } |
| 21504 | 21532 |
| 21505 | 21533 |
| 21506 RawUserTag* UserTag::FindTagById(uword tag_id) { | 21534 RawUserTag* UserTag::FindTagById(uword tag_id) { |
| 21507 Isolate* isolate = Isolate::Current(); | 21535 Thread* thread = Thread::Current(); |
| 21536 Zone* zone = thread->zone(); |
| 21537 Isolate* isolate = thread->isolate(); |
| 21508 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); | 21538 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); |
| 21509 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( | 21539 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( |
| 21510 isolate, isolate->tag_table()); | 21540 zone, isolate->tag_table()); |
| 21511 UserTag& tag = UserTag::Handle(isolate); | 21541 UserTag& tag = UserTag::Handle(zone); |
| 21512 for (intptr_t i = 0; i < tag_table.Length(); i++) { | 21542 for (intptr_t i = 0; i < tag_table.Length(); i++) { |
| 21513 tag ^= tag_table.At(i); | 21543 tag ^= tag_table.At(i); |
| 21514 if (tag.tag() == tag_id) { | 21544 if (tag.tag() == tag_id) { |
| 21515 return tag.raw(); | 21545 return tag.raw(); |
| 21516 } | 21546 } |
| 21517 } | 21547 } |
| 21518 return UserTag::null(); | 21548 return UserTag::null(); |
| 21519 } | 21549 } |
| 21520 | 21550 |
| 21521 | 21551 |
| 21522 const char* UserTag::ToCString() const { | 21552 const char* UserTag::ToCString() const { |
| 21523 const String& tag_label = String::Handle(label()); | 21553 const String& tag_label = String::Handle(label()); |
| 21524 return tag_label.ToCString(); | 21554 return tag_label.ToCString(); |
| 21525 } | 21555 } |
| 21526 | 21556 |
| 21527 | 21557 |
| 21528 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21558 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21529 Instance::PrintJSONImpl(stream, ref); | 21559 Instance::PrintJSONImpl(stream, ref); |
| 21530 } | 21560 } |
| 21531 | 21561 |
| 21532 | 21562 |
| 21533 } // namespace dart | 21563 } // namespace dart |
| OLD | NEW |