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; | 16 class Context; |
17 class Function; | 17 class Function; |
18 class Instance; | 18 class Instance; |
19 class Integer; | 19 class Integer; |
20 class Object; | 20 class Object; |
21 class RawInstance; | 21 class RawInstance; |
22 class String; | 22 class String; |
23 | 23 |
24 // DartEntry abstracts functionality needed to resolve dart functions | 24 // DartEntry abstracts functionality needed to resolve dart functions |
25 // and invoke them from C++. | 25 // and invoke them from C++. |
| 26 // |
| 27 // TODO(turnidge): Make these functions assert that there is an active |
| 28 // setjmp. Or make these functions do the setjmps themselves and |
| 29 // represent compile errors with an explict object type. |
| 30 // |
| 31 // TODO(turnidge): Make these functions return RawObject instead of |
| 32 // RawInstance. |
26 class DartEntry : public AllStatic { | 33 class DartEntry : public AllStatic { |
27 public: | 34 public: |
28 typedef RawInstance* (*invokestub)(uword entry_point, | 35 typedef RawInstance* (*invokestub)(uword entry_point, |
29 const Array& arguments_descriptor, | 36 const Array& arguments_descriptor, |
30 const Object** arguments, | 37 const Object** arguments, |
31 const Context& context); | 38 const Context& context); |
32 | 39 |
33 // Invoke the specified instance function on the receiver. | 40 // Invoke the specified instance function on the receiver. |
34 // Returns object returned by the dart instance function. | 41 // Returns object returned by the dart instance function. |
35 static RawInstance* InvokeDynamic( | 42 static RawInstance* InvokeDynamic( |
(...skipping 20 matching lines...) Expand all Loading... |
56 | 63 |
57 // Utility functions to call from VM into Dart bootstrap libraries. | 64 // Utility functions to call from VM into Dart bootstrap libraries. |
58 // Each may return an exception object. | 65 // Each may return an exception object. |
59 class DartLibraryCalls : public AllStatic { | 66 class DartLibraryCalls : public AllStatic { |
60 public: | 67 public: |
61 static RawInstance* ExceptionCreate( | 68 static RawInstance* ExceptionCreate( |
62 const String& exception_name, | 69 const String& exception_name, |
63 const GrowableArray<const Object*>& arguments); | 70 const GrowableArray<const Object*>& arguments); |
64 static RawInstance* ToString(const Instance& receiver); | 71 static RawInstance* ToString(const Instance& receiver); |
65 static RawInstance* Equals(const Instance& left, const Instance& right); | 72 static RawInstance* Equals(const Instance& left, const Instance& right); |
| 73 |
| 74 // Returns either an unhandled exception or null. |
| 75 static RawObject* HandleMessage(Dart_Port dest_port_id, |
| 76 Dart_Port reply_port_id, |
| 77 const Instance& dart_message); |
66 }; | 78 }; |
67 | 79 |
68 } // namespace dart | 80 } // namespace dart |
69 | 81 |
70 #endif // VM_DART_ENTRY_H_ | 82 #endif // VM_DART_ENTRY_H_ |
OLD | NEW |