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 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 // Now Call the invoke stub which will invoke the dart function. | 41 // Now Call the invoke stub which will invoke the dart function. |
42 invokestub entrypoint = reinterpret_cast<invokestub>( | 42 invokestub entrypoint = reinterpret_cast<invokestub>( |
43 StubCode::InvokeDartCodeEntryPoint()); | 43 StubCode::InvokeDartCodeEntryPoint()); |
44 const Context& context = | 44 const Context& context = |
45 Context::ZoneHandle(Isolate::Current()->object_store()->empty_context()); | 45 Context::ZoneHandle(Isolate::Current()->object_store()->empty_context()); |
46 ASSERT(context.isolate() == Isolate::Current()); | 46 ASSERT(context.isolate() == Isolate::Current()); |
47 const Code& code = Code::Handle(function.CurrentCode()); | 47 const Code& code = Code::Handle(function.CurrentCode()); |
48 ASSERT(!code.IsNull()); | 48 ASSERT(!code.IsNull()); |
| 49 ASSERT(Isolate::Current()->no_callback_scope_depth() == 0); |
49 return entrypoint(code.EntryPoint(), | 50 return entrypoint(code.EntryPoint(), |
50 arguments_descriptor, | 51 arguments_descriptor, |
51 arguments, | 52 arguments, |
52 context); | 53 context); |
53 } | 54 } |
54 | 55 |
55 | 56 |
56 RawObject* DartEntry::InvokeStatic(const Function& function, | 57 RawObject* DartEntry::InvokeStatic(const Function& function, |
57 const Array& arguments) { | 58 const Array& arguments) { |
58 const Array& arguments_descriptor = | 59 const Array& arguments_descriptor = |
(...skipping 16 matching lines...) Expand all Loading... |
75 } | 76 } |
76 } | 77 } |
77 // Now Call the invoke stub which will invoke the dart function. | 78 // Now Call the invoke stub which will invoke the dart function. |
78 invokestub entrypoint = reinterpret_cast<invokestub>( | 79 invokestub entrypoint = reinterpret_cast<invokestub>( |
79 StubCode::InvokeDartCodeEntryPoint()); | 80 StubCode::InvokeDartCodeEntryPoint()); |
80 const Context& context = | 81 const Context& context = |
81 Context::ZoneHandle(Isolate::Current()->object_store()->empty_context()); | 82 Context::ZoneHandle(Isolate::Current()->object_store()->empty_context()); |
82 ASSERT(context.isolate() == Isolate::Current()); | 83 ASSERT(context.isolate() == Isolate::Current()); |
83 const Code& code = Code::Handle(function.CurrentCode()); | 84 const Code& code = Code::Handle(function.CurrentCode()); |
84 ASSERT(!code.IsNull()); | 85 ASSERT(!code.IsNull()); |
| 86 ASSERT(Isolate::Current()->no_callback_scope_depth() == 0); |
85 return entrypoint(code.EntryPoint(), | 87 return entrypoint(code.EntryPoint(), |
86 arguments_descriptor, | 88 arguments_descriptor, |
87 arguments, | 89 arguments, |
88 context); | 90 context); |
89 } | 91 } |
90 | 92 |
91 | 93 |
92 RawObject* DartEntry::InvokeClosure(const Instance& closure, | 94 RawObject* DartEntry::InvokeClosure(const Instance& closure, |
93 const Array& arguments) { | 95 const Array& arguments) { |
94 const Array& arguments_descriptor = | 96 const Array& arguments_descriptor = |
(...skipping 25 matching lines...) Expand all Loading... |
120 } | 122 } |
121 // Now call the invoke stub which will invoke the closure function or | 123 // Now call the invoke stub which will invoke the closure function or |
122 // 'call' function. | 124 // 'call' function. |
123 // The closure or non-closure object (receiver) is passed as implicit | 125 // The closure or non-closure object (receiver) is passed as implicit |
124 // first argument. It is already included in the arguments array. | 126 // first argument. It is already included in the arguments array. |
125 invokestub entrypoint = reinterpret_cast<invokestub>( | 127 invokestub entrypoint = reinterpret_cast<invokestub>( |
126 StubCode::InvokeDartCodeEntryPoint()); | 128 StubCode::InvokeDartCodeEntryPoint()); |
127 ASSERT(context.isolate() == Isolate::Current()); | 129 ASSERT(context.isolate() == Isolate::Current()); |
128 const Code& code = Code::Handle(function.CurrentCode()); | 130 const Code& code = Code::Handle(function.CurrentCode()); |
129 ASSERT(!code.IsNull()); | 131 ASSERT(!code.IsNull()); |
| 132 ASSERT(Isolate::Current()->no_callback_scope_depth() == 0); |
130 return entrypoint(code.EntryPoint(), | 133 return entrypoint(code.EntryPoint(), |
131 arguments_descriptor, | 134 arguments_descriptor, |
132 arguments, | 135 arguments, |
133 context); | 136 context); |
134 } | 137 } |
135 } | 138 } |
136 // There is no compatible 'call' method, so invoke noSuchMethod. | 139 // There is no compatible 'call' method, so invoke noSuchMethod. |
137 return InvokeNoSuchMethod(instance, | 140 return InvokeNoSuchMethod(instance, |
138 Symbols::Call(), | 141 Symbols::Call(), |
139 arguments, | 142 arguments, |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 String::Handle(Field::GetterName(Symbols::_id())))); | 509 String::Handle(Field::GetterName(Symbols::_id())))); |
507 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); | 510 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); |
508 ASSERT(!func.IsNull()); | 511 ASSERT(!func.IsNull()); |
509 const Array& args = Array::Handle(Array::New(1)); | 512 const Array& args = Array::Handle(Array::New(1)); |
510 args.SetAt(0, port); | 513 args.SetAt(0, port); |
511 return DartEntry::InvokeDynamic(func, args); | 514 return DartEntry::InvokeDynamic(func, args); |
512 } | 515 } |
513 | 516 |
514 | 517 |
515 } // namespace dart | 518 } // namespace dart |
OLD | NEW |