| 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/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 3595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3606 RETURN_TYPE_ERROR(Z, type, Type); | 3606 RETURN_TYPE_ERROR(Z, type, Type); |
| 3607 } | 3607 } |
| 3608 Type& type_obj = Type::Handle(); | 3608 Type& type_obj = Type::Handle(); |
| 3609 type_obj ^= unchecked_type.raw(); | 3609 type_obj ^= unchecked_type.raw(); |
| 3610 if (!type_obj.IsFinalized()) { | 3610 if (!type_obj.IsFinalized()) { |
| 3611 return Api::NewError( | 3611 return Api::NewError( |
| 3612 "%s expects argument 'type' to be a fully resolved type.", | 3612 "%s expects argument 'type' to be a fully resolved type.", |
| 3613 CURRENT_FUNC); | 3613 CURRENT_FUNC); |
| 3614 } | 3614 } |
| 3615 Class& cls = Class::Handle(Z, type_obj.type_class()); | 3615 Class& cls = Class::Handle(Z, type_obj.type_class()); |
| 3616 #if defined(DEBUG) | |
| 3617 if (!cls.is_allocated() && Dart::IsRunningPrecompiledCode()) { | |
| 3618 return Api::NewError("Precompilation dropped '%s'", cls.ToCString()); | |
| 3619 } | |
| 3620 #endif | |
| 3621 TypeArguments& type_arguments = | 3616 TypeArguments& type_arguments = |
| 3622 TypeArguments::Handle(Z, type_obj.arguments()); | 3617 TypeArguments::Handle(Z, type_obj.arguments()); |
| 3623 | 3618 |
| 3624 const String& base_constructor_name = String::Handle(Z, cls.Name()); | 3619 const String& base_constructor_name = String::Handle(Z, cls.Name()); |
| 3625 | 3620 |
| 3626 // And get the name of the constructor to invoke. | 3621 // And get the name of the constructor to invoke. |
| 3627 String& dot_name = String::Handle(Z); | 3622 String& dot_name = String::Handle(Z); |
| 3628 result = Api::UnwrapHandle(constructor_name); | 3623 result = Api::UnwrapHandle(constructor_name); |
| 3629 if (result.IsNull()) { | 3624 if (result.IsNull()) { |
| 3630 dot_name = Symbols::Dot().raw(); | 3625 dot_name = Symbols::Dot().raw(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3670 } | 3665 } |
| 3671 redirect_type ^= redirect_type.Canonicalize(); | 3666 redirect_type ^= redirect_type.Canonicalize(); |
| 3672 } | 3667 } |
| 3673 | 3668 |
| 3674 type_obj = redirect_type.raw(); | 3669 type_obj = redirect_type.raw(); |
| 3675 type_arguments = redirect_type.arguments(); | 3670 type_arguments = redirect_type.arguments(); |
| 3676 | 3671 |
| 3677 cls = type_obj.type_class(); | 3672 cls = type_obj.type_class(); |
| 3678 } | 3673 } |
| 3679 if (constructor.IsGenerativeConstructor()) { | 3674 if (constructor.IsGenerativeConstructor()) { |
| 3675 #if defined(DEBUG) |
| 3676 if (!cls.is_allocated() && Dart::IsRunningPrecompiledCode()) { |
| 3677 return Api::NewError("Precompilation dropped '%s'", cls.ToCString()); |
| 3678 } |
| 3679 #endif |
| 3680 // Create the new object. | 3680 // Create the new object. |
| 3681 new_object = Instance::New(cls); | 3681 new_object = Instance::New(cls); |
| 3682 } | 3682 } |
| 3683 | 3683 |
| 3684 // Create the argument list. | 3684 // Create the argument list. |
| 3685 intptr_t arg_index = 0; | 3685 intptr_t arg_index = 0; |
| 3686 int extra_args = (constructor.IsGenerativeConstructor() ? 2 : 1); | 3686 int extra_args = (constructor.IsGenerativeConstructor() ? 2 : 1); |
| 3687 const Array& args = | 3687 const Array& args = |
| 3688 Array::Handle(Z, Array::New(number_of_arguments + extra_args)); | 3688 Array::Handle(Z, Array::New(number_of_arguments + extra_args)); |
| 3689 if (constructor.IsGenerativeConstructor()) { | 3689 if (constructor.IsGenerativeConstructor()) { |
| (...skipping 2228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5918 ApiReallocate); | 5918 ApiReallocate); |
| 5919 writer.WriteFullSnapshot(); | 5919 writer.WriteFullSnapshot(); |
| 5920 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 5920 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
| 5921 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 5921 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
| 5922 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); | 5922 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); |
| 5923 | 5923 |
| 5924 return Api::Success(); | 5924 return Api::Success(); |
| 5925 } | 5925 } |
| 5926 | 5926 |
| 5927 } // namespace dart | 5927 } // namespace dart |
| OLD | NEW |