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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 ASSERT(!code.IsNull()); | 76 ASSERT(!code.IsNull()); |
77 return entrypoint( | 77 return entrypoint( |
78 code.EntryPoint(), | 78 code.EntryPoint(), |
79 ArgumentsDescriptor(arguments.length(), optional_arguments_names), | 79 ArgumentsDescriptor(arguments.length(), optional_arguments_names), |
80 arguments.data(), | 80 arguments.data(), |
81 context); | 81 context); |
82 } | 82 } |
83 | 83 |
84 | 84 |
85 RawObject* DartEntry::InvokeClosure( | 85 RawObject* DartEntry::InvokeClosure( |
86 const Closure& closure, | 86 const Instance& closure, |
87 const GrowableArray<const Object*>& arguments, | 87 const GrowableArray<const Object*>& arguments, |
88 const Array& optional_arguments_names) { | 88 const Array& optional_arguments_names) { |
89 // Get the entrypoint corresponding to the closure specified, this | 89 // Get the entrypoint corresponding to the closure specified, this |
90 // will result in a compilation of the closure if it is not already | 90 // will result in a compilation of the closure if it is not already |
91 // compiled. | 91 // compiled. |
92 ASSERT(Class::Handle(closure.clazz()).signature_function() != Object::null()); | 92 ASSERT(Class::Handle(closure.clazz()).signature_function() != Object::null()); |
93 const Function& function = Function::Handle(closure.function()); | 93 const Function& function = Function::Handle(Closure::function(closure)); |
94 const Context& context = Context::Handle(closure.context()); | 94 const Context& context = Context::Handle(Closure::context(closure)); |
95 ASSERT(!function.IsNull()); | 95 ASSERT(!function.IsNull()); |
96 if (!function.HasCode()) { | 96 if (!function.HasCode()) { |
97 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 97 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
98 if (!error.IsNull()) { | 98 if (!error.IsNull()) { |
99 return error.raw(); | 99 return error.raw(); |
100 } | 100 } |
101 } | 101 } |
102 // Now Call the invoke stub which will invoke the closure. | 102 // Now Call the invoke stub which will invoke the closure. |
103 invokestub entrypoint = reinterpret_cast<invokestub>( | 103 invokestub entrypoint = reinterpret_cast<invokestub>( |
104 StubCode::InvokeDartCodeEntryPoint()); | 104 StubCode::InvokeDartCodeEntryPoint()); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 const String& func_name = String::Handle(Field::GetterName(field_name)); | 315 const String& func_name = String::Handle(Field::GetterName(field_name)); |
316 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); | 316 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); |
317 ASSERT(!func.IsNull()); | 317 ASSERT(!func.IsNull()); |
318 GrowableArray<const Object*> arguments; | 318 GrowableArray<const Object*> arguments; |
319 const Array& kNoArgumentNames = Array::Handle(); | 319 const Array& kNoArgumentNames = Array::Handle(); |
320 return DartEntry::InvokeDynamic(port, func, arguments, kNoArgumentNames); | 320 return DartEntry::InvokeDynamic(port, func, arguments, kNoArgumentNames); |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 } // namespace dart | 324 } // namespace dart |
OLD | NEW |