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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 99 } |
100 } | 100 } |
101 // Set up arguments to include the closure as the first argument. | 101 // Set up arguments to include the closure as the first argument. |
102 const int num_arguments = arguments.length() + 1; | 102 const int num_arguments = arguments.length() + 1; |
103 GrowableArray<const Object*> args(num_arguments); | 103 GrowableArray<const Object*> args(num_arguments); |
104 const Object& arg0 = Object::ZoneHandle(closure.raw()); | 104 const Object& arg0 = Object::ZoneHandle(closure.raw()); |
105 args.Add(&arg0); | 105 args.Add(&arg0); |
106 for (int i = 1; i < num_arguments; i++) { | 106 for (int i = 1; i < num_arguments; i++) { |
107 args.Add(arguments[i - 1]); | 107 args.Add(arguments[i - 1]); |
108 } | 108 } |
109 // Now Call the invoke stub which will invoke the closure. | 109 // Now call the invoke stub which will invoke the closure. |
110 invokestub entrypoint = reinterpret_cast<invokestub>( | 110 invokestub entrypoint = reinterpret_cast<invokestub>( |
111 StubCode::InvokeDartCodeEntryPoint()); | 111 StubCode::InvokeDartCodeEntryPoint()); |
112 ASSERT(context.isolate() == Isolate::Current()); | 112 ASSERT(context.isolate() == Isolate::Current()); |
113 const Code& code = Code::Handle(function.CurrentCode()); | 113 const Code& code = Code::Handle(function.CurrentCode()); |
114 ASSERT(!code.IsNull()); | 114 ASSERT(!code.IsNull()); |
115 const Array& arg_descriptor = | 115 const Array& arg_descriptor = |
116 Array::Handle(ArgumentsDescriptor::New(num_arguments, | 116 Array::Handle(ArgumentsDescriptor::New(num_arguments, |
117 optional_arguments_names)); | 117 optional_arguments_names)); |
118 return entrypoint(code.EntryPoint(), arg_descriptor, args.data(), context); | 118 return entrypoint(code.EntryPoint(), arg_descriptor, args.data(), context); |
119 } | 119 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 const String& func_name = String::Handle(Field::GetterName(field_name)); | 360 const String& func_name = String::Handle(Field::GetterName(field_name)); |
361 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); | 361 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); |
362 ASSERT(!func.IsNull()); | 362 ASSERT(!func.IsNull()); |
363 GrowableArray<const Object*> arguments; | 363 GrowableArray<const Object*> arguments; |
364 const Array& kNoArgumentNames = Array::Handle(); | 364 const Array& kNoArgumentNames = Array::Handle(); |
365 return DartEntry::InvokeDynamic(port, func, arguments, kNoArgumentNames); | 365 return DartEntry::InvokeDynamic(port, func, arguments, kNoArgumentNames); |
366 } | 366 } |
367 | 367 |
368 | 368 |
369 } // namespace dart | 369 } // namespace dart |
OLD | NEW |