Chromium Code Reviews| 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, |
| 3884 thsi.LookupDynamicFunction(Symbols::Call())); | 3889 thsi.LookupDynamicFunction(Symbols::Call())); |
|
regis
2015/10/12 20:48:30
Should fit on one line now.
srdjan
2015/10/12 20:56:51
Done.
| |
| 3885 if (function.IsNull()) { | 3890 if (function.IsNull()) { |
| 3886 // Walk up the super_class chain. | 3891 // Walk up the super_class chain. |
| 3887 Class& cls = Class::Handle(isolate, thsi.SuperClass()); | 3892 Class& cls = Class::Handle(zone, thsi.SuperClass()); |
| 3888 while (!cls.IsNull() && function.IsNull()) { | 3893 while (!cls.IsNull() && function.IsNull()) { |
| 3889 function = cls.LookupDynamicFunction(Symbols::Call()); | 3894 function = cls.LookupDynamicFunction(Symbols::Call()); |
| 3890 cls = cls.SuperClass(); | 3895 cls = cls.SuperClass(); |
| 3891 } | 3896 } |
| 3892 } | 3897 } |
| 3893 if (!function.IsNull()) { | 3898 if (!function.IsNull()) { |
| 3894 if (other_is_function_class || | 3899 if (other_is_function_class || |
| 3895 function.TypeTest(test_kind, | 3900 function.TypeTest(test_kind, |
| 3896 type_arguments, | 3901 type_arguments, |
| 3897 other_fun, | 3902 other_fun, |
| 3898 other_type_arguments, | 3903 other_type_arguments, |
| 3899 bound_error, | 3904 bound_error, |
| 3900 space)) { | 3905 space)) { |
| 3901 return true; | 3906 return true; |
| 3902 } | 3907 } |
| 3903 } | 3908 } |
| 3904 } | 3909 } |
| 3905 // Check for 'direct super type' specified in the implements clause | 3910 // Check for 'direct super type' specified in the implements clause |
| 3906 // and check for transitivity at the same time. | 3911 // and check for transitivity at the same time. |
| 3907 Array& interfaces = Array::Handle(isolate, thsi.interfaces()); | 3912 Array& interfaces = Array::Handle(zone, thsi.interfaces()); |
| 3908 AbstractType& interface = AbstractType::Handle(isolate); | 3913 AbstractType& interface = AbstractType::Handle(zone); |
| 3909 Class& interface_class = Class::Handle(isolate); | 3914 Class& interface_class = Class::Handle(zone); |
| 3910 TypeArguments& interface_args = TypeArguments::Handle(isolate); | 3915 TypeArguments& interface_args = TypeArguments::Handle(zone); |
| 3911 Error& error = Error::Handle(isolate); | 3916 Error& error = Error::Handle(zone); |
| 3912 for (intptr_t i = 0; i < interfaces.Length(); i++) { | 3917 for (intptr_t i = 0; i < interfaces.Length(); i++) { |
| 3913 interface ^= interfaces.At(i); | 3918 interface ^= interfaces.At(i); |
| 3914 if (!interface.IsFinalized()) { | 3919 if (!interface.IsFinalized()) { |
| 3915 // We may be checking bounds at finalization time and can encounter | 3920 // We may be checking bounds at finalization time and can encounter |
| 3916 // a still unfinalized interface. | 3921 // a still unfinalized interface. |
| 3917 ClassFinalizer::FinalizeType( | 3922 ClassFinalizer::FinalizeType( |
| 3918 thsi, interface, ClassFinalizer::kCanonicalize); | 3923 thsi, interface, ClassFinalizer::kCanonicalize); |
| 3919 interfaces.SetAt(i, interface); | 3924 interfaces.SetAt(i, interface); |
| 3920 } | 3925 } |
| 3921 if (interface.IsMalbounded()) { | 3926 if (interface.IsMalbounded()) { |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4209 | 4214 |
| 4210 // No function found. | 4215 // No function found. |
| 4211 return Function::null(); | 4216 return Function::null(); |
| 4212 } | 4217 } |
| 4213 | 4218 |
| 4214 | 4219 |
| 4215 RawFunction* Class::LookupFunctionAtToken(intptr_t token_pos) const { | 4220 RawFunction* Class::LookupFunctionAtToken(intptr_t token_pos) const { |
| 4216 // TODO(hausner): we can shortcut the negative case if we knew the | 4221 // TODO(hausner): we can shortcut the negative case if we knew the |
| 4217 // beginning and end token position of the class. | 4222 // beginning and end token position of the class. |
| 4218 Thread* thread = Thread::Current(); | 4223 Thread* thread = Thread::Current(); |
| 4219 Isolate* isolate = thread->isolate(); | 4224 Zone* zone = thread->zone(); |
| 4220 if (EnsureIsFinalized(thread) != Error::null()) { | 4225 if (EnsureIsFinalized(thread) != Error::null()) { |
| 4221 return Function::null(); | 4226 return Function::null(); |
| 4222 } | 4227 } |
| 4223 Function& func = Function::Handle(isolate); | 4228 Function& func = Function::Handle(zone); |
| 4224 func = LookupClosureFunction(token_pos); | 4229 func = LookupClosureFunction(token_pos); |
| 4225 if (!func.IsNull()) { | 4230 if (!func.IsNull()) { |
| 4226 return func.raw(); | 4231 return func.raw(); |
| 4227 } | 4232 } |
| 4228 Array& funcs = Array::Handle(isolate, functions()); | 4233 Array& funcs = Array::Handle(zone, functions()); |
| 4229 intptr_t len = funcs.Length(); | 4234 intptr_t len = funcs.Length(); |
| 4230 for (intptr_t i = 0; i < len; i++) { | 4235 for (intptr_t i = 0; i < len; i++) { |
| 4231 func ^= funcs.At(i); | 4236 func ^= funcs.At(i); |
| 4232 if ((func.token_pos() <= token_pos) && | 4237 if ((func.token_pos() <= token_pos) && |
| 4233 (token_pos <= func.end_token_pos())) { | 4238 (token_pos <= func.end_token_pos())) { |
| 4234 return func.raw(); | 4239 return func.raw(); |
| 4235 } | 4240 } |
| 4236 } | 4241 } |
| 4237 // No function found. | 4242 // No function found. |
| 4238 return Function::null(); | 4243 return Function::null(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4285 } | 4290 } |
| 4286 return Field::null(); | 4291 return Field::null(); |
| 4287 } | 4292 } |
| 4288 } | 4293 } |
| 4289 // No field found. | 4294 // No field found. |
| 4290 return Field::null(); | 4295 return Field::null(); |
| 4291 } | 4296 } |
| 4292 | 4297 |
| 4293 | 4298 |
| 4294 RawLibraryPrefix* Class::LookupLibraryPrefix(const String& name) const { | 4299 RawLibraryPrefix* Class::LookupLibraryPrefix(const String& name) const { |
| 4295 Isolate* isolate = Isolate::Current(); | 4300 Zone* zone = Thread::Current()->zone(); |
| 4296 const Library& lib = Library::Handle(isolate, library()); | 4301 const Library& lib = Library::Handle(zone, library()); |
| 4297 const Object& obj = Object::Handle(isolate, lib.LookupLocalObject(name)); | 4302 const Object& obj = Object::Handle(zone, lib.LookupLocalObject(name)); |
| 4298 if (!obj.IsNull() && obj.IsLibraryPrefix()) { | 4303 if (!obj.IsNull() && obj.IsLibraryPrefix()) { |
| 4299 return LibraryPrefix::Cast(obj).raw(); | 4304 return LibraryPrefix::Cast(obj).raw(); |
| 4300 } | 4305 } |
| 4301 return LibraryPrefix::null(); | 4306 return LibraryPrefix::null(); |
| 4302 } | 4307 } |
| 4303 | 4308 |
| 4304 | 4309 |
| 4305 const char* Class::ToCString() const { | 4310 const char* Class::ToCString() const { |
| 4306 const Library& lib = Library::Handle(library()); | 4311 const Library& lib = Library::Handle(library()); |
| 4307 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); | 4312 const char* library_name = lib.IsNull() ? "" : lib.ToCString(); |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5022 | 5027 |
| 5023 | 5028 |
| 5024 void TypeArguments::SetLength(intptr_t value) const { | 5029 void TypeArguments::SetLength(intptr_t value) const { |
| 5025 ASSERT(!IsCanonical()); | 5030 ASSERT(!IsCanonical()); |
| 5026 // This is only safe because we create a new Smi, which does not cause | 5031 // This is only safe because we create a new Smi, which does not cause |
| 5027 // heap allocation. | 5032 // heap allocation. |
| 5028 StoreSmi(&raw_ptr()->length_, Smi::New(value)); | 5033 StoreSmi(&raw_ptr()->length_, Smi::New(value)); |
| 5029 } | 5034 } |
| 5030 | 5035 |
| 5031 | 5036 |
| 5032 static void GrowCanonicalTypeArguments(Isolate* isolate, const Array& table) { | 5037 static void GrowCanonicalTypeArguments(Thread* thread, const Array& table) { |
| 5038 Isolate* isolate = thread->isolate(); | |
| 5039 Zone* zone = thread->zone(); | |
| 5033 // Last element of the array is the number of used elements. | 5040 // Last element of the array is the number of used elements. |
| 5034 const intptr_t table_size = table.Length() - 1; | 5041 const intptr_t table_size = table.Length() - 1; |
| 5035 const intptr_t new_table_size = table_size * 2; | 5042 const intptr_t new_table_size = table_size * 2; |
| 5036 Array& new_table = Array::Handle(isolate, Array::New(new_table_size + 1)); | 5043 Array& new_table = Array::Handle(zone, Array::New(new_table_size + 1)); |
| 5037 // Copy all elements from the original table to the newly allocated | 5044 // Copy all elements from the original table to the newly allocated |
| 5038 // array. | 5045 // array. |
| 5039 TypeArguments& element = TypeArguments::Handle(isolate); | 5046 TypeArguments& element = TypeArguments::Handle(zone); |
| 5040 Object& new_element = Object::Handle(isolate); | 5047 Object& new_element = Object::Handle(zone); |
| 5041 for (intptr_t i = 0; i < table_size; i++) { | 5048 for (intptr_t i = 0; i < table_size; i++) { |
| 5042 element ^= table.At(i); | 5049 element ^= table.At(i); |
| 5043 if (!element.IsNull()) { | 5050 if (!element.IsNull()) { |
| 5044 const intptr_t hash = element.Hash(); | 5051 const intptr_t hash = element.Hash(); |
| 5045 ASSERT(Utils::IsPowerOfTwo(new_table_size)); | 5052 ASSERT(Utils::IsPowerOfTwo(new_table_size)); |
| 5046 intptr_t index = hash & (new_table_size - 1); | 5053 intptr_t index = hash & (new_table_size - 1); |
| 5047 new_element = new_table.At(index); | 5054 new_element = new_table.At(index); |
| 5048 while (!new_element.IsNull()) { | 5055 while (!new_element.IsNull()) { |
| 5049 index = (index + 1) & (new_table_size - 1); // Move to next element. | 5056 index = (index + 1) & (new_table_size - 1); // Move to next element. |
| 5050 new_element = new_table.At(index); | 5057 new_element = new_table.At(index); |
| 5051 } | 5058 } |
| 5052 new_table.SetAt(index, element); | 5059 new_table.SetAt(index, element); |
| 5053 } | 5060 } |
| 5054 } | 5061 } |
| 5055 // Copy used count. | 5062 // Copy used count. |
| 5056 new_element = table.At(table_size); | 5063 new_element = table.At(table_size); |
| 5057 new_table.SetAt(new_table_size, new_element); | 5064 new_table.SetAt(new_table_size, new_element); |
| 5058 // Remember the new table now. | 5065 // Remember the new table now. |
| 5059 isolate->object_store()->set_canonical_type_arguments(new_table); | 5066 isolate->object_store()->set_canonical_type_arguments(new_table); |
| 5060 } | 5067 } |
| 5061 | 5068 |
| 5062 | 5069 |
| 5063 static void InsertIntoCanonicalTypeArguments(Isolate* isolate, | 5070 static void InsertIntoCanonicalTypeArguments(Thread* thread, |
| 5064 const Array& table, | 5071 const Array& table, |
| 5065 const TypeArguments& arguments, | 5072 const TypeArguments& arguments, |
| 5066 intptr_t index) { | 5073 intptr_t index) { |
| 5074 Zone* zone = thread->zone(); | |
| 5067 arguments.SetCanonical(); // Mark object as being canonical. | 5075 arguments.SetCanonical(); // Mark object as being canonical. |
| 5068 table.SetAt(index, arguments); // Remember the new element. | 5076 table.SetAt(index, arguments); // Remember the new element. |
| 5069 // Update used count. | 5077 // Update used count. |
| 5070 // Last element of the array is the number of used elements. | 5078 // Last element of the array is the number of used elements. |
| 5071 const intptr_t table_size = table.Length() - 1; | 5079 const intptr_t table_size = table.Length() - 1; |
| 5072 const intptr_t used_elements = | 5080 const intptr_t used_elements = |
| 5073 Smi::Value(Smi::RawCast(table.At(table_size))) + 1; | 5081 Smi::Value(Smi::RawCast(table.At(table_size))) + 1; |
| 5074 const Smi& used = Smi::Handle(isolate, Smi::New(used_elements)); | 5082 const Smi& used = Smi::Handle(zone, Smi::New(used_elements)); |
| 5075 table.SetAt(table_size, used); | 5083 table.SetAt(table_size, used); |
| 5076 | 5084 |
| 5077 #ifdef DEBUG | 5085 #ifdef DEBUG |
| 5078 // Verify that there are no duplicates. | 5086 // Verify that there are no duplicates. |
| 5079 // Duplicates could appear if hash values are not kept constant across | 5087 // Duplicates could appear if hash values are not kept constant across |
| 5080 // snapshots, e.g. if class ids are not preserved by the snapshots. | 5088 // snapshots, e.g. if class ids are not preserved by the snapshots. |
| 5081 TypeArguments& other_arguments = TypeArguments::Handle(); | 5089 TypeArguments& other_arguments = TypeArguments::Handle(); |
| 5082 for (intptr_t i = 0; i < table_size; i++) { | 5090 for (intptr_t i = 0; i < table_size; i++) { |
| 5083 if ((i != index) && (table.At(i) != TypeArguments::null())) { | 5091 if ((i != index) && (table.At(i) != TypeArguments::null())) { |
| 5084 other_arguments ^= table.At(i); | 5092 other_arguments ^= table.At(i); |
| 5085 if (arguments.Equals(other_arguments)) { | 5093 if (arguments.Equals(other_arguments)) { |
| 5086 // Recursive types may be equal, but have different hashes. | 5094 // Recursive types may be equal, but have different hashes. |
| 5087 ASSERT(arguments.IsRecursive()); | 5095 ASSERT(arguments.IsRecursive()); |
| 5088 ASSERT(other_arguments.IsRecursive()); | 5096 ASSERT(other_arguments.IsRecursive()); |
| 5089 ASSERT(arguments.Hash() != other_arguments.Hash()); | 5097 ASSERT(arguments.Hash() != other_arguments.Hash()); |
| 5090 } | 5098 } |
| 5091 } | 5099 } |
| 5092 } | 5100 } |
| 5093 #endif | 5101 #endif |
| 5094 | 5102 |
| 5095 // Rehash if table is 75% full. | 5103 // Rehash if table is 75% full. |
| 5096 if (used_elements > ((table_size / 4) * 3)) { | 5104 if (used_elements > ((table_size / 4) * 3)) { |
| 5097 GrowCanonicalTypeArguments(isolate, table); | 5105 GrowCanonicalTypeArguments(thread, table); |
| 5098 } | 5106 } |
| 5099 } | 5107 } |
| 5100 | 5108 |
| 5101 | 5109 |
| 5102 static intptr_t FindIndexInCanonicalTypeArguments( | 5110 static intptr_t FindIndexInCanonicalTypeArguments( |
| 5103 Isolate* isolate, | 5111 Zone* zone, |
| 5104 const Array& table, | 5112 const Array& table, |
| 5105 const TypeArguments& arguments, | 5113 const TypeArguments& arguments, |
| 5106 intptr_t hash) { | 5114 intptr_t hash) { |
| 5107 // Last element of the array is the number of used elements. | 5115 // Last element of the array is the number of used elements. |
| 5108 const intptr_t table_size = table.Length() - 1; | 5116 const intptr_t table_size = table.Length() - 1; |
| 5109 ASSERT(Utils::IsPowerOfTwo(table_size)); | 5117 ASSERT(Utils::IsPowerOfTwo(table_size)); |
| 5110 intptr_t index = hash & (table_size - 1); | 5118 intptr_t index = hash & (table_size - 1); |
| 5111 | 5119 |
| 5112 TypeArguments& current = TypeArguments::Handle(isolate); | 5120 TypeArguments& current = TypeArguments::Handle(zone); |
| 5113 current ^= table.At(index); | 5121 current ^= table.At(index); |
| 5114 while (!current.IsNull() && !current.Equals(arguments)) { | 5122 while (!current.IsNull() && !current.Equals(arguments)) { |
| 5115 index = (index + 1) & (table_size - 1); // Move to next element. | 5123 index = (index + 1) & (table_size - 1); // Move to next element. |
| 5116 current ^= table.At(index); | 5124 current ^= table.At(index); |
| 5117 } | 5125 } |
| 5118 return index; // Index of element if found or slot into which to add it. | 5126 return index; // Index of element if found or slot into which to add it. |
| 5119 } | 5127 } |
| 5120 | 5128 |
| 5121 | 5129 |
| 5122 RawTypeArguments* TypeArguments::CloneUnfinalized() const { | 5130 RawTypeArguments* TypeArguments::CloneUnfinalized() const { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5162 | 5170 |
| 5163 RawTypeArguments* TypeArguments::Canonicalize(TrailPtr trail) const { | 5171 RawTypeArguments* TypeArguments::Canonicalize(TrailPtr trail) const { |
| 5164 if (IsNull() || IsCanonical()) { | 5172 if (IsNull() || IsCanonical()) { |
| 5165 ASSERT(IsOld()); | 5173 ASSERT(IsOld()); |
| 5166 return this->raw(); | 5174 return this->raw(); |
| 5167 } | 5175 } |
| 5168 const intptr_t num_types = Length(); | 5176 const intptr_t num_types = Length(); |
| 5169 if (IsRaw(0, num_types)) { | 5177 if (IsRaw(0, num_types)) { |
| 5170 return TypeArguments::null(); | 5178 return TypeArguments::null(); |
| 5171 } | 5179 } |
| 5172 Isolate* isolate = Isolate::Current(); | 5180 Thread* thread = Thread::Current(); |
| 5181 Zone* zone = thread->zone(); | |
| 5182 Isolate* isolate = thread->isolate(); | |
| 5173 ObjectStore* object_store = isolate->object_store(); | 5183 ObjectStore* object_store = isolate->object_store(); |
| 5174 Array& table = Array::Handle(isolate, | 5184 Array& table = Array::Handle(zone, |
| 5175 object_store->canonical_type_arguments()); | 5185 object_store->canonical_type_arguments()); |
| 5176 // Last element of the array is the number of used elements. | 5186 // Last element of the array is the number of used elements. |
| 5177 const intptr_t num_used = | 5187 const intptr_t num_used = |
| 5178 Smi::Value(Smi::RawCast(table.At(table.Length() - 1))); | 5188 Smi::Value(Smi::RawCast(table.At(table.Length() - 1))); |
| 5179 const intptr_t hash = Hash(); | 5189 const intptr_t hash = Hash(); |
| 5180 intptr_t index = | 5190 intptr_t index = FindIndexInCanonicalTypeArguments(zone, table, *this, hash); |
| 5181 FindIndexInCanonicalTypeArguments(isolate, table, *this, hash); | 5191 TypeArguments& result = TypeArguments::Handle(zone); |
| 5182 TypeArguments& result = TypeArguments::Handle(isolate); | |
| 5183 result ^= table.At(index); | 5192 result ^= table.At(index); |
| 5184 if (result.IsNull()) { | 5193 if (result.IsNull()) { |
| 5185 // Canonicalize each type argument. | 5194 // Canonicalize each type argument. |
| 5186 AbstractType& type_arg = AbstractType::Handle(isolate); | 5195 AbstractType& type_arg = AbstractType::Handle(zone); |
| 5187 for (intptr_t i = 0; i < num_types; i++) { | 5196 for (intptr_t i = 0; i < num_types; i++) { |
| 5188 type_arg = TypeAt(i); | 5197 type_arg = TypeAt(i); |
| 5189 type_arg = type_arg.Canonicalize(trail); | 5198 type_arg = type_arg.Canonicalize(trail); |
| 5190 SetTypeAt(i, type_arg); | 5199 SetTypeAt(i, type_arg); |
| 5191 } | 5200 } |
| 5192 // Canonicalization of a recursive type may change its hash. | 5201 // Canonicalization of a recursive type may change its hash. |
| 5193 intptr_t canonical_hash = hash; | 5202 intptr_t canonical_hash = hash; |
| 5194 if (IsRecursive()) { | 5203 if (IsRecursive()) { |
| 5195 canonical_hash = Hash(); | 5204 canonical_hash = Hash(); |
| 5196 } | 5205 } |
| 5197 // Canonicalization of the type argument's own type arguments may add an | 5206 // 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 | 5207 // entry to the table, or even grow the table, and thereby change the |
| 5199 // previously calculated index. | 5208 // previously calculated index. |
| 5200 table = object_store->canonical_type_arguments(); | 5209 table = object_store->canonical_type_arguments(); |
| 5201 if ((canonical_hash != hash) || | 5210 if ((canonical_hash != hash) || |
| 5202 (Smi::Value(Smi::RawCast(table.At(table.Length() - 1))) != num_used)) { | 5211 (Smi::Value(Smi::RawCast(table.At(table.Length() - 1))) != num_used)) { |
| 5203 index = FindIndexInCanonicalTypeArguments( | 5212 index = FindIndexInCanonicalTypeArguments( |
| 5204 isolate, table, *this, canonical_hash); | 5213 zone, table, *this, canonical_hash); |
| 5205 result ^= table.At(index); | 5214 result ^= table.At(index); |
| 5206 } | 5215 } |
| 5207 if (result.IsNull()) { | 5216 if (result.IsNull()) { |
| 5208 // Make sure we have an old space object and add it to the table. | 5217 // Make sure we have an old space object and add it to the table. |
| 5209 if (this->IsNew()) { | 5218 if (this->IsNew()) { |
| 5210 result ^= Object::Clone(*this, Heap::kOld); | 5219 result ^= Object::Clone(*this, Heap::kOld); |
| 5211 } else { | 5220 } else { |
| 5212 result ^= this->raw(); | 5221 result ^= this->raw(); |
| 5213 } | 5222 } |
| 5214 ASSERT(result.IsOld()); | 5223 ASSERT(result.IsOld()); |
| 5215 InsertIntoCanonicalTypeArguments(isolate, table, result, index); | 5224 InsertIntoCanonicalTypeArguments(thread, table, result, index); |
| 5216 } | 5225 } |
| 5217 } | 5226 } |
| 5218 ASSERT(result.Equals(*this)); | 5227 ASSERT(result.Equals(*this)); |
| 5219 ASSERT(!result.IsNull()); | 5228 ASSERT(!result.IsNull()); |
| 5220 ASSERT(result.IsTypeArguments()); | 5229 ASSERT(result.IsTypeArguments()); |
| 5221 ASSERT(result.IsCanonical()); | 5230 ASSERT(result.IsCanonical()); |
| 5222 return result.raw(); | 5231 return result.raw(); |
| 5223 } | 5232 } |
| 5224 | 5233 |
| 5225 | 5234 |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5922 const Array& argument_names, | 5931 const Array& argument_names, |
| 5923 String* error_message) const { | 5932 String* error_message) const { |
| 5924 const intptr_t num_named_arguments = | 5933 const intptr_t num_named_arguments = |
| 5925 argument_names.IsNull() ? 0 : argument_names.Length(); | 5934 argument_names.IsNull() ? 0 : argument_names.Length(); |
| 5926 if (!AreValidArgumentCounts(num_arguments, | 5935 if (!AreValidArgumentCounts(num_arguments, |
| 5927 num_named_arguments, | 5936 num_named_arguments, |
| 5928 error_message)) { | 5937 error_message)) { |
| 5929 return false; | 5938 return false; |
| 5930 } | 5939 } |
| 5931 // Verify that all argument names are valid parameter names. | 5940 // Verify that all argument names are valid parameter names. |
| 5932 Isolate* isolate = Isolate::Current(); | 5941 Zone* zone = Thread::Current()->zone(); |
| 5933 String& argument_name = String::Handle(isolate); | 5942 String& argument_name = String::Handle(zone); |
| 5934 String& parameter_name = String::Handle(isolate); | 5943 String& parameter_name = String::Handle(zone); |
| 5935 for (intptr_t i = 0; i < num_named_arguments; i++) { | 5944 for (intptr_t i = 0; i < num_named_arguments; i++) { |
| 5936 argument_name ^= argument_names.At(i); | 5945 argument_name ^= argument_names.At(i); |
| 5937 ASSERT(argument_name.IsSymbol()); | 5946 ASSERT(argument_name.IsSymbol()); |
| 5938 bool found = false; | 5947 bool found = false; |
| 5939 const intptr_t num_positional_args = num_arguments - num_named_arguments; | 5948 const intptr_t num_positional_args = num_arguments - num_named_arguments; |
| 5940 const intptr_t num_parameters = NumParameters(); | 5949 const intptr_t num_parameters = NumParameters(); |
| 5941 for (intptr_t j = num_positional_args; | 5950 for (intptr_t j = num_positional_args; |
| 5942 !found && (j < num_parameters); | 5951 !found && (j < num_parameters); |
| 5943 j++) { | 5952 j++) { |
| 5944 parameter_name = ParameterNameAt(j); | 5953 parameter_name = ParameterNameAt(j); |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 5970 String* error_message) const { | 5979 String* error_message) const { |
| 5971 const intptr_t num_arguments = args_desc.Count(); | 5980 const intptr_t num_arguments = args_desc.Count(); |
| 5972 const intptr_t num_named_arguments = args_desc.NamedCount(); | 5981 const intptr_t num_named_arguments = args_desc.NamedCount(); |
| 5973 | 5982 |
| 5974 if (!AreValidArgumentCounts(num_arguments, | 5983 if (!AreValidArgumentCounts(num_arguments, |
| 5975 num_named_arguments, | 5984 num_named_arguments, |
| 5976 error_message)) { | 5985 error_message)) { |
| 5977 return false; | 5986 return false; |
| 5978 } | 5987 } |
| 5979 // Verify that all argument names are valid parameter names. | 5988 // Verify that all argument names are valid parameter names. |
| 5980 Isolate* isolate = Isolate::Current(); | 5989 Zone* zone = Thread::Current()->zone(); |
| 5981 String& argument_name = String::Handle(isolate); | 5990 String& argument_name = String::Handle(zone); |
| 5982 String& parameter_name = String::Handle(isolate); | 5991 String& parameter_name = String::Handle(zone); |
| 5983 for (intptr_t i = 0; i < num_named_arguments; i++) { | 5992 for (intptr_t i = 0; i < num_named_arguments; i++) { |
| 5984 argument_name ^= args_desc.NameAt(i); | 5993 argument_name ^= args_desc.NameAt(i); |
| 5985 ASSERT(argument_name.IsSymbol()); | 5994 ASSERT(argument_name.IsSymbol()); |
| 5986 bool found = false; | 5995 bool found = false; |
| 5987 const intptr_t num_positional_args = num_arguments - num_named_arguments; | 5996 const intptr_t num_positional_args = num_arguments - num_named_arguments; |
| 5988 const int num_parameters = NumParameters(); | 5997 const int num_parameters = NumParameters(); |
| 5989 for (intptr_t j = num_positional_args; | 5998 for (intptr_t j = num_positional_args; |
| 5990 !found && (j < num_parameters); | 5999 !found && (j < num_parameters); |
| 5991 j++) { | 6000 j++) { |
| 5992 parameter_name = ParameterNameAt(j); | 6001 parameter_name = ParameterNameAt(j); |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6651 pieces->Add(Symbols::RBracket()); | 6660 pieces->Add(Symbols::RBracket()); |
| 6652 } else { | 6661 } else { |
| 6653 pieces->Add(Symbols::RBrace()); | 6662 pieces->Add(Symbols::RBrace()); |
| 6654 } | 6663 } |
| 6655 } | 6664 } |
| 6656 } | 6665 } |
| 6657 | 6666 |
| 6658 | 6667 |
| 6659 RawInstance* Function::ImplicitStaticClosure() const { | 6668 RawInstance* Function::ImplicitStaticClosure() const { |
| 6660 if (implicit_static_closure() == Instance::null()) { | 6669 if (implicit_static_closure() == Instance::null()) { |
| 6661 Isolate* isolate = Isolate::Current(); | 6670 Thread* thread = Thread::Current(); |
| 6671 Isolate* isolate = thread->isolate(); | |
| 6672 Zone* zone = thread->zone(); | |
| 6662 ObjectStore* object_store = isolate->object_store(); | 6673 ObjectStore* object_store = isolate->object_store(); |
| 6663 const Context& context = | 6674 const Context& context = |
| 6664 Context::Handle(isolate, object_store->empty_context()); | 6675 Context::Handle(zone, object_store->empty_context()); |
| 6665 Instance& closure = | 6676 Instance& closure = |
| 6666 Instance::Handle(isolate, Closure::New(*this, context, Heap::kOld)); | 6677 Instance::Handle(zone, Closure::New(*this, context, Heap::kOld)); |
| 6667 const char* error_str = NULL; | 6678 const char* error_str = NULL; |
| 6668 closure ^= closure.CheckAndCanonicalize(&error_str); | 6679 closure ^= closure.CheckAndCanonicalize(&error_str); |
| 6669 ASSERT(!closure.IsNull()); | 6680 ASSERT(!closure.IsNull()); |
| 6670 set_implicit_static_closure(closure); | 6681 set_implicit_static_closure(closure); |
| 6671 } | 6682 } |
| 6672 return implicit_static_closure(); | 6683 return implicit_static_closure(); |
| 6673 } | 6684 } |
| 6674 | 6685 |
| 6675 | 6686 |
| 6676 RawInstance* Function::ImplicitInstanceClosure(const Instance& receiver) const { | 6687 RawInstance* Function::ImplicitInstanceClosure(const Instance& receiver) const { |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8171 } | 8182 } |
| 8172 | 8183 |
| 8173 | 8184 |
| 8174 RawTokenStream* TokenStream::New(intptr_t len) { | 8185 RawTokenStream* TokenStream::New(intptr_t len) { |
| 8175 if (len < 0 || len > kMaxElements) { | 8186 if (len < 0 || len > kMaxElements) { |
| 8176 // This should be caught before we reach here. | 8187 // This should be caught before we reach here. |
| 8177 FATAL1("Fatal error in TokenStream::New: invalid len %" Pd "\n", len); | 8188 FATAL1("Fatal error in TokenStream::New: invalid len %" Pd "\n", len); |
| 8178 } | 8189 } |
| 8179 uint8_t* data = reinterpret_cast<uint8_t*>(::malloc(len)); | 8190 uint8_t* data = reinterpret_cast<uint8_t*>(::malloc(len)); |
| 8180 ASSERT(data != NULL); | 8191 ASSERT(data != NULL); |
| 8181 Isolate* isolate = Isolate::Current(); | 8192 Zone* zone = Thread::Current()->zone(); |
| 8182 const ExternalTypedData& stream = ExternalTypedData::Handle( | 8193 const ExternalTypedData& stream = ExternalTypedData::Handle( |
| 8183 isolate, | 8194 zone, |
| 8184 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, | 8195 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, |
| 8185 data, len, Heap::kOld)); | 8196 data, len, Heap::kOld)); |
| 8186 stream.AddFinalizer(data, DataFinalizer); | 8197 stream.AddFinalizer(data, DataFinalizer); |
| 8187 const TokenStream& result = TokenStream::Handle(isolate, TokenStream::New()); | 8198 const TokenStream& result = TokenStream::Handle(zone, TokenStream::New()); |
| 8188 result.SetStream(stream); | 8199 result.SetStream(stream); |
| 8189 return result.raw(); | 8200 return result.raw(); |
| 8190 } | 8201 } |
| 8191 | 8202 |
| 8192 | 8203 |
| 8193 // CompressedTokenMap maps String and LiteralToken keys to Smi values. | 8204 // CompressedTokenMap maps String and LiteralToken keys to Smi values. |
| 8194 // It also supports lookup by Scanner::TokenDescriptor. | 8205 // It also supports lookup by Scanner::TokenDescriptor. |
| 8195 class CompressedTokenTraits { | 8206 class CompressedTokenTraits { |
| 8196 public: | 8207 public: |
| 8197 static bool IsMatch(const Scanner::TokenDescriptor& descriptor, | 8208 static bool IsMatch(const Scanner::TokenDescriptor& descriptor, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8304 uint8_t* buffer_; | 8315 uint8_t* buffer_; |
| 8305 WriteStream stream_; | 8316 WriteStream stream_; |
| 8306 CompressedTokenMap tokens_; | 8317 CompressedTokenMap tokens_; |
| 8307 | 8318 |
| 8308 DISALLOW_COPY_AND_ASSIGN(CompressedTokenStreamData); | 8319 DISALLOW_COPY_AND_ASSIGN(CompressedTokenStreamData); |
| 8309 }; | 8320 }; |
| 8310 | 8321 |
| 8311 | 8322 |
| 8312 RawTokenStream* TokenStream::New(const Scanner::GrowableTokenStream& tokens, | 8323 RawTokenStream* TokenStream::New(const Scanner::GrowableTokenStream& tokens, |
| 8313 const String& private_key) { | 8324 const String& private_key) { |
| 8314 Isolate* isolate = Isolate::Current(); | 8325 Zone* zone = Thread::Current()->zone(); |
| 8315 // Copy the relevant data out of the scanner into a compressed stream of | 8326 // Copy the relevant data out of the scanner into a compressed stream of |
| 8316 // tokens. | 8327 // tokens. |
| 8317 CompressedTokenStreamData data; | 8328 CompressedTokenStreamData data; |
| 8318 intptr_t len = tokens.length(); | 8329 intptr_t len = tokens.length(); |
| 8319 for (intptr_t i = 0; i < len; i++) { | 8330 for (intptr_t i = 0; i < len; i++) { |
| 8320 Scanner::TokenDescriptor token = tokens[i]; | 8331 Scanner::TokenDescriptor token = tokens[i]; |
| 8321 if (token.kind == Token::kIDENT) { // Identifier token. | 8332 if (token.kind == Token::kIDENT) { // Identifier token. |
| 8322 data.AddIdentToken(token.literal); | 8333 data.AddIdentToken(token.literal); |
| 8323 } else if (Token::NeedsLiteralToken(token.kind)) { // Literal token. | 8334 } else if (Token::NeedsLiteralToken(token.kind)) { // Literal token. |
| 8324 data.AddLiteralToken(token); | 8335 data.AddLiteralToken(token); |
| 8325 } else { // Keyword, pseudo keyword etc. | 8336 } else { // Keyword, pseudo keyword etc. |
| 8326 ASSERT(token.kind < Token::kNumTokens); | 8337 ASSERT(token.kind < Token::kNumTokens); |
| 8327 data.AddSimpleToken(token.kind); | 8338 data.AddSimpleToken(token.kind); |
| 8328 } | 8339 } |
| 8329 } | 8340 } |
| 8330 data.AddSimpleToken(Token::kEOS); // End of stream. | 8341 data.AddSimpleToken(Token::kEOS); // End of stream. |
| 8331 | 8342 |
| 8332 // Create and setup the token stream object. | 8343 // Create and setup the token stream object. |
| 8333 const ExternalTypedData& stream = ExternalTypedData::Handle( | 8344 const ExternalTypedData& stream = ExternalTypedData::Handle( |
| 8334 isolate, | 8345 zone, |
| 8335 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, | 8346 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, |
| 8336 data.GetStream(), data.Length(), Heap::kOld)); | 8347 data.GetStream(), data.Length(), Heap::kOld)); |
| 8337 stream.AddFinalizer(data.GetStream(), DataFinalizer); | 8348 stream.AddFinalizer(data.GetStream(), DataFinalizer); |
| 8338 const TokenStream& result = TokenStream::Handle(isolate, New()); | 8349 const TokenStream& result = TokenStream::Handle(zone, New()); |
| 8339 result.SetPrivateKey(private_key); | 8350 result.SetPrivateKey(private_key); |
| 8340 const Array& token_objects = | 8351 const Array& token_objects = |
| 8341 Array::Handle(isolate, data.MakeTokenObjectsArray()); | 8352 Array::Handle(zone, data.MakeTokenObjectsArray()); |
| 8342 { | 8353 { |
| 8343 NoSafepointScope no_safepoint; | 8354 NoSafepointScope no_safepoint; |
| 8344 result.SetStream(stream); | 8355 result.SetStream(stream); |
| 8345 result.SetTokenObjects(token_objects); | 8356 result.SetTokenObjects(token_objects); |
| 8346 } | 8357 } |
| 8347 return result.raw(); | 8358 return result.raw(); |
| 8348 } | 8359 } |
| 8349 | 8360 |
| 8350 | 8361 |
| 8351 const char* TokenStream::ToCString() const { | 8362 const char* TokenStream::ToCString() const { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8519 } | 8530 } |
| 8520 | 8531 |
| 8521 | 8532 |
| 8522 RawString* Script::GenerateSource() const { | 8533 RawString* Script::GenerateSource() const { |
| 8523 const TokenStream& token_stream = TokenStream::Handle(tokens()); | 8534 const TokenStream& token_stream = TokenStream::Handle(tokens()); |
| 8524 return token_stream.GenerateSource(); | 8535 return token_stream.GenerateSource(); |
| 8525 } | 8536 } |
| 8526 | 8537 |
| 8527 | 8538 |
| 8528 RawGrowableObjectArray* Script::GenerateLineNumberArray() const { | 8539 RawGrowableObjectArray* Script::GenerateLineNumberArray() const { |
| 8529 Isolate* isolate = Isolate::Current(); | 8540 Zone* zone = Thread::Current()->zone(); |
| 8530 const GrowableObjectArray& info = | 8541 const GrowableObjectArray& info = |
| 8531 GrowableObjectArray::Handle(isolate, GrowableObjectArray::New()); | 8542 GrowableObjectArray::Handle(zone, GrowableObjectArray::New()); |
| 8532 const String& source = String::Handle(isolate, Source()); | 8543 const String& source = String::Handle(zone, Source()); |
| 8533 const String& key = Symbols::Empty(); | 8544 const String& key = Symbols::Empty(); |
| 8534 const Object& line_separator = Object::Handle(isolate); | 8545 const Object& line_separator = Object::Handle(zone); |
| 8535 const TokenStream& tkns = TokenStream::Handle(isolate, tokens()); | 8546 const TokenStream& tkns = TokenStream::Handle(zone, tokens()); |
| 8536 Smi& value = Smi::Handle(isolate); | 8547 Smi& value = Smi::Handle(zone); |
| 8537 String& tokenValue = String::Handle(isolate); | 8548 String& tokenValue = String::Handle(zone); |
| 8538 ASSERT(!tkns.IsNull()); | 8549 ASSERT(!tkns.IsNull()); |
| 8539 TokenStream::Iterator tkit(tkns, 0, TokenStream::Iterator::kAllTokens); | 8550 TokenStream::Iterator tkit(tkns, 0, TokenStream::Iterator::kAllTokens); |
| 8540 int current_line = -1; | 8551 int current_line = -1; |
| 8541 Scanner s(source, key); | 8552 Scanner s(source, key); |
| 8542 s.Scan(); | 8553 s.Scan(); |
| 8543 bool skippedNewline = false; | 8554 bool skippedNewline = false; |
| 8544 while (tkit.CurrentTokenKind() != Token::kEOS) { | 8555 while (tkit.CurrentTokenKind() != Token::kEOS) { |
| 8545 if (tkit.CurrentTokenKind() == Token::kNEWLINE) { | 8556 if (tkit.CurrentTokenKind() == Token::kNEWLINE) { |
| 8546 // Skip newlines from the token stream. | 8557 // Skip newlines from the token stream. |
| 8547 skippedNewline = true; | 8558 skippedNewline = true; |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8870 return result.raw(); | 8881 return result.raw(); |
| 8871 } | 8882 } |
| 8872 | 8883 |
| 8873 | 8884 |
| 8874 const char* Script::ToCString() const { | 8885 const char* Script::ToCString() const { |
| 8875 return "Script"; | 8886 return "Script"; |
| 8876 } | 8887 } |
| 8877 | 8888 |
| 8878 | 8889 |
| 8879 RawLibrary* Script::FindLibrary() const { | 8890 RawLibrary* Script::FindLibrary() const { |
| 8880 Isolate* isolate = Isolate::Current(); | 8891 Thread* thread = Thread::Current(); |
| 8892 Zone* zone = thread->zone(); | |
| 8893 Isolate* isolate = thread->isolate(); | |
| 8881 const GrowableObjectArray& libs = GrowableObjectArray::Handle( | 8894 const GrowableObjectArray& libs = GrowableObjectArray::Handle( |
| 8882 isolate, isolate->object_store()->libraries()); | 8895 zone, isolate->object_store()->libraries()); |
| 8883 Library& lib = Library::Handle(); | 8896 Library& lib = Library::Handle(); |
| 8884 Array& scripts = Array::Handle(); | 8897 Array& scripts = Array::Handle(); |
| 8885 for (intptr_t i = 0; i < libs.Length(); i++) { | 8898 for (intptr_t i = 0; i < libs.Length(); i++) { |
| 8886 lib ^= libs.At(i); | 8899 lib ^= libs.At(i); |
| 8887 scripts = lib.LoadedScripts(); | 8900 scripts = lib.LoadedScripts(); |
| 8888 for (intptr_t j = 0; j < scripts.Length(); j++) { | 8901 for (intptr_t j = 0; j < scripts.Length(); j++) { |
| 8889 if (scripts.At(j) == raw()) { | 8902 if (scripts.At(j) == raw()) { |
| 8890 return lib.raw(); | 8903 return lib.raw(); |
| 8891 } | 8904 } |
| 8892 } | 8905 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9119 | 9132 |
| 9120 typedef UnorderedHashSet<LibraryUrlTraits> LibraryLoadErrorSet; | 9133 typedef UnorderedHashSet<LibraryUrlTraits> LibraryLoadErrorSet; |
| 9121 | 9134 |
| 9122 | 9135 |
| 9123 RawInstance* Library::TransitiveLoadError() const { | 9136 RawInstance* Library::TransitiveLoadError() const { |
| 9124 if (LoadError() != Instance::null()) { | 9137 if (LoadError() != Instance::null()) { |
| 9125 return LoadError(); | 9138 return LoadError(); |
| 9126 } | 9139 } |
| 9127 Thread* thread = Thread::Current(); | 9140 Thread* thread = Thread::Current(); |
| 9128 Isolate* isolate = thread->isolate(); | 9141 Isolate* isolate = thread->isolate(); |
| 9142 Zone* zone = thread->zone(); | |
| 9129 ObjectStore* object_store = isolate->object_store(); | 9143 ObjectStore* object_store = isolate->object_store(); |
| 9130 LibraryLoadErrorSet set(object_store->library_load_error_table()); | 9144 LibraryLoadErrorSet set(object_store->library_load_error_table()); |
| 9131 bool present = false; | 9145 bool present = false; |
| 9132 if (set.GetOrNull(*this, &present) != Object::null()) { | 9146 if (set.GetOrNull(*this, &present) != Object::null()) { |
| 9133 object_store->set_library_load_error_table(set.Release()); | 9147 object_store->set_library_load_error_table(set.Release()); |
| 9134 return Instance::null(); | 9148 return Instance::null(); |
| 9135 } | 9149 } |
| 9136 // Ensure we don't repeatedly visit the same library again. | 9150 // Ensure we don't repeatedly visit the same library again. |
| 9137 set.Insert(*this); | 9151 set.Insert(*this); |
| 9138 object_store->set_library_load_error_table(set.Release()); | 9152 object_store->set_library_load_error_table(set.Release()); |
| 9139 intptr_t num_imp = num_imports(); | 9153 intptr_t num_imp = num_imports(); |
| 9140 Library& lib = Library::Handle(isolate); | 9154 Library& lib = Library::Handle(zone); |
| 9141 Instance& error = Instance::Handle(isolate); | 9155 Instance& error = Instance::Handle(zone); |
| 9142 for (intptr_t i = 0; i < num_imp; i++) { | 9156 for (intptr_t i = 0; i < num_imp; i++) { |
| 9143 HANDLESCOPE(thread); | 9157 HANDLESCOPE(thread); |
| 9144 lib = ImportLibraryAt(i); | 9158 lib = ImportLibraryAt(i); |
| 9145 error = lib.TransitiveLoadError(); | 9159 error = lib.TransitiveLoadError(); |
| 9146 if (!error.IsNull()) { | 9160 if (!error.IsNull()) { |
| 9147 break; | 9161 break; |
| 9148 } | 9162 } |
| 9149 } | 9163 } |
| 9150 return error.raw(); | 9164 return error.raw(); |
| 9151 } | 9165 } |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9703 RawFunction* Library::LookupLocalFunction(const String& name) const { | 9717 RawFunction* Library::LookupLocalFunction(const String& name) const { |
| 9704 Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); | 9718 Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); |
| 9705 if (obj.IsFunction()) { | 9719 if (obj.IsFunction()) { |
| 9706 return Function::Cast(obj).raw(); | 9720 return Function::Cast(obj).raw(); |
| 9707 } | 9721 } |
| 9708 return Function::null(); | 9722 return Function::null(); |
| 9709 } | 9723 } |
| 9710 | 9724 |
| 9711 | 9725 |
| 9712 RawObject* Library::LookupLocalObjectAllowPrivate(const String& name) const { | 9726 RawObject* Library::LookupLocalObjectAllowPrivate(const String& name) const { |
| 9713 Isolate* isolate = Isolate::Current(); | 9727 Thread* thread = Thread::Current(); |
| 9714 Object& obj = Object::Handle(isolate, Object::null()); | 9728 Zone* zone = thread->zone(); |
| 9729 Object& obj = Object::Handle(zone, Object::null()); | |
| 9715 obj = LookupLocalObject(name); | 9730 obj = LookupLocalObject(name); |
| 9716 if (obj.IsNull() && ShouldBePrivate(name)) { | 9731 if (obj.IsNull() && ShouldBePrivate(name)) { |
| 9717 String& private_name = String::Handle(isolate, PrivateName(name)); | 9732 String& private_name = String::Handle(zone, PrivateName(name)); |
| 9718 obj = LookupLocalObject(private_name); | 9733 obj = LookupLocalObject(private_name); |
| 9719 } | 9734 } |
| 9720 return obj.raw(); | 9735 return obj.raw(); |
| 9721 } | 9736 } |
| 9722 | 9737 |
| 9723 | 9738 |
| 9724 RawObject* Library::LookupObjectAllowPrivate(const String& name) const { | 9739 RawObject* Library::LookupObjectAllowPrivate(const String& name) const { |
| 9725 // First check if name is found in the local scope of the library. | 9740 // First check if name is found in the local scope of the library. |
| 9726 Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); | 9741 Object& obj = Object::Handle(LookupLocalObjectAllowPrivate(name)); |
| 9727 if (!obj.IsNull()) { | 9742 if (!obj.IsNull()) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9806 if (obj.IsClass()) { | 9821 if (obj.IsClass()) { |
| 9807 return Class::Cast(obj).raw(); | 9822 return Class::Cast(obj).raw(); |
| 9808 } | 9823 } |
| 9809 return Class::null(); | 9824 return Class::null(); |
| 9810 } | 9825 } |
| 9811 | 9826 |
| 9812 | 9827 |
| 9813 RawClass* Library::LookupClassAllowPrivate(const String& name) const { | 9828 RawClass* Library::LookupClassAllowPrivate(const String& name) const { |
| 9814 // See if the class is available in this library or in the top level | 9829 // See if the class is available in this library or in the top level |
| 9815 // scope of any imported library. | 9830 // scope of any imported library. |
| 9816 Isolate* isolate = Isolate::Current(); | 9831 Zone* zone = Thread::Current()->zone(); |
| 9817 const Class& cls = Class::Handle(isolate, LookupClass(name)); | 9832 const Class& cls = Class::Handle(zone, LookupClass(name)); |
| 9818 if (!cls.IsNull()) { | 9833 if (!cls.IsNull()) { |
| 9819 return cls.raw(); | 9834 return cls.raw(); |
| 9820 } | 9835 } |
| 9821 | 9836 |
| 9822 // Now try to lookup the class using its private name, but only in | 9837 // Now try to lookup the class using its private name, but only in |
| 9823 // this library (not in imported libraries). | 9838 // this library (not in imported libraries). |
| 9824 if (ShouldBePrivate(name)) { | 9839 if (ShouldBePrivate(name)) { |
| 9825 String& private_name = String::Handle(isolate, PrivateName(name)); | 9840 String& private_name = String::Handle(zone, PrivateName(name)); |
| 9826 const Object& obj = Object::Handle(LookupLocalObject(private_name)); | 9841 const Object& obj = Object::Handle(LookupLocalObject(private_name)); |
| 9827 if (obj.IsClass()) { | 9842 if (obj.IsClass()) { |
| 9828 return Class::Cast(obj).raw(); | 9843 return Class::Cast(obj).raw(); |
| 9829 } | 9844 } |
| 9830 } | 9845 } |
| 9831 return Class::null(); | 9846 return Class::null(); |
| 9832 } | 9847 } |
| 9833 | 9848 |
| 9834 | 9849 |
| 9835 RawLibraryPrefix* Library::LookupLocalLibraryPrefix(const String& name) const { | 9850 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 { | 9882 RawNamespace* Library::ImportAt(intptr_t index) const { |
| 9868 if ((index < 0) || index >= num_imports()) { | 9883 if ((index < 0) || index >= num_imports()) { |
| 9869 return Namespace::null(); | 9884 return Namespace::null(); |
| 9870 } | 9885 } |
| 9871 const Array& import_list = Array::Handle(imports()); | 9886 const Array& import_list = Array::Handle(imports()); |
| 9872 return Namespace::RawCast(import_list.At(index)); | 9887 return Namespace::RawCast(import_list.At(index)); |
| 9873 } | 9888 } |
| 9874 | 9889 |
| 9875 | 9890 |
| 9876 bool Library::ImportsCorelib() const { | 9891 bool Library::ImportsCorelib() const { |
| 9877 Isolate* isolate = Isolate::Current(); | 9892 Zone* zone = Thread::Current()->zone(); |
| 9878 Library& imported = Library::Handle(isolate); | 9893 Library& imported = Library::Handle(zone); |
| 9879 intptr_t count = num_imports(); | 9894 intptr_t count = num_imports(); |
| 9880 for (int i = 0; i < count; i++) { | 9895 for (int i = 0; i < count; i++) { |
| 9881 imported = ImportLibraryAt(i); | 9896 imported = ImportLibraryAt(i); |
| 9882 if (imported.IsCoreLibrary()) { | 9897 if (imported.IsCoreLibrary()) { |
| 9883 return true; | 9898 return true; |
| 9884 } | 9899 } |
| 9885 } | 9900 } |
| 9886 LibraryPrefix& prefix = LibraryPrefix::Handle(isolate); | 9901 LibraryPrefix& prefix = LibraryPrefix::Handle(zone); |
| 9887 LibraryPrefixIterator it(*this); | 9902 LibraryPrefixIterator it(*this); |
| 9888 while (it.HasNext()) { | 9903 while (it.HasNext()) { |
| 9889 prefix = it.GetNext(); | 9904 prefix = it.GetNext(); |
| 9890 count = prefix.num_imports(); | 9905 count = prefix.num_imports(); |
| 9891 for (int i = 0; i < count; i++) { | 9906 for (int i = 0; i < count; i++) { |
| 9892 imported = prefix.GetLibrary(i); | 9907 imported = prefix.GetLibrary(i); |
| 9893 if (imported.IsCoreLibrary()) { | 9908 if (imported.IsCoreLibrary()) { |
| 9894 return true; | 9909 return true; |
| 9895 } | 9910 } |
| 9896 } | 9911 } |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10074 fld_cnt); | 10089 fld_cnt); |
| 10075 cls_name = Symbols::New(name_buffer); | 10090 cls_name = Symbols::New(name_buffer); |
| 10076 Class::NewNativeWrapper(native_flds_lib, cls_name, fld_cnt); | 10091 Class::NewNativeWrapper(native_flds_lib, cls_name, fld_cnt); |
| 10077 } | 10092 } |
| 10078 native_flds_lib.SetLoaded(); | 10093 native_flds_lib.SetLoaded(); |
| 10079 } | 10094 } |
| 10080 | 10095 |
| 10081 | 10096 |
| 10082 // Returns library with given url in current isolate, or NULL. | 10097 // Returns library with given url in current isolate, or NULL. |
| 10083 RawLibrary* Library::LookupLibrary(const String &url) { | 10098 RawLibrary* Library::LookupLibrary(const String &url) { |
| 10084 Isolate* isolate = Isolate::Current(); | 10099 Thread* thread = Thread::Current(); |
| 10085 Library& lib = Library::Handle(isolate, Library::null()); | 10100 Zone* zone = thread->zone(); |
| 10086 String& lib_url = String::Handle(isolate, String::null()); | 10101 Isolate* isolate = thread->isolate(); |
| 10102 Library& lib = Library::Handle(zone, Library::null()); | |
| 10103 String& lib_url = String::Handle(zone, String::null()); | |
| 10087 GrowableObjectArray& libs = GrowableObjectArray::Handle( | 10104 GrowableObjectArray& libs = GrowableObjectArray::Handle( |
| 10088 isolate, isolate->object_store()->libraries()); | 10105 zone, isolate->object_store()->libraries()); |
| 10089 for (int i = 0; i < libs.Length(); i++) { | 10106 for (int i = 0; i < libs.Length(); i++) { |
| 10090 lib ^= libs.At(i); | 10107 lib ^= libs.At(i); |
| 10091 lib_url ^= lib.url(); | 10108 lib_url ^= lib.url(); |
| 10092 if (lib_url.Equals(url)) { | 10109 if (lib_url.Equals(url)) { |
| 10093 return lib.raw(); | 10110 return lib.raw(); |
| 10094 } | 10111 } |
| 10095 } | 10112 } |
| 10096 return Library::null(); | 10113 return Library::null(); |
| 10097 } | 10114 } |
| 10098 | 10115 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10407 import ^= imports.At(index); | 10424 import ^= imports.At(index); |
| 10408 return import.library(); | 10425 return import.library(); |
| 10409 } | 10426 } |
| 10410 return Library::null(); | 10427 return Library::null(); |
| 10411 } | 10428 } |
| 10412 | 10429 |
| 10413 | 10430 |
| 10414 RawInstance* LibraryPrefix::LoadError() const { | 10431 RawInstance* LibraryPrefix::LoadError() const { |
| 10415 Thread* thread = Thread::Current(); | 10432 Thread* thread = Thread::Current(); |
| 10416 Isolate* isolate = thread->isolate(); | 10433 Isolate* isolate = thread->isolate(); |
| 10434 Zone* zone = thread->zone(); | |
| 10417 ObjectStore* object_store = isolate->object_store(); | 10435 ObjectStore* object_store = isolate->object_store(); |
| 10418 GrowableObjectArray& libs = | 10436 GrowableObjectArray& libs = |
| 10419 GrowableObjectArray::Handle(isolate, object_store->libraries()); | 10437 GrowableObjectArray::Handle(zone, object_store->libraries()); |
| 10420 ASSERT(!libs.IsNull()); | 10438 ASSERT(!libs.IsNull()); |
| 10421 LibraryLoadErrorSet set(HashTables::New<LibraryLoadErrorSet>(libs.Length())); | 10439 LibraryLoadErrorSet set(HashTables::New<LibraryLoadErrorSet>(libs.Length())); |
| 10422 object_store->set_library_load_error_table(set.Release()); | 10440 object_store->set_library_load_error_table(set.Release()); |
| 10423 Library& lib = Library::Handle(isolate); | 10441 Library& lib = Library::Handle(zone); |
| 10424 Instance& error = Instance::Handle(isolate); | 10442 Instance& error = Instance::Handle(zone); |
| 10425 for (int32_t i = 0; i < num_imports(); i++) { | 10443 for (int32_t i = 0; i < num_imports(); i++) { |
| 10426 lib = GetLibrary(i); | 10444 lib = GetLibrary(i); |
| 10427 ASSERT(!lib.IsNull()); | 10445 ASSERT(!lib.IsNull()); |
| 10428 HANDLESCOPE(thread); | 10446 HANDLESCOPE(thread); |
| 10429 error = lib.TransitiveLoadError(); | 10447 error = lib.TransitiveLoadError(); |
| 10430 if (!error.IsNull()) { | 10448 if (!error.IsNull()) { |
| 10431 break; | 10449 break; |
| 10432 } | 10450 } |
| 10433 } | 10451 } |
| 10434 object_store->set_library_load_error_table(Object::empty_array()); | 10452 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 | 10561 // loading. Once all outstanding load requests have completed, the embedder |
| 10544 // will call the core library to: | 10562 // will call the core library to: |
| 10545 // - invalidate dependent code of this prefix; | 10563 // - invalidate dependent code of this prefix; |
| 10546 // - mark this prefixes as loaded; | 10564 // - mark this prefixes as loaded; |
| 10547 // - complete the future associated with this prefix. | 10565 // - complete the future associated with this prefix. |
| 10548 const Library& deferred_lib = Library::Handle(GetLibrary(0)); | 10566 const Library& deferred_lib = Library::Handle(GetLibrary(0)); |
| 10549 if (deferred_lib.Loaded()) { | 10567 if (deferred_lib.Loaded()) { |
| 10550 this->set_is_loaded(); | 10568 this->set_is_loaded(); |
| 10551 return true; | 10569 return true; |
| 10552 } else if (deferred_lib.LoadNotStarted()) { | 10570 } else if (deferred_lib.LoadNotStarted()) { |
| 10553 Isolate* isolate = Isolate::Current(); | 10571 Thread* thread = Thread::Current(); |
| 10572 Isolate* isolate = thread->isolate(); | |
| 10554 Api::Scope api_scope(isolate); | 10573 Api::Scope api_scope(isolate); |
| 10574 Zone* zone = thread->zone(); | |
| 10555 deferred_lib.SetLoadRequested(); | 10575 deferred_lib.SetLoadRequested(); |
| 10556 const GrowableObjectArray& pending_deferred_loads = | 10576 const GrowableObjectArray& pending_deferred_loads = |
| 10557 GrowableObjectArray::Handle( | 10577 GrowableObjectArray::Handle( |
| 10558 isolate->object_store()->pending_deferred_loads()); | 10578 isolate->object_store()->pending_deferred_loads()); |
| 10559 pending_deferred_loads.Add(deferred_lib); | 10579 pending_deferred_loads.Add(deferred_lib); |
| 10560 const String& lib_url = String::Handle(isolate, deferred_lib.url()); | 10580 const String& lib_url = String::Handle(zone, deferred_lib.url()); |
| 10561 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); | 10581 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); |
| 10562 handler(Dart_kImportTag, | 10582 handler(Dart_kImportTag, |
| 10563 Api::NewHandle(isolate, importer()), | 10583 Api::NewHandle(isolate, importer()), |
| 10564 Api::NewHandle(isolate, lib_url.raw())); | 10584 Api::NewHandle(isolate, lib_url.raw())); |
| 10565 } else { | 10585 } else { |
| 10566 // Another load request is in flight. | 10586 // Another load request is in flight. |
| 10567 ASSERT(deferred_lib.LoadRequested()); | 10587 ASSERT(deferred_lib.LoadRequested()); |
| 10568 } | 10588 } |
| 10569 return false; // Load request not yet completed. | 10589 return false; // Load request not yet completed. |
| 10570 } | 10590 } |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10783 return true; | 10803 return true; |
| 10784 } | 10804 } |
| 10785 // The name is not filtered out. | 10805 // The name is not filtered out. |
| 10786 return false; | 10806 return false; |
| 10787 } | 10807 } |
| 10788 | 10808 |
| 10789 | 10809 |
| 10790 // Look up object with given name in library and filter out hidden | 10810 // Look up object with given name in library and filter out hidden |
| 10791 // names. Also look up getters and setters. | 10811 // names. Also look up getters and setters. |
| 10792 RawObject* Namespace::Lookup(const String& name) const { | 10812 RawObject* Namespace::Lookup(const String& name) const { |
| 10793 Isolate* isolate = Isolate::Current(); | 10813 Zone* zone = Thread::Current()->zone(); |
| 10794 const Library& lib = Library::Handle(isolate, library()); | 10814 const Library& lib = Library::Handle(zone, library()); |
| 10795 intptr_t ignore = 0; | 10815 intptr_t ignore = 0; |
| 10796 | 10816 |
| 10797 // Lookup the name in the library's symbols. | 10817 // Lookup the name in the library's symbols. |
| 10798 Object& obj = Object::Handle(isolate, lib.LookupEntry(name, &ignore)); | 10818 Object& obj = Object::Handle(zone, lib.LookupEntry(name, &ignore)); |
| 10799 if (!Field::IsGetterName(name) && | 10819 if (!Field::IsGetterName(name) && |
| 10800 !Field::IsSetterName(name) && | 10820 !Field::IsSetterName(name) && |
| 10801 (obj.IsNull() || obj.IsLibraryPrefix())) { | 10821 (obj.IsNull() || obj.IsLibraryPrefix())) { |
| 10802 const String& getter_name = String::Handle(Field::LookupGetterSymbol(name)); | 10822 const String& getter_name = String::Handle(Field::LookupGetterSymbol(name)); |
| 10803 if (!getter_name.IsNull()) { | 10823 if (!getter_name.IsNull()) { |
| 10804 obj = lib.LookupEntry(getter_name, &ignore); | 10824 obj = lib.LookupEntry(getter_name, &ignore); |
| 10805 } | 10825 } |
| 10806 if (obj.IsNull()) { | 10826 if (obj.IsNull()) { |
| 10807 const String& setter_name = | 10827 const String& setter_name = |
| 10808 String::Handle(Field::LookupSetterSymbol(name)); | 10828 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, | 14583 bool Instance::IsInstanceOf(const AbstractType& other, |
| 14564 const TypeArguments& other_instantiator, | 14584 const TypeArguments& other_instantiator, |
| 14565 Error* bound_error) const { | 14585 Error* bound_error) const { |
| 14566 ASSERT(other.IsFinalized()); | 14586 ASSERT(other.IsFinalized()); |
| 14567 ASSERT(!other.IsDynamicType()); | 14587 ASSERT(!other.IsDynamicType()); |
| 14568 ASSERT(!other.IsMalformed()); | 14588 ASSERT(!other.IsMalformed()); |
| 14569 ASSERT(!other.IsMalbounded()); | 14589 ASSERT(!other.IsMalbounded()); |
| 14570 if (other.IsVoidType()) { | 14590 if (other.IsVoidType()) { |
| 14571 return false; | 14591 return false; |
| 14572 } | 14592 } |
| 14573 Isolate* isolate = Isolate::Current(); | 14593 Zone* zone = Thread::Current()->zone(); |
| 14574 const Class& cls = Class::Handle(isolate, clazz()); | 14594 const Class& cls = Class::Handle(zone, clazz()); |
| 14575 TypeArguments& type_arguments = TypeArguments::Handle(isolate); | 14595 TypeArguments& type_arguments = TypeArguments::Handle(zone); |
| 14576 if (cls.NumTypeArguments() > 0) { | 14596 if (cls.NumTypeArguments() > 0) { |
| 14577 type_arguments = GetTypeArguments(); | 14597 type_arguments = GetTypeArguments(); |
| 14578 ASSERT(type_arguments.IsNull() || type_arguments.IsCanonical()); | 14598 ASSERT(type_arguments.IsNull() || type_arguments.IsCanonical()); |
| 14579 // The number of type arguments in the instance must be greater or equal to | 14599 // 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. | 14600 // the number of type arguments expected by the instance class. |
| 14581 // A discrepancy is allowed for closures, which borrow the type argument | 14601 // 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 | 14602 // 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 | 14603 // defining the closure. Truncating the vector to the correct length on |
| 14584 // instantiation is unnecessary. The vector may therefore be longer. | 14604 // instantiation is unnecessary. The vector may therefore be longer. |
| 14585 // Also, an optimization reuses the type argument vector of the instantiator | 14605 // Also, an optimization reuses the type argument vector of the instantiator |
| 14586 // of generic instances when its layout is compatible. | 14606 // of generic instances when its layout is compatible. |
| 14587 ASSERT(type_arguments.IsNull() || | 14607 ASSERT(type_arguments.IsNull() || |
| 14588 (type_arguments.Length() >= cls.NumTypeArguments())); | 14608 (type_arguments.Length() >= cls.NumTypeArguments())); |
| 14589 } | 14609 } |
| 14590 Class& other_class = Class::Handle(isolate); | 14610 Class& other_class = Class::Handle(zone); |
| 14591 TypeArguments& other_type_arguments = TypeArguments::Handle(isolate); | 14611 TypeArguments& other_type_arguments = TypeArguments::Handle(zone); |
| 14592 // Note that we may encounter a bound error in checked mode. | 14612 // Note that we may encounter a bound error in checked mode. |
| 14593 if (!other.IsInstantiated()) { | 14613 if (!other.IsInstantiated()) { |
| 14594 const AbstractType& instantiated_other = AbstractType::Handle( | 14614 const AbstractType& instantiated_other = AbstractType::Handle( |
| 14595 isolate, other.InstantiateFrom(other_instantiator, bound_error)); | 14615 zone, other.InstantiateFrom(other_instantiator, bound_error)); |
| 14596 if ((bound_error != NULL) && !bound_error->IsNull()) { | 14616 if ((bound_error != NULL) && !bound_error->IsNull()) { |
| 14597 ASSERT(Isolate::Current()->flags().type_checks()); | 14617 ASSERT(Isolate::Current()->flags().type_checks()); |
| 14598 return false; | 14618 return false; |
| 14599 } | 14619 } |
| 14600 other_class = instantiated_other.type_class(); | 14620 other_class = instantiated_other.type_class(); |
| 14601 other_type_arguments = instantiated_other.arguments(); | 14621 other_type_arguments = instantiated_other.arguments(); |
| 14602 } else { | 14622 } else { |
| 14603 other_class = other.type_class(); | 14623 other_class = other.type_class(); |
| 14604 other_type_arguments = other.arguments(); | 14624 other_type_arguments = other.arguments(); |
| 14605 } | 14625 } |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15772 return clone.raw(); | 15792 return clone.raw(); |
| 15773 } | 15793 } |
| 15774 | 15794 |
| 15775 | 15795 |
| 15776 RawAbstractType* Type::Canonicalize(TrailPtr trail) const { | 15796 RawAbstractType* Type::Canonicalize(TrailPtr trail) const { |
| 15777 ASSERT(IsFinalized()); | 15797 ASSERT(IsFinalized()); |
| 15778 if (IsCanonical() || IsMalformed()) { | 15798 if (IsCanonical() || IsMalformed()) { |
| 15779 ASSERT(IsMalformed() || TypeArguments::Handle(arguments()).IsOld()); | 15799 ASSERT(IsMalformed() || TypeArguments::Handle(arguments()).IsOld()); |
| 15780 return this->raw(); | 15800 return this->raw(); |
| 15781 } | 15801 } |
| 15782 Isolate* isolate = Isolate::Current(); | 15802 Thread* thread = Thread::Current(); |
| 15783 Type& type = Type::Handle(isolate); | 15803 Zone* zone = thread->zone(); |
| 15784 const Class& cls = Class::Handle(isolate, type_class()); | 15804 Isolate* isolate = thread->isolate(); |
| 15805 Type& type = Type::Handle(zone); | |
| 15806 const Class& cls = Class::Handle(zone, type_class()); | |
| 15785 if (cls.raw() == Object::dynamic_class() && (isolate != Dart::vm_isolate())) { | 15807 if (cls.raw() == Object::dynamic_class() && (isolate != Dart::vm_isolate())) { |
| 15786 return Object::dynamic_type(); | 15808 return Object::dynamic_type(); |
| 15787 } | 15809 } |
| 15788 // Fast canonical lookup/registry for simple types. | 15810 // Fast canonical lookup/registry for simple types. |
| 15789 if (cls.NumTypeArguments() == 0) { | 15811 if (cls.NumTypeArguments() == 0) { |
| 15790 type = cls.CanonicalType(); | 15812 type = cls.CanonicalType(); |
| 15791 if (type.IsNull()) { | 15813 if (type.IsNull()) { |
| 15792 ASSERT(!cls.raw()->IsVMHeapObject() || (isolate == Dart::vm_isolate())); | 15814 ASSERT(!cls.raw()->IsVMHeapObject() || (isolate == Dart::vm_isolate())); |
| 15793 cls.set_canonical_types(*this); | 15815 cls.set_canonical_types(*this); |
| 15794 SetCanonical(); | 15816 SetCanonical(); |
| 15795 return this->raw(); | 15817 return this->raw(); |
| 15796 } | 15818 } |
| 15797 ASSERT(this->Equals(type)); | 15819 ASSERT(this->Equals(type)); |
| 15798 ASSERT(type.IsCanonical()); | 15820 ASSERT(type.IsCanonical()); |
| 15799 return type.raw(); | 15821 return type.raw(); |
| 15800 } | 15822 } |
| 15801 | 15823 |
| 15802 Array& canonical_types = Array::Handle(isolate); | 15824 Array& canonical_types = Array::Handle(zone); |
| 15803 canonical_types ^= cls.canonical_types(); | 15825 canonical_types ^= cls.canonical_types(); |
| 15804 if (canonical_types.IsNull()) { | 15826 if (canonical_types.IsNull()) { |
| 15805 canonical_types = empty_array().raw(); | 15827 canonical_types = empty_array().raw(); |
| 15806 } | 15828 } |
| 15807 intptr_t length = canonical_types.Length(); | 15829 intptr_t length = canonical_types.Length(); |
| 15808 // Linear search to see whether this type is already present in the | 15830 // Linear search to see whether this type is already present in the |
| 15809 // list of canonicalized types. | 15831 // list of canonicalized types. |
| 15810 // TODO(asiva): Try to re-factor this lookup code to make sharing | 15832 // TODO(asiva): Try to re-factor this lookup code to make sharing |
| 15811 // easy between the 4 versions of this loop. | 15833 // easy between the 4 versions of this loop. |
| 15812 intptr_t index = 1; // Slot 0 is reserved for CanonicalType(). | 15834 intptr_t index = 1; // Slot 0 is reserved for CanonicalType(). |
| 15813 while (index < length) { | 15835 while (index < length) { |
| 15814 type ^= canonical_types.At(index); | 15836 type ^= canonical_types.At(index); |
| 15815 if (type.IsNull()) { | 15837 if (type.IsNull()) { |
| 15816 break; | 15838 break; |
| 15817 } | 15839 } |
| 15818 ASSERT(type.IsFinalized()); | 15840 ASSERT(type.IsFinalized()); |
| 15819 if (this->Equals(type)) { | 15841 if (this->Equals(type)) { |
| 15820 ASSERT(type.IsCanonical()); | 15842 ASSERT(type.IsCanonical()); |
| 15821 return type.raw(); | 15843 return type.raw(); |
| 15822 } | 15844 } |
| 15823 index++; | 15845 index++; |
| 15824 } | 15846 } |
| 15825 // The type was not found in the table. It is not canonical yet. | 15847 // The type was not found in the table. It is not canonical yet. |
| 15826 | 15848 |
| 15827 // Canonicalize the type arguments. | 15849 // Canonicalize the type arguments. |
| 15828 TypeArguments& type_args = TypeArguments::Handle(isolate, arguments()); | 15850 TypeArguments& type_args = TypeArguments::Handle(zone, arguments()); |
| 15829 // In case the type is first canonicalized at runtime, its type argument | 15851 // In case the type is first canonicalized at runtime, its type argument |
| 15830 // vector may be longer than necessary. This is not an issue. | 15852 // vector may be longer than necessary. This is not an issue. |
| 15831 ASSERT(type_args.IsNull() || (type_args.Length() >= cls.NumTypeArguments())); | 15853 ASSERT(type_args.IsNull() || (type_args.Length() >= cls.NumTypeArguments())); |
| 15832 type_args = type_args.Canonicalize(trail); | 15854 type_args = type_args.Canonicalize(trail); |
| 15833 set_arguments(type_args); | 15855 set_arguments(type_args); |
| 15834 | 15856 |
| 15835 // Canonicalizing the type arguments may have changed the index, may have | 15857 // Canonicalizing the type arguments may have changed the index, may have |
| 15836 // grown the table, or may even have canonicalized this type. | 15858 // grown the table, or may even have canonicalized this type. |
| 15837 canonical_types ^= cls.canonical_types(); | 15859 canonical_types ^= cls.canonical_types(); |
| 15838 if (canonical_types.IsNull()) { | 15860 if (canonical_types.IsNull()) { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 15852 index++; | 15874 index++; |
| 15853 } | 15875 } |
| 15854 | 15876 |
| 15855 // The type needs to be added to the list. Grow the list if it is full. | 15877 // The type needs to be added to the list. Grow the list if it is full. |
| 15856 if (index >= length) { | 15878 if (index >= length) { |
| 15857 ASSERT((index == length) || ((index == 1) && (length == 0))); | 15879 ASSERT((index == length) || ((index == 1) && (length == 0))); |
| 15858 const intptr_t new_length = (length > 64) ? | 15880 const intptr_t new_length = (length > 64) ? |
| 15859 (length + 64) : | 15881 (length + 64) : |
| 15860 ((length == 0) ? 2 : (length * 2)); | 15882 ((length == 0) ? 2 : (length * 2)); |
| 15861 const Array& new_canonical_types = Array::Handle( | 15883 const Array& new_canonical_types = Array::Handle( |
| 15862 isolate, Array::Grow(canonical_types, new_length, Heap::kOld)); | 15884 zone, Array::Grow(canonical_types, new_length, Heap::kOld)); |
| 15863 cls.set_canonical_types(new_canonical_types); | 15885 cls.set_canonical_types(new_canonical_types); |
| 15864 canonical_types = new_canonical_types.raw(); | 15886 canonical_types = new_canonical_types.raw(); |
| 15865 } | 15887 } |
| 15866 canonical_types.SetAt(index, *this); | 15888 canonical_types.SetAt(index, *this); |
| 15867 if ((index == 1) && cls.IsCanonicalSignatureClass()) { | 15889 if ((index == 1) && cls.IsCanonicalSignatureClass()) { |
| 15868 canonical_types.SetAt(0, *this); // Also set canonical signature type at 0. | 15890 canonical_types.SetAt(0, *this); // Also set canonical signature type at 0. |
| 15869 #ifdef DEBUG | 15891 #ifdef DEBUG |
| 15870 // Verify that the first canonical type is the signature type by checking | 15892 // 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 | 15893 // that the type argument vector of the canonical type ends with the |
| 15872 // uninstantiated type parameters of the signature class. Note that these | 15894 // uninstantiated type parameters of the signature class. Note that these |
| 15873 // type parameters may be bounded if the super class of the owner class | 15895 // type parameters may be bounded if the super class of the owner class |
| 15874 // declares bounds. | 15896 // declares bounds. |
| 15875 // The signature type is finalized during class finalization, before the | 15897 // The signature type is finalized during class finalization, before the |
| 15876 // optimizer may canonicalize instantiated function types of the same | 15898 // optimizer may canonicalize instantiated function types of the same |
| 15877 // signature class. | 15899 // signature class. |
| 15878 // Although the signature class extends class Instance, the type arguments | 15900 // 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 | 15901 // of the super class of the owner class of its signature function will be |
| 15880 // prepended to the type argument vector during class finalization. | 15902 // prepended to the type argument vector during class finalization. |
| 15881 const TypeArguments& type_params = | 15903 const TypeArguments& type_params = |
| 15882 TypeArguments::Handle(isolate, cls.type_parameters()); | 15904 TypeArguments::Handle(zone, cls.type_parameters()); |
| 15883 const intptr_t num_type_params = cls.NumTypeParameters(); | 15905 const intptr_t num_type_params = cls.NumTypeParameters(); |
| 15884 const intptr_t num_type_args = cls.NumTypeArguments(); | 15906 const intptr_t num_type_args = cls.NumTypeArguments(); |
| 15885 AbstractType& type_arg = AbstractType::Handle(isolate); | 15907 AbstractType& type_arg = AbstractType::Handle(zone); |
| 15886 TypeParameter& type_param = TypeParameter::Handle(isolate); | 15908 TypeParameter& type_param = TypeParameter::Handle(zone); |
| 15887 for (intptr_t i = 0; i < num_type_params; i++) { | 15909 for (intptr_t i = 0; i < num_type_params; i++) { |
| 15888 type_arg = type_args.TypeAt(num_type_args - num_type_params + i); | 15910 type_arg = type_args.TypeAt(num_type_args - num_type_params + i); |
| 15889 while (type_arg.IsBoundedType()) { | 15911 while (type_arg.IsBoundedType()) { |
| 15890 type_arg = BoundedType::Cast(type_arg).type(); | 15912 type_arg = BoundedType::Cast(type_arg).type(); |
| 15891 } | 15913 } |
| 15892 type_param ^= type_params.TypeAt(i); | 15914 type_param ^= type_params.TypeAt(i); |
| 15893 ASSERT(type_arg.Equals(type_param)); | 15915 ASSERT(type_arg.Equals(type_param)); |
| 15894 } | 15916 } |
| 15895 #endif | 15917 #endif |
| 15896 } | 15918 } |
| (...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 17520 ASSERT(!digits_.IsNull()); | 17542 ASSERT(!digits_.IsNull()); |
| 17521 set_digits(digits_); | 17543 set_digits(digits_); |
| 17522 } else { | 17544 } else { |
| 17523 ASSERT(digits() == TypedData::EmptyUint32Array(Isolate::Current())); | 17545 ASSERT(digits() == TypedData::EmptyUint32Array(Isolate::Current())); |
| 17524 } | 17546 } |
| 17525 return true; | 17547 return true; |
| 17526 } | 17548 } |
| 17527 | 17549 |
| 17528 | 17550 |
| 17529 RawBigint* Bigint::New(Heap::Space space) { | 17551 RawBigint* Bigint::New(Heap::Space space) { |
| 17530 Isolate* isolate = Isolate::Current(); | 17552 Thread* thread = Thread::Current(); |
| 17553 Zone* zone = thread->zone(); | |
| 17554 Isolate* isolate = thread->isolate(); | |
| 17531 ASSERT(isolate->object_store()->bigint_class() != Class::null()); | 17555 ASSERT(isolate->object_store()->bigint_class() != Class::null()); |
| 17532 Bigint& result = Bigint::Handle(isolate); | 17556 Bigint& result = Bigint::Handle(zone); |
| 17533 { | 17557 { |
| 17534 RawObject* raw = Object::Allocate(Bigint::kClassId, | 17558 RawObject* raw = Object::Allocate(Bigint::kClassId, |
| 17535 Bigint::InstanceSize(), | 17559 Bigint::InstanceSize(), |
| 17536 space); | 17560 space); |
| 17537 NoSafepointScope no_safepoint; | 17561 NoSafepointScope no_safepoint; |
| 17538 result ^= raw; | 17562 result ^= raw; |
| 17539 } | 17563 } |
| 17540 result.SetNeg(false); | 17564 result.SetNeg(false); |
| 17541 result.SetUsed(0); | 17565 result.SetUsed(0); |
| 17542 result.set_digits( | 17566 result.set_digits( |
| 17543 TypedData::Handle(isolate, TypedData::EmptyUint32Array(isolate))); | 17567 TypedData::Handle(zone, TypedData::EmptyUint32Array(isolate))); |
| 17544 return result.raw(); | 17568 return result.raw(); |
| 17545 } | 17569 } |
| 17546 | 17570 |
| 17547 | 17571 |
| 17548 RawBigint* Bigint::New(bool neg, intptr_t used, const TypedData& digits, | 17572 RawBigint* Bigint::New(bool neg, intptr_t used, const TypedData& digits, |
| 17549 Heap::Space space) { | 17573 Heap::Space space) { |
| 17550 ASSERT((used == 0) || | 17574 ASSERT((used == 0) || |
| 17551 (!digits.IsNull() && (digits.Length() >= (used + (used & 1))))); | 17575 (!digits.IsNull() && (digits.Length() >= (used + (used & 1))))); |
| 17552 Isolate* isolate = Isolate::Current(); | 17576 Thread* thread = Thread::Current(); |
| 17577 Zone* zone = thread->zone(); | |
| 17578 Isolate* isolate = thread->isolate(); | |
| 17553 ASSERT(isolate->object_store()->bigint_class() != Class::null()); | 17579 ASSERT(isolate->object_store()->bigint_class() != Class::null()); |
| 17554 Bigint& result = Bigint::Handle(isolate); | 17580 Bigint& result = Bigint::Handle(zone); |
| 17555 { | 17581 { |
| 17556 RawObject* raw = Object::Allocate(Bigint::kClassId, | 17582 RawObject* raw = Object::Allocate(Bigint::kClassId, |
| 17557 Bigint::InstanceSize(), | 17583 Bigint::InstanceSize(), |
| 17558 space); | 17584 space); |
| 17559 NoSafepointScope no_safepoint; | 17585 NoSafepointScope no_safepoint; |
| 17560 result ^= raw; | 17586 result ^= raw; |
| 17561 } | 17587 } |
| 17562 // Clamp the digits array. | 17588 // Clamp the digits array. |
| 17563 while ((used > 0) && (digits.GetUint32((used - 1) << 2) == 0)) { | 17589 while ((used > 0) && (digits.GetUint32((used - 1) << 2) == 0)) { |
| 17564 --used; | 17590 --used; |
| 17565 } | 17591 } |
| 17566 if (used > 0) { | 17592 if (used > 0) { |
| 17567 if ((used & 1) != 0) { | 17593 if ((used & 1) != 0) { |
| 17568 // Set leading zero for 64-bit processing of digit pairs. | 17594 // Set leading zero for 64-bit processing of digit pairs. |
| 17569 digits.SetUint32(used << 2, 0); | 17595 digits.SetUint32(used << 2, 0); |
| 17570 } | 17596 } |
| 17571 result.set_digits(digits); | 17597 result.set_digits(digits); |
| 17572 } else { | 17598 } else { |
| 17573 neg = false; | 17599 neg = false; |
| 17574 result.set_digits( | 17600 result.set_digits( |
| 17575 TypedData::Handle(isolate, TypedData::EmptyUint32Array(isolate))); | 17601 TypedData::Handle(zone, TypedData::EmptyUint32Array(isolate))); |
| 17576 } | 17602 } |
| 17577 result.SetNeg(neg); | 17603 result.SetNeg(neg); |
| 17578 result.SetUsed(used); | 17604 result.SetUsed(used); |
| 17579 return result.raw(); | 17605 return result.raw(); |
| 17580 } | 17606 } |
| 17581 | 17607 |
| 17582 | 17608 |
| 17583 RawBigint* Bigint::NewFromInt64(int64_t value, Heap::Space space) { | 17609 RawBigint* Bigint::NewFromInt64(int64_t value, Heap::Space space) { |
| 17584 const TypedData& digits = TypedData::Handle(NewDigits(2, space)); | 17610 const TypedData& digits = TypedData::Handle(NewDigits(2, space)); |
| 17585 bool neg; | 17611 bool neg; |
| (...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20050 element = At(index); | 20076 element = At(index); |
| 20051 jsarr.AddValue(element); | 20077 jsarr.AddValue(element); |
| 20052 } | 20078 } |
| 20053 } | 20079 } |
| 20054 } | 20080 } |
| 20055 | 20081 |
| 20056 | 20082 |
| 20057 RawArray* Array::Grow(const Array& source, | 20083 RawArray* Array::Grow(const Array& source, |
| 20058 intptr_t new_length, | 20084 intptr_t new_length, |
| 20059 Heap::Space space) { | 20085 Heap::Space space) { |
| 20060 Isolate* isolate = Isolate::Current(); | 20086 Zone* zone = Thread::Current()->zone(); |
| 20061 const Array& result = Array::Handle(isolate, Array::New(new_length, space)); | 20087 const Array& result = Array::Handle(zone, Array::New(new_length, space)); |
| 20062 intptr_t len = 0; | 20088 intptr_t len = 0; |
| 20063 if (!source.IsNull()) { | 20089 if (!source.IsNull()) { |
| 20064 len = source.Length(); | 20090 len = source.Length(); |
| 20065 result.SetTypeArguments( | 20091 result.SetTypeArguments( |
| 20066 TypeArguments::Handle(isolate, source.GetTypeArguments())); | 20092 TypeArguments::Handle(zone, source.GetTypeArguments())); |
| 20067 } | 20093 } |
| 20068 ASSERT(new_length >= len); // Cannot copy 'source' into new array. | 20094 ASSERT(new_length >= len); // Cannot copy 'source' into new array. |
| 20069 ASSERT(new_length != len); // Unnecessary copying of array. | 20095 ASSERT(new_length != len); // Unnecessary copying of array. |
| 20070 PassiveObject& obj = PassiveObject::Handle(isolate); | 20096 PassiveObject& obj = PassiveObject::Handle(zone); |
| 20071 for (int i = 0; i < len; i++) { | 20097 for (int i = 0; i < len; i++) { |
| 20072 obj = source.At(i); | 20098 obj = source.At(i); |
| 20073 result.SetAt(i, obj); | 20099 result.SetAt(i, obj); |
| 20074 } | 20100 } |
| 20075 return result.raw(); | 20101 return result.raw(); |
| 20076 } | 20102 } |
| 20077 | 20103 |
| 20078 | 20104 |
| 20079 RawArray* Array::MakeArray(const GrowableObjectArray& growable_array) { | 20105 RawArray* Array::MakeArray(const GrowableObjectArray& growable_array) { |
| 20080 ASSERT(!growable_array.IsNull()); | 20106 ASSERT(!growable_array.IsNull()); |
| 20081 intptr_t used_len = growable_array.Length(); | 20107 intptr_t used_len = growable_array.Length(); |
| 20082 // Get the type arguments and prepare to copy them. | 20108 // Get the type arguments and prepare to copy them. |
| 20083 const TypeArguments& type_arguments = | 20109 const TypeArguments& type_arguments = |
| 20084 TypeArguments::Handle(growable_array.GetTypeArguments()); | 20110 TypeArguments::Handle(growable_array.GetTypeArguments()); |
| 20085 if ((used_len == 0) && (type_arguments.IsNull())) { | 20111 if ((used_len == 0) && (type_arguments.IsNull())) { |
| 20086 // This is a raw List (as in no type arguments), so we can return the | 20112 // This is a raw List (as in no type arguments), so we can return the |
| 20087 // simple empty array. | 20113 // simple empty array. |
| 20088 return Object::empty_array().raw(); | 20114 return Object::empty_array().raw(); |
| 20089 } | 20115 } |
| 20090 intptr_t capacity_len = growable_array.Capacity(); | 20116 intptr_t capacity_len = growable_array.Capacity(); |
| 20091 Isolate* isolate = Isolate::Current(); | 20117 Zone* zone = Thread::Current()->zone(); |
| 20092 const Array& array = Array::Handle(isolate, growable_array.data()); | 20118 const Array& array = Array::Handle(zone, growable_array.data()); |
| 20093 array.SetTypeArguments(type_arguments); | 20119 array.SetTypeArguments(type_arguments); |
| 20094 intptr_t capacity_size = Array::InstanceSize(capacity_len); | 20120 intptr_t capacity_size = Array::InstanceSize(capacity_len); |
| 20095 intptr_t used_size = Array::InstanceSize(used_len); | 20121 intptr_t used_size = Array::InstanceSize(used_len); |
| 20096 NoSafepointScope no_safepoint; | 20122 NoSafepointScope no_safepoint; |
| 20097 | 20123 |
| 20098 // If there is any left over space fill it with either an Array object or | 20124 // 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 | 20125 // just a plain object (depending on the amount of left over space) so |
| 20100 // that it can be traversed over successfully during garbage collection. | 20126 // that it can be traversed over successfully during garbage collection. |
| 20101 Object::MakeUnusedSpaceTraversable(array, capacity_size, used_size); | 20127 Object::MakeUnusedSpaceTraversable(array, capacity_size, used_size); |
| 20102 | 20128 |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20758 } | 20784 } |
| 20759 | 20785 |
| 20760 | 20786 |
| 20761 RawTypedData* TypedData::EmptyUint32Array(Isolate* isolate) { | 20787 RawTypedData* TypedData::EmptyUint32Array(Isolate* isolate) { |
| 20762 ASSERT(isolate != NULL); | 20788 ASSERT(isolate != NULL); |
| 20763 ASSERT(isolate->object_store() != NULL); | 20789 ASSERT(isolate->object_store() != NULL); |
| 20764 if (isolate->object_store()->empty_uint32_array() != TypedData::null()) { | 20790 if (isolate->object_store()->empty_uint32_array() != TypedData::null()) { |
| 20765 // Already created. | 20791 // Already created. |
| 20766 return isolate->object_store()->empty_uint32_array(); | 20792 return isolate->object_store()->empty_uint32_array(); |
| 20767 } | 20793 } |
| 20768 const TypedData& array = TypedData::Handle(isolate, | 20794 const TypedData& array = TypedData::Handle(isolate->current_zone(), |
| 20769 TypedData::New(kTypedDataUint32ArrayCid, 0, Heap::kOld)); | 20795 TypedData::New(kTypedDataUint32ArrayCid, 0, Heap::kOld)); |
| 20770 isolate->object_store()->set_empty_uint32_array(array); | 20796 isolate->object_store()->set_empty_uint32_array(array); |
| 20771 return array.raw(); | 20797 return array.raw(); |
| 20772 } | 20798 } |
| 20773 | 20799 |
| 20774 | 20800 |
| 20775 const char* TypedData::ToCString() const { | 20801 const char* TypedData::ToCString() const { |
| 20776 return "TypedData"; | 20802 return "TypedData"; |
| 20777 } | 20803 } |
| 20778 | 20804 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20870 | 20896 |
| 20871 void Capability::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20897 void Capability::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20872 Instance::PrintJSONImpl(stream, ref); | 20898 Instance::PrintJSONImpl(stream, ref); |
| 20873 } | 20899 } |
| 20874 | 20900 |
| 20875 | 20901 |
| 20876 RawReceivePort* ReceivePort::New(Dart_Port id, | 20902 RawReceivePort* ReceivePort::New(Dart_Port id, |
| 20877 bool is_control_port, | 20903 bool is_control_port, |
| 20878 Heap::Space space) { | 20904 Heap::Space space) { |
| 20879 ASSERT(id != ILLEGAL_PORT); | 20905 ASSERT(id != ILLEGAL_PORT); |
| 20880 Isolate* isolate = Isolate::Current(); | 20906 Thread* thread = Thread::Current(); |
| 20907 Zone* zone = thread->zone(); | |
| 20881 const SendPort& send_port = | 20908 const SendPort& send_port = |
| 20882 SendPort::Handle(isolate, SendPort::New(id, isolate->origin_id())); | 20909 SendPort::Handle(zone, SendPort::New(id, thread->isolate()->origin_id())); |
| 20883 | 20910 |
| 20884 ReceivePort& result = ReceivePort::Handle(isolate); | 20911 ReceivePort& result = ReceivePort::Handle(zone); |
| 20885 { | 20912 { |
| 20886 RawObject* raw = Object::Allocate(ReceivePort::kClassId, | 20913 RawObject* raw = Object::Allocate(ReceivePort::kClassId, |
| 20887 ReceivePort::InstanceSize(), | 20914 ReceivePort::InstanceSize(), |
| 20888 space); | 20915 space); |
| 20889 NoSafepointScope no_safepoint; | 20916 NoSafepointScope no_safepoint; |
| 20890 result ^= raw; | 20917 result ^= raw; |
| 20891 result.StorePointer(&result.raw_ptr()->send_port_, send_port.raw()); | 20918 result.StorePointer(&result.raw_ptr()->send_port_, send_port.raw()); |
| 20892 } | 20919 } |
| 20893 if (is_control_port) { | 20920 if (is_control_port) { |
| 20894 PortMap::SetPortState(id, PortMap::kControlPort); | 20921 PortMap::SetPortState(id, PortMap::kControlPort); |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 21429 NoSafepointScope no_safepoint; | 21456 NoSafepointScope no_safepoint; |
| 21430 result ^= raw; | 21457 result ^= raw; |
| 21431 } | 21458 } |
| 21432 result.set_label(label); | 21459 result.set_label(label); |
| 21433 AddTagToIsolate(isolate, result); | 21460 AddTagToIsolate(isolate, result); |
| 21434 return result.raw(); | 21461 return result.raw(); |
| 21435 } | 21462 } |
| 21436 | 21463 |
| 21437 | 21464 |
| 21438 RawUserTag* UserTag::DefaultTag() { | 21465 RawUserTag* UserTag::DefaultTag() { |
| 21439 Isolate* isolate = Isolate::Current(); | 21466 Thread* thread = Thread::Current(); |
| 21467 Zone* zone = thread->zone(); | |
| 21468 Isolate* isolate = thread->isolate(); | |
| 21440 ASSERT(isolate != NULL); | 21469 ASSERT(isolate != NULL); |
| 21441 if (isolate->default_tag() != UserTag::null()) { | 21470 if (isolate->default_tag() != UserTag::null()) { |
| 21442 // Already created. | 21471 // Already created. |
| 21443 return isolate->default_tag(); | 21472 return isolate->default_tag(); |
| 21444 } | 21473 } |
| 21445 // Create default tag. | 21474 // Create default tag. |
| 21446 const UserTag& result = UserTag::Handle(isolate, | 21475 const UserTag& result = UserTag::Handle(zone, |
| 21447 UserTag::New(Symbols::Default())); | 21476 UserTag::New(Symbols::Default())); |
| 21448 ASSERT(result.tag() == UserTags::kDefaultUserTag); | 21477 ASSERT(result.tag() == UserTags::kDefaultUserTag); |
| 21449 isolate->set_default_tag(result); | 21478 isolate->set_default_tag(result); |
| 21450 return result.raw(); | 21479 return result.raw(); |
| 21451 } | 21480 } |
| 21452 | 21481 |
| 21453 | 21482 |
| 21454 RawUserTag* UserTag::FindTagInIsolate(Isolate* isolate, const String& label) { | 21483 RawUserTag* UserTag::FindTagInIsolate(Isolate* isolate, const String& label) { |
| 21455 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); | 21484 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); |
| 21456 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( | 21485 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( |
| 21457 isolate, isolate->tag_table()); | 21486 isolate->current_zone(), isolate->tag_table()); |
| 21458 UserTag& other = UserTag::Handle(isolate); | 21487 UserTag& other = UserTag::Handle(isolate->current_zone()); |
| 21459 String& tag_label = String::Handle(isolate); | 21488 String& tag_label = String::Handle(isolate->current_zone()); |
| 21460 for (intptr_t i = 0; i < tag_table.Length(); i++) { | 21489 for (intptr_t i = 0; i < tag_table.Length(); i++) { |
| 21461 other ^= tag_table.At(i); | 21490 other ^= tag_table.At(i); |
| 21462 ASSERT(!other.IsNull()); | 21491 ASSERT(!other.IsNull()); |
| 21463 tag_label ^= other.label(); | 21492 tag_label ^= other.label(); |
| 21464 ASSERT(!tag_label.IsNull()); | 21493 ASSERT(!tag_label.IsNull()); |
| 21465 if (tag_label.Equals(label)) { | 21494 if (tag_label.Equals(label)) { |
| 21466 return other.raw(); | 21495 return other.raw(); |
| 21467 } | 21496 } |
| 21468 } | 21497 } |
| 21469 return UserTag::null(); | 21498 return UserTag::null(); |
| 21470 } | 21499 } |
| 21471 | 21500 |
| 21472 | 21501 |
| 21473 void UserTag::AddTagToIsolate(Isolate* isolate, const UserTag& tag) { | 21502 void UserTag::AddTagToIsolate(Isolate* isolate, const UserTag& tag) { |
| 21474 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); | 21503 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); |
| 21475 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( | 21504 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( |
| 21476 isolate, isolate->tag_table()); | 21505 isolate->current_zone(), isolate->tag_table()); |
| 21477 ASSERT(!TagTableIsFull(isolate)); | 21506 ASSERT(!TagTableIsFull(isolate)); |
| 21478 #if defined(DEBUG) | 21507 #if defined(DEBUG) |
| 21479 // Verify that no existing tag has the same tag id. | 21508 // Verify that no existing tag has the same tag id. |
| 21480 UserTag& other = UserTag::Handle(isolate); | 21509 UserTag& other = UserTag::Handle(isolate->current_zone()); |
| 21481 for (intptr_t i = 0; i < tag_table.Length(); i++) { | 21510 for (intptr_t i = 0; i < tag_table.Length(); i++) { |
| 21482 other ^= tag_table.At(i); | 21511 other ^= tag_table.At(i); |
| 21483 ASSERT(!other.IsNull()); | 21512 ASSERT(!other.IsNull()); |
| 21484 ASSERT(tag.tag() != other.tag()); | 21513 ASSERT(tag.tag() != other.tag()); |
| 21485 } | 21514 } |
| 21486 #endif | 21515 #endif |
| 21487 // Generate the UserTag tag id by taking the length of the isolate's | 21516 // Generate the UserTag tag id by taking the length of the isolate's |
| 21488 // tag table + kUserTagIdOffset. | 21517 // tag table + kUserTagIdOffset. |
| 21489 uword tag_id = tag_table.Length() + UserTags::kUserTagIdOffset; | 21518 uword tag_id = tag_table.Length() + UserTags::kUserTagIdOffset; |
| 21490 ASSERT(tag_id >= UserTags::kUserTagIdOffset); | 21519 ASSERT(tag_id >= UserTags::kUserTagIdOffset); |
| 21491 ASSERT(tag_id < (UserTags::kUserTagIdOffset + UserTags::kMaxUserTags)); | 21520 ASSERT(tag_id < (UserTags::kUserTagIdOffset + UserTags::kMaxUserTags)); |
| 21492 tag.set_tag(tag_id); | 21521 tag.set_tag(tag_id); |
| 21493 tag_table.Add(tag); | 21522 tag_table.Add(tag); |
| 21494 } | 21523 } |
| 21495 | 21524 |
| 21496 | 21525 |
| 21497 bool UserTag::TagTableIsFull(Isolate* isolate) { | 21526 bool UserTag::TagTableIsFull(Isolate* isolate) { |
| 21498 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); | 21527 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); |
| 21499 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( | 21528 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( |
| 21500 isolate, isolate->tag_table()); | 21529 isolate->current_zone(), isolate->tag_table()); |
| 21501 ASSERT(tag_table.Length() <= UserTags::kMaxUserTags); | 21530 ASSERT(tag_table.Length() <= UserTags::kMaxUserTags); |
| 21502 return tag_table.Length() == UserTags::kMaxUserTags; | 21531 return tag_table.Length() == UserTags::kMaxUserTags; |
| 21503 } | 21532 } |
| 21504 | 21533 |
| 21505 | 21534 |
| 21506 RawUserTag* UserTag::FindTagById(uword tag_id) { | 21535 RawUserTag* UserTag::FindTagById(uword tag_id) { |
| 21507 Isolate* isolate = Isolate::Current(); | 21536 Thread* thread = Thread::Current(); |
| 21537 Zone* zone = thread->zone(); | |
| 21538 Isolate* isolate = thread->isolate(); | |
| 21508 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); | 21539 ASSERT(isolate->tag_table() != GrowableObjectArray::null()); |
| 21509 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( | 21540 const GrowableObjectArray& tag_table = GrowableObjectArray::Handle( |
| 21510 isolate, isolate->tag_table()); | 21541 zone, isolate->tag_table()); |
| 21511 UserTag& tag = UserTag::Handle(isolate); | 21542 UserTag& tag = UserTag::Handle(zone); |
| 21512 for (intptr_t i = 0; i < tag_table.Length(); i++) { | 21543 for (intptr_t i = 0; i < tag_table.Length(); i++) { |
| 21513 tag ^= tag_table.At(i); | 21544 tag ^= tag_table.At(i); |
| 21514 if (tag.tag() == tag_id) { | 21545 if (tag.tag() == tag_id) { |
| 21515 return tag.raw(); | 21546 return tag.raw(); |
| 21516 } | 21547 } |
| 21517 } | 21548 } |
| 21518 return UserTag::null(); | 21549 return UserTag::null(); |
| 21519 } | 21550 } |
| 21520 | 21551 |
| 21521 | 21552 |
| 21522 const char* UserTag::ToCString() const { | 21553 const char* UserTag::ToCString() const { |
| 21523 const String& tag_label = String::Handle(label()); | 21554 const String& tag_label = String::Handle(label()); |
| 21524 return tag_label.ToCString(); | 21555 return tag_label.ToCString(); |
| 21525 } | 21556 } |
| 21526 | 21557 |
| 21527 | 21558 |
| 21528 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21559 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21529 Instance::PrintJSONImpl(stream, ref); | 21560 Instance::PrintJSONImpl(stream, ref); |
| 21530 } | 21561 } |
| 21531 | 21562 |
| 21532 | 21563 |
| 21533 } // namespace dart | 21564 } // namespace dart |
| OLD | NEW |