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/object_store.h" | 9 #include "vm/object_store.h" |
10 #include "vm/resolver.h" | 10 #include "vm/resolver.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return entrypoint( | 109 return entrypoint( |
110 code.EntryPoint(), | 110 code.EntryPoint(), |
111 CodeGenerator::ArgumentsDescriptor(arguments.length(), | 111 CodeGenerator::ArgumentsDescriptor(arguments.length(), |
112 optional_arguments_names), | 112 optional_arguments_names), |
113 arguments.data(), | 113 arguments.data(), |
114 context); | 114 context); |
115 } | 115 } |
116 | 116 |
117 | 117 |
118 RawObject* DartLibraryCalls::ExceptionCreate( | 118 RawObject* DartLibraryCalls::ExceptionCreate( |
| 119 const Library& lib, |
119 const String& class_name, | 120 const String& class_name, |
120 const GrowableArray<const Object*>& arguments) { | 121 const GrowableArray<const Object*>& arguments) { |
121 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 122 const Class& cls = Class::Handle(lib.LookupClass(class_name)); |
122 const Class& cls = Class::Handle(core_lib.LookupClass(class_name)); | |
123 ASSERT(!cls.IsNull()); | 123 ASSERT(!cls.IsNull()); |
124 // For now, we only support a non-parameterized or raw type. | 124 // For now, we only support a non-parameterized or raw type. |
125 const Instance& exception_object = Instance::Handle(Instance::New(cls)); | 125 const Instance& exception_object = Instance::Handle(Instance::New(cls)); |
126 GrowableArray<const Object*> constructor_arguments(arguments.length() + 2); | 126 GrowableArray<const Object*> constructor_arguments(arguments.length() + 2); |
127 constructor_arguments.Add(&exception_object); | 127 constructor_arguments.Add(&exception_object); |
128 constructor_arguments.Add(&Smi::Handle(Smi::New(Function::kCtorPhaseAll))); | 128 constructor_arguments.Add(&Smi::Handle(Smi::New(Function::kCtorPhaseAll))); |
129 constructor_arguments.AddArray(arguments); | 129 constructor_arguments.AddArray(arguments); |
130 | 130 |
131 const String& period = String::Handle(String::New(".")); | 131 const String& period = String::Handle(String::New(".")); |
132 String& constructor_name = String::Handle(String::Concat(class_name, period)); | 132 String& constructor_name = String::Handle(String::Concat(class_name, period)); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 arguments.Add(&Integer::Handle(Integer::New(dest_port_id))); | 214 arguments.Add(&Integer::Handle(Integer::New(dest_port_id))); |
215 arguments.Add(&Integer::Handle(Integer::New(reply_port_id))); | 215 arguments.Add(&Integer::Handle(Integer::New(reply_port_id))); |
216 arguments.Add(&message); | 216 arguments.Add(&message); |
217 const Object& result = Object::Handle( | 217 const Object& result = Object::Handle( |
218 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); | 218 DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); |
219 ASSERT(result.IsNull() || result.IsError()); | 219 ASSERT(result.IsNull() || result.IsError()); |
220 return result.raw(); | 220 return result.raw(); |
221 } | 221 } |
222 | 222 |
223 } // namespace dart | 223 } // namespace dart |
OLD | NEW |