| 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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 | 882 |
| 883 cls = Class::New<WeakProperty>(); | 883 cls = Class::New<WeakProperty>(); |
| 884 object_store->set_weak_property_class(cls); | 884 object_store->set_weak_property_class(cls); |
| 885 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib); | 885 RegisterPrivateClass(cls, Symbols::_WeakProperty(), core_lib); |
| 886 | 886 |
| 887 // Setup some default native field classes which can be extended for | 887 // Setup some default native field classes which can be extended for |
| 888 // specifying native fields in dart classes. | 888 // specifying native fields in dart classes. |
| 889 Library::InitNativeWrappersLibrary(isolate); | 889 Library::InitNativeWrappersLibrary(isolate); |
| 890 ASSERT(isolate->object_store()->native_wrappers_library() != Library::null()); | 890 ASSERT(isolate->object_store()->native_wrappers_library() != Library::null()); |
| 891 | 891 |
| 892 // Pre-register the typeddata library so the native class implementations | 892 // Pre-register the typed_data library so the native class implementations |
| 893 // can be hooked up before compiling it. | 893 // can be hooked up before compiling it. |
| 894 LOAD_LIBRARY(TypedData, typeddata); | 894 LOAD_LIBRARY(TypedData, typed_data); |
| 895 ASSERT(!lib.IsNull()); | 895 ASSERT(!lib.IsNull()); |
| 896 ASSERT(lib.raw() == Library::TypedDataLibrary()); | 896 ASSERT(lib.raw() == Library::TypedDataLibrary()); |
| 897 const intptr_t typeddata_class_array_length = | 897 const intptr_t typed_data_class_array_length = |
| 898 RawObject::NumberOfTypedDataClasses(); | 898 RawObject::NumberOfTypedDataClasses(); |
| 899 Array& typeddata_classes = | 899 Array& typed_data_classes = |
| 900 Array::Handle(Array::New(typeddata_class_array_length)); | 900 Array::Handle(Array::New(typed_data_class_array_length)); |
| 901 int index = 0; | 901 int index = 0; |
| 902 #define REGISTER_TYPED_DATA_CLASS(clazz) \ | 902 #define REGISTER_TYPED_DATA_CLASS(clazz) \ |
| 903 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); \ | 903 cls = Class::NewTypedDataClass(kTypedData##clazz##Cid); \ |
| 904 index = kTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \ | 904 index = kTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \ |
| 905 typeddata_classes.SetAt(index, cls); \ | 905 typed_data_classes.SetAt(index, cls); \ |
| 906 RegisterPrivateClass(cls, Symbols::_##clazz(), lib); \ | 906 RegisterPrivateClass(cls, Symbols::_##clazz(), lib); \ |
| 907 | 907 |
| 908 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); | 908 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS); |
| 909 #undef REGISTER_TYPED_DATA_CLASS | 909 #undef REGISTER_TYPED_DATA_CLASS |
| 910 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \ | 910 #define REGISTER_TYPED_DATA_VIEW_CLASS(clazz) \ |
| 911 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); \ | 911 cls = Class::NewTypedDataViewClass(kTypedData##clazz##ViewCid); \ |
| 912 index = kTypedData##clazz##ViewCid - kTypedDataInt8ArrayCid; \ | 912 index = kTypedData##clazz##ViewCid - kTypedDataInt8ArrayCid; \ |
| 913 typeddata_classes.SetAt(index, cls); \ | 913 typed_data_classes.SetAt(index, cls); \ |
| 914 RegisterPrivateClass(cls, Symbols::_##clazz##View(), lib); \ | 914 RegisterPrivateClass(cls, Symbols::_##clazz##View(), lib); \ |
| 915 pending_classes.Add(cls, Heap::kOld); \ | 915 pending_classes.Add(cls, Heap::kOld); \ |
| 916 | 916 |
| 917 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS); | 917 CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_VIEW_CLASS); |
| 918 cls = Class::NewTypedDataViewClass(kByteDataViewCid); | 918 cls = Class::NewTypedDataViewClass(kByteDataViewCid); |
| 919 index = kByteDataViewCid - kTypedDataInt8ArrayCid; | 919 index = kByteDataViewCid - kTypedDataInt8ArrayCid; |
| 920 typeddata_classes.SetAt(index, cls); | 920 typed_data_classes.SetAt(index, cls); |
| 921 RegisterPrivateClass(cls, Symbols::_ByteDataView(), lib); | 921 RegisterPrivateClass(cls, Symbols::_ByteDataView(), lib); |
| 922 pending_classes.Add(cls, Heap::kOld); | 922 pending_classes.Add(cls, Heap::kOld); |
| 923 #undef REGISTER_TYPED_DATA_VIEW_CLASS | 923 #undef REGISTER_TYPED_DATA_VIEW_CLASS |
| 924 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ | 924 #define REGISTER_EXT_TYPED_DATA_CLASS(clazz) \ |
| 925 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \ | 925 cls = Class::NewExternalTypedDataClass(kExternalTypedData##clazz##Cid); \ |
| 926 index = kExternalTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \ | 926 index = kExternalTypedData##clazz##Cid - kTypedDataInt8ArrayCid; \ |
| 927 typeddata_classes.SetAt(index, cls); \ | 927 typed_data_classes.SetAt(index, cls); \ |
| 928 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib); \ | 928 RegisterPrivateClass(cls, Symbols::_External##clazz(), lib); \ |
| 929 | 929 |
| 930 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); | 930 CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS); |
| 931 #undef REGISTER_EXT_TYPED_DATA_CLASS | 931 #undef REGISTER_EXT_TYPED_DATA_CLASS |
| 932 // Register Float32x4 and Uint32x4 in the object store. | 932 // Register Float32x4 and Uint32x4 in the object store. |
| 933 cls = Class::New<Float32x4>(); | 933 cls = Class::New<Float32x4>(); |
| 934 object_store->set_float32x4_class(cls); | 934 object_store->set_float32x4_class(cls); |
| 935 RegisterPrivateClass(cls, Symbols::_Float32x4(), lib); | 935 RegisterPrivateClass(cls, Symbols::_Float32x4(), lib); |
| 936 cls = Class::New<Uint32x4>(); | 936 cls = Class::New<Uint32x4>(); |
| 937 object_store->set_uint32x4_class(cls); | 937 object_store->set_uint32x4_class(cls); |
| 938 RegisterPrivateClass(cls, Symbols::_Uint32x4(), lib); | 938 RegisterPrivateClass(cls, Symbols::_Uint32x4(), lib); |
| 939 | 939 |
| 940 cls = Class::New<Instance>(Symbols::Float32x4(), script, | 940 cls = Class::New<Instance>(Symbols::Float32x4(), script, |
| 941 Scanner::kDummyTokenIndex); | 941 Scanner::kDummyTokenIndex); |
| 942 RegisterClass(cls, Symbols::Float32x4(), lib); | 942 RegisterClass(cls, Symbols::Float32x4(), lib); |
| 943 pending_classes.Add(cls, Heap::kOld); | 943 pending_classes.Add(cls, Heap::kOld); |
| 944 type = Type::NewNonParameterizedType(cls); | 944 type = Type::NewNonParameterizedType(cls); |
| 945 object_store->set_float32x4_type(type); | 945 object_store->set_float32x4_type(type); |
| 946 | 946 |
| 947 cls = Class::New<Instance>(Symbols::Uint32x4(), script, | 947 cls = Class::New<Instance>(Symbols::Uint32x4(), script, |
| 948 Scanner::kDummyTokenIndex); | 948 Scanner::kDummyTokenIndex); |
| 949 pending_classes.Add(cls, Heap::kOld); | 949 pending_classes.Add(cls, Heap::kOld); |
| 950 type = Type::NewNonParameterizedType(cls); | 950 type = Type::NewNonParameterizedType(cls); |
| 951 object_store->set_uint32x4_type(type); | 951 object_store->set_uint32x4_type(type); |
| 952 | 952 |
| 953 object_store->set_typeddata_classes(typeddata_classes); | 953 object_store->set_typed_data_classes(typed_data_classes); |
| 954 | 954 |
| 955 // Set the super type of class Stacktrace to Object type so that the | 955 // Set the super type of class Stacktrace to Object type so that the |
| 956 // 'toString' method is implemented. | 956 // 'toString' method is implemented. |
| 957 cls = object_store->stacktrace_class(); | 957 cls = object_store->stacktrace_class(); |
| 958 cls.set_super_type(type); | 958 cls.set_super_type(type); |
| 959 | 959 |
| 960 // Note: The abstract class Function is represented by VM class | 960 // Note: The abstract class Function is represented by VM class |
| 961 // DartFunction, not VM class Function. | 961 // DartFunction, not VM class Function. |
| 962 cls = Class::New<DartFunction>(); | 962 cls = Class::New<DartFunction>(); |
| 963 RegisterClass(cls, Symbols::Function(), core_lib); | 963 RegisterClass(cls, Symbols::Function(), core_lib); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 INIT_LIBRARY(Core, core, true); | 1036 INIT_LIBRARY(Core, core, true); |
| 1037 | 1037 |
| 1038 INIT_LIBRARY(Async, async, true); | 1038 INIT_LIBRARY(Async, async, true); |
| 1039 INIT_LIBRARY(Collection, collection, true); | 1039 INIT_LIBRARY(Collection, collection, true); |
| 1040 INIT_LIBRARY(CollectionDev, collection_dev, true); | 1040 INIT_LIBRARY(CollectionDev, collection_dev, true); |
| 1041 INIT_LIBRARY(Crypto, crypto, false); | 1041 INIT_LIBRARY(Crypto, crypto, false); |
| 1042 INIT_LIBRARY(Isolate, isolate, true); | 1042 INIT_LIBRARY(Isolate, isolate, true); |
| 1043 INIT_LIBRARY(Json, json, true); | 1043 INIT_LIBRARY(Json, json, true); |
| 1044 INIT_LIBRARY(Math, math, true); | 1044 INIT_LIBRARY(Math, math, true); |
| 1045 INIT_LIBRARY(Mirrors, mirrors, true); | 1045 INIT_LIBRARY(Mirrors, mirrors, true); |
| 1046 INIT_LIBRARY(TypedData, typeddata, true); | 1046 INIT_LIBRARY(TypedData, typed_data, true); |
| 1047 INIT_LIBRARY(Utf, utf, false); | 1047 INIT_LIBRARY(Utf, utf, false); |
| 1048 INIT_LIBRARY(Uri, uri, false); | 1048 INIT_LIBRARY(Uri, uri, false); |
| 1049 | 1049 |
| 1050 Bootstrap::SetupNativeResolver(); | 1050 Bootstrap::SetupNativeResolver(); |
| 1051 | 1051 |
| 1052 // Remove the Object superclass cycle by setting the super type to null (not | 1052 // Remove the Object superclass cycle by setting the super type to null (not |
| 1053 // to the type of null). | 1053 // to the type of null). |
| 1054 cls = object_store->object_class(); | 1054 cls = object_store->object_class(); |
| 1055 cls.set_super_type(Type::Handle()); | 1055 cls.set_super_type(Type::Handle()); |
| 1056 | 1056 |
| (...skipping 5553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6610 return Isolate::Current()->object_store()->mirrors_library(); | 6610 return Isolate::Current()->object_store()->mirrors_library(); |
| 6611 } | 6611 } |
| 6612 | 6612 |
| 6613 | 6613 |
| 6614 RawLibrary* Library::NativeWrappersLibrary() { | 6614 RawLibrary* Library::NativeWrappersLibrary() { |
| 6615 return Isolate::Current()->object_store()->native_wrappers_library(); | 6615 return Isolate::Current()->object_store()->native_wrappers_library(); |
| 6616 } | 6616 } |
| 6617 | 6617 |
| 6618 | 6618 |
| 6619 RawLibrary* Library::TypedDataLibrary() { | 6619 RawLibrary* Library::TypedDataLibrary() { |
| 6620 return Isolate::Current()->object_store()->typeddata_library(); | 6620 return Isolate::Current()->object_store()->typed_data_library(); |
| 6621 } | 6621 } |
| 6622 | 6622 |
| 6623 | 6623 |
| 6624 RawLibrary* Library::UriLibrary() { | 6624 RawLibrary* Library::UriLibrary() { |
| 6625 return Isolate::Current()->object_store()->uri_library(); | 6625 return Isolate::Current()->object_store()->uri_library(); |
| 6626 } | 6626 } |
| 6627 | 6627 |
| 6628 | 6628 |
| 6629 RawLibrary* Library::UtfLibrary() { | 6629 RawLibrary* Library::UtfLibrary() { |
| 6630 return Isolate::Current()->object_store()->utf_library(); | 6630 return Isolate::Current()->object_store()->utf_library(); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6900 | 6900 |
| 6901 lib = Library::CoreLibrary(); | 6901 lib = Library::CoreLibrary(); |
| 6902 CORE_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); | 6902 CORE_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
| 6903 | 6903 |
| 6904 RECOGNIZED_LIST(CHECK_FINGERPRINTS); | 6904 RECOGNIZED_LIST(CHECK_FINGERPRINTS); |
| 6905 | 6905 |
| 6906 lib = Library::MathLibrary(); | 6906 lib = Library::MathLibrary(); |
| 6907 MATH_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); | 6907 MATH_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
| 6908 | 6908 |
| 6909 lib = Library::TypedDataLibrary(); | 6909 lib = Library::TypedDataLibrary(); |
| 6910 TYPEDDATA_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); | 6910 TYPED_DATA_LIB_INTRINSIC_LIST(CHECK_FINGERPRINTS); |
| 6911 | 6911 |
| 6912 #undef CHECK_FINGERPRINTS | 6912 #undef CHECK_FINGERPRINTS |
| 6913 if (has_errors) { | 6913 if (has_errors) { |
| 6914 for (intptr_t i = 0; i < collected_fp_diffs.length(); i++) { | 6914 for (intptr_t i = 0; i < collected_fp_diffs.length(); i++) { |
| 6915 OS::Print("s/%d/%d/\n", | 6915 OS::Print("s/%d/%d/\n", |
| 6916 collected_fp_diffs[i].old_fp, collected_fp_diffs[i].new_fp); | 6916 collected_fp_diffs[i].old_fp, collected_fp_diffs[i].new_fp); |
| 6917 } | 6917 } |
| 6918 OS::Print("\n"); | 6918 OS::Print("\n"); |
| 6919 FATAL("Fingerprint mismatch."); | 6919 FATAL("Fingerprint mismatch."); |
| 6920 } | 6920 } |
| (...skipping 6212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13133 } | 13133 } |
| 13134 return result.raw(); | 13134 return result.raw(); |
| 13135 } | 13135 } |
| 13136 | 13136 |
| 13137 | 13137 |
| 13138 const char* WeakProperty::ToCString() const { | 13138 const char* WeakProperty::ToCString() const { |
| 13139 return "_WeakProperty"; | 13139 return "_WeakProperty"; |
| 13140 } | 13140 } |
| 13141 | 13141 |
| 13142 } // namespace dart | 13142 } // namespace dart |
| OLD | NEW |