OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/dart_entry.h" | 5 #include "vm/dart_entry.h" |
6 | 6 |
7 #include "vm/code_generator.h" | 7 #include "vm/code_generator.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/longjump.h" | 9 #include "vm/longjump.h" |
10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 | 118 |
119 RawInstance* DartLibraryCalls::ExceptionCreate( | 119 RawInstance* DartLibraryCalls::ExceptionCreate( |
120 const String& class_name, | 120 const String& class_name, |
121 const GrowableArray<const Object*>& arguments) { | 121 const GrowableArray<const Object*>& arguments) { |
122 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 122 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
123 const Class& cls = Class::Handle(core_lib.LookupClass(class_name)); | 123 const Class& cls = Class::Handle(core_lib.LookupClass(class_name)); |
124 ASSERT(!cls.IsNull()); | 124 ASSERT(!cls.IsNull()); |
125 // For now, we only support a non-parameterized or raw type. | 125 // For now, we only support a non-parameterized or raw type. |
126 const Instance& exception_object = Instance::Handle(Instance::New(cls)); | 126 const Instance& exception_object = Instance::Handle(Instance::New(cls)); |
127 GrowableArray<const Object*> constructor_arguments(arguments.length() + 1); | 127 GrowableArray<const Object*> constructor_arguments(arguments.length() + 2); |
128 constructor_arguments.Add(&exception_object); | 128 constructor_arguments.Add(&exception_object); |
| 129 constructor_arguments.Add(&Smi::Handle(Smi::New(Function::kCtorPhaseAll))); |
129 constructor_arguments.AddArray(arguments); | 130 constructor_arguments.AddArray(arguments); |
130 | 131 |
131 const String& period = String::Handle(String::New(".")); | 132 const String& period = String::Handle(String::New(".")); |
132 String& constructor_name = String::Handle(String::Concat(class_name, period)); | 133 String& constructor_name = String::Handle(String::Concat(class_name, period)); |
133 Function& constructor = | 134 Function& constructor = |
134 Function::Handle(cls.LookupConstructor(constructor_name)); | 135 Function::Handle(cls.LookupConstructor(constructor_name)); |
135 ASSERT(!constructor.IsNull()); | 136 ASSERT(!constructor.IsNull()); |
136 const Array& kNoArgumentNames = Array::Handle(); | 137 const Array& kNoArgumentNames = Array::Handle(); |
137 DartEntry::InvokeStatic(constructor, constructor_arguments, kNoArgumentNames); | 138 DartEntry::InvokeStatic(constructor, constructor_arguments, kNoArgumentNames); |
138 return exception_object.raw(); | 139 return exception_object.raw(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 kNumNamedArguments)); | 180 kNumNamedArguments)); |
180 ASSERT(!function.IsNull()); | 181 ASSERT(!function.IsNull()); |
181 const Instance& result = Instance::Handle( | 182 const Instance& result = Instance::Handle( |
182 DartEntry::InvokeDynamic(left, function, arguments, kNoArgumentNames)); | 183 DartEntry::InvokeDynamic(left, function, arguments, kNoArgumentNames)); |
183 // Object's '==' threw an exception, let the caller handle it. | 184 // Object's '==' threw an exception, let the caller handle it. |
184 ASSERT(result.IsBool() || result.IsUnhandledException()); | 185 ASSERT(result.IsBool() || result.IsUnhandledException()); |
185 return result.raw(); | 186 return result.raw(); |
186 } | 187 } |
187 | 188 |
188 } // namespace dart | 189 } // namespace dart |
OLD | NEW |