| 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 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // DartEntry abstracts functionality needed to resolve dart functions | 98 // DartEntry abstracts functionality needed to resolve dart functions |
| 99 // and invoke them from C++. | 99 // and invoke them from C++. |
| 100 class DartEntry : public AllStatic { | 100 class DartEntry : public AllStatic { |
| 101 public: | 101 public: |
| 102 // On success, returns a RawInstance. On failure, a RawError. | 102 // On success, returns a RawInstance. On failure, a RawError. |
| 103 typedef RawObject* (*invokestub)(uword entry_point, | 103 typedef RawObject* (*invokestub)(uword entry_point, |
| 104 const Array& arguments_descriptor, | 104 const Array& arguments_descriptor, |
| 105 const Array& arguments, | 105 const Array& arguments, |
| 106 const Context& context); | 106 const Context& context); |
| 107 | 107 |
| 108 // Invokes the specified instance function on the receiver. | 108 // Invokes the specified instance function or static function. |
| 109 // The first argument of an instance function is the receiver. |
| 109 // On success, returns a RawInstance. On failure, a RawError. | 110 // On success, returns a RawInstance. On failure, a RawError. |
| 110 // This is used when there are no named arguments in the call. | 111 // This is used when there are no named arguments in the call. |
| 111 static RawObject* InvokeDynamic(const Function& function, | 112 static RawObject* InvokeFunction(const Function& function, |
| 112 const Array& arguments); | 113 const Array& arguments); |
| 113 | 114 |
| 114 // Invokes the specified instance function on the receiver. | 115 // Invokes the specified instance or static function. |
| 115 // On success, returns a RawInstance. On failure, a RawError. | 116 // On success, returns a RawInstance. On failure, a RawError. |
| 116 static RawObject* InvokeDynamic(const Function& function, | 117 static RawObject* InvokeFunction(const Function& function, |
| 117 const Array& arguments, | 118 const Array& arguments, |
| 119 const Array& arguments_descriptor); |
| 120 |
| 121 // Invokes the specified instance, static, or closure function. |
| 122 // On success, returns a RawInstance. On failure, a RawError. |
| 123 static RawObject* InvokeFunction(const Function& function, |
| 124 const Array& arguments, |
| 125 const Array& arguments_descriptor, |
| 126 const Context& context); |
| 127 |
| 128 // Invokes the closure object given as the first argument. |
| 129 // On success, returns a RawInstance. On failure, a RawError. |
| 130 // This is used when there are no named arguments in the call. |
| 131 static RawObject* InvokeClosure(const Array& arguments); |
| 132 |
| 133 // Invokes the closure object given as the first argument. |
| 134 // On success, returns a RawInstance. On failure, a RawError. |
| 135 static RawObject* InvokeClosure(const Array& arguments, |
| 118 const Array& arguments_descriptor); | 136 const Array& arguments_descriptor); |
| 119 | 137 |
| 120 // Invoke the specified static function. | 138 // Invokes the noSuchMethod instance function on the receiver. |
| 121 // On success, returns a RawInstance. On failure, a RawError. | |
| 122 // This is used when there are no named arguments in the call. | |
| 123 static RawObject* InvokeStatic(const Function& function, | |
| 124 const Array& arguments); | |
| 125 | |
| 126 // Invoke the specified static function. | |
| 127 // On success, returns a RawInstance. On failure, a RawError. | |
| 128 static RawObject* InvokeStatic(const Function& function, | |
| 129 const Array& arguments, | |
| 130 const Array& arguments_descriptor); | |
| 131 | |
| 132 // Invoke the specified closure object. | |
| 133 // On success, returns a RawInstance. On failure, a RawError. | |
| 134 // This is used when there are no named arguments in the call. | |
| 135 static RawObject* InvokeClosure(const Instance& closure, | |
| 136 const Array& arguments); | |
| 137 | |
| 138 // Invoke the specified closure object. | |
| 139 // On success, returns a RawInstance. On failure, a RawError. | |
| 140 static RawObject* InvokeClosure(const Instance& closure, | |
| 141 const Array& arguments, | |
| 142 const Array& arguments_descriptor); | |
| 143 | |
| 144 // Invoke the noSuchMethod instance function on the receiver. | |
| 145 // On success, returns a RawInstance. On failure, a RawError. | 139 // On success, returns a RawInstance. On failure, a RawError. |
| 146 static RawObject* InvokeNoSuchMethod(const Instance& receiver, | 140 static RawObject* InvokeNoSuchMethod(const Instance& receiver, |
| 147 const String& target_name, | 141 const String& target_name, |
| 148 const Array& arguments, | 142 const Array& arguments, |
| 149 const Array& arguments_descriptor); | 143 const Array& arguments_descriptor); |
| 150 }; | 144 }; |
| 151 | 145 |
| 152 | 146 |
| 153 // Utility functions to call from VM into Dart bootstrap libraries. | 147 // Utility functions to call from VM into Dart bootstrap libraries. |
| 154 // Each may return an exception object. | 148 // Each may return an exception object. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 181 |
| 188 // Gets the _id field of a SendPort/ReceivePort. | 182 // Gets the _id field of a SendPort/ReceivePort. |
| 189 // | 183 // |
| 190 // Returns the value of _id on success, a RawError on failure. | 184 // Returns the value of _id on success, a RawError on failure. |
| 191 static RawObject* PortGetId(const Instance& port); | 185 static RawObject* PortGetId(const Instance& port); |
| 192 }; | 186 }; |
| 193 | 187 |
| 194 } // namespace dart | 188 } // namespace dart |
| 195 | 189 |
| 196 #endif // VM_DART_ENTRY_H_ | 190 #endif // VM_DART_ENTRY_H_ |
| OLD | NEW |