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 #ifndef VM_DART_ENTRY_H_ | 5 #ifndef VM_DART_ENTRY_H_ |
6 #define VM_DART_ENTRY_H_ | 6 #define VM_DART_ENTRY_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
10 | 10 |
11 namespace dart { | 11 namespace dart { |
12 | 12 |
13 // Forward declarations. | 13 // Forward declarations. |
14 class Array; | 14 class Array; |
15 class Closure; | 15 class Closure; |
16 class Context; | |
17 class Function; | 16 class Function; |
18 class Instance; | 17 class Instance; |
19 class Integer; | 18 class Integer; |
20 class Library; | 19 class Library; |
21 class Object; | 20 class Object; |
22 class RawArray; | 21 class RawArray; |
23 class RawInstance; | 22 class RawInstance; |
24 class RawObject; | 23 class RawObject; |
25 class RawString; | 24 class RawString; |
26 class String; | 25 class String; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 }; | 95 }; |
97 | 96 |
98 | 97 |
99 // DartEntry abstracts functionality needed to resolve dart functions | 98 // DartEntry abstracts functionality needed to resolve dart functions |
100 // and invoke them from C++. | 99 // and invoke them from C++. |
101 class DartEntry : public AllStatic { | 100 class DartEntry : public AllStatic { |
102 public: | 101 public: |
103 // On success, returns a RawInstance. On failure, a RawError. | 102 // On success, returns a RawInstance. On failure, a RawError. |
104 typedef RawObject* (*invokestub)(uword entry_point, | 103 typedef RawObject* (*invokestub)(uword entry_point, |
105 const Array& arguments_descriptor, | 104 const Array& arguments_descriptor, |
106 const Array& arguments, | 105 const Array& arguments); |
107 const Context& context); | |
108 | 106 |
109 // Invokes the specified instance function or static function. | 107 // Invokes the specified instance function or static function. |
110 // The first argument of an instance function is the receiver. | 108 // The first argument of an instance function is the receiver. |
111 // On success, returns a RawInstance. On failure, a RawError. | 109 // On success, returns a RawInstance. On failure, a RawError. |
112 // This is used when there are no named arguments in the call. | 110 // This is used when there are no named arguments in the call. |
113 static RawObject* InvokeFunction(const Function& function, | 111 static RawObject* InvokeFunction(const Function& function, |
114 const Array& arguments); | 112 const Array& arguments); |
115 | 113 |
116 // Invokes the specified instance or static function. | 114 // Invokes the specified instance, static, or closure function. |
117 // On success, returns a RawInstance. On failure, a RawError. | 115 // On success, returns a RawInstance. On failure, a RawError. |
118 static RawObject* InvokeFunction(const Function& function, | 116 static RawObject* InvokeFunction(const Function& function, |
119 const Array& arguments, | 117 const Array& arguments, |
120 const Array& arguments_descriptor); | 118 const Array& arguments_descriptor); |
121 | 119 |
122 // Invokes the specified instance, static, or closure function. | |
123 // On success, returns a RawInstance. On failure, a RawError. | |
124 static RawObject* InvokeFunction(const Function& function, | |
125 const Array& arguments, | |
126 const Array& arguments_descriptor, | |
127 const Context& context); | |
128 | |
129 // Invokes the closure object given as the first argument. | 120 // Invokes the closure object given as the first argument. |
130 // On success, returns a RawInstance. On failure, a RawError. | 121 // On success, returns a RawInstance. On failure, a RawError. |
131 // This is used when there are no named arguments in the call. | 122 // This is used when there are no named arguments in the call. |
132 static RawObject* InvokeClosure(const Array& arguments); | 123 static RawObject* InvokeClosure(const Array& arguments); |
133 | 124 |
134 // Invokes the closure object given as the first argument. | 125 // Invokes the closure object given as the first argument. |
135 // On success, returns a RawInstance. On failure, a RawError. | 126 // On success, returns a RawInstance. On failure, a RawError. |
136 static RawObject* InvokeClosure(const Array& arguments, | 127 static RawObject* InvokeClosure(const Array& arguments, |
137 const Array& arguments_descriptor); | 128 const Array& arguments_descriptor); |
138 | 129 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // | 166 // |
176 // Returns null on success, a RawError on failure. | 167 // Returns null on success, a RawError on failure. |
177 static RawObject* MapSetAt(const Instance& map, | 168 static RawObject* MapSetAt(const Instance& map, |
178 const Instance& key, | 169 const Instance& key, |
179 const Instance& value); | 170 const Instance& value); |
180 }; | 171 }; |
181 | 172 |
182 } // namespace dart | 173 } // namespace dart |
183 | 174 |
184 #endif // VM_DART_ENTRY_H_ | 175 #endif // VM_DART_ENTRY_H_ |
OLD | NEW |