| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 2937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2948 DARTSCOPE(isolate); | 2948 DARTSCOPE(isolate); |
| 2949 CHECK_CALLBACK_STATE(isolate); | 2949 CHECK_CALLBACK_STATE(isolate); |
| 2950 | 2950 |
| 2951 const Type& type_obj = Api::UnwrapTypeHandle(isolate, type); | 2951 const Type& type_obj = Api::UnwrapTypeHandle(isolate, type); |
| 2952 // Get the class to instantiate. | 2952 // Get the class to instantiate. |
| 2953 if (type_obj.IsNull()) { | 2953 if (type_obj.IsNull()) { |
| 2954 RETURN_TYPE_ERROR(isolate, type, Type); | 2954 RETURN_TYPE_ERROR(isolate, type, Type); |
| 2955 } | 2955 } |
| 2956 const Class& cls = Class::Handle(isolate, type_obj.type_class()); | 2956 const Class& cls = Class::Handle(isolate, type_obj.type_class()); |
| 2957 | 2957 |
| 2958 // Mark all fields as nullable. |
| 2959 Class& iterate_cls = Class::Handle(isolate, cls.raw()); |
| 2960 Field& field = Field::Handle(isolate); |
| 2961 Array& fields = Array::Handle(isolate); |
| 2962 while (!iterate_cls.IsNull()) { |
| 2963 fields = iterate_cls.fields(); |
| 2964 iterate_cls = iterate_cls.SuperClass(); |
| 2965 for (int field_num = 0; field_num < fields.Length(); field_num++) { |
| 2966 field ^= fields.At(field_num); |
| 2967 if (field.is_static()) { |
| 2968 continue; |
| 2969 } |
| 2970 field.UpdateGuardedCidAndLength(Object::null_object()); |
| 2971 } |
| 2972 } |
| 2958 // Allocate an object for the given class. | 2973 // Allocate an object for the given class. |
| 2959 return Api::NewHandle(isolate, Instance::New(cls)); | 2974 return Api::NewHandle(isolate, Instance::New(cls)); |
| 2960 } | 2975 } |
| 2961 | 2976 |
| 2962 | 2977 |
| 2963 static Dart_Handle SetupArguments(Isolate* isolate, | 2978 static Dart_Handle SetupArguments(Isolate* isolate, |
| 2964 int num_args, | 2979 int num_args, |
| 2965 Dart_Handle* arguments, | 2980 Dart_Handle* arguments, |
| 2966 int extra_args, | 2981 int extra_args, |
| 2967 Array* args) { | 2982 Array* args) { |
| (...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4423 } | 4438 } |
| 4424 { | 4439 { |
| 4425 NoGCScope no_gc; | 4440 NoGCScope no_gc; |
| 4426 RawObject* raw_obj = obj.raw(); | 4441 RawObject* raw_obj = obj.raw(); |
| 4427 isolate->heap()->SetPeer(raw_obj, peer); | 4442 isolate->heap()->SetPeer(raw_obj, peer); |
| 4428 } | 4443 } |
| 4429 return Api::Success(); | 4444 return Api::Success(); |
| 4430 } | 4445 } |
| 4431 | 4446 |
| 4432 } // namespace dart | 4447 } // namespace dart |
| OLD | NEW |