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_RUNTIME_ENTRY_H_ | 5 #ifndef VM_RUNTIME_ENTRY_H_ |
6 #define VM_RUNTIME_ENTRY_H_ | 6 #define VM_RUNTIME_ENTRY_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
11 #include "vm/native_arguments.h" | 11 #include "vm/native_arguments.h" |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
15 DECLARE_FLAG(bool, trace_runtime_calls); | 15 DECLARE_FLAG(bool, trace_runtime_calls); |
16 | 16 |
17 typedef void (*RuntimeFunction)(NativeArguments arguments); | 17 typedef void (*RuntimeFunction)(NativeArguments arguments); |
18 | 18 |
19 | 19 |
20 // Class RuntimeEntry is used to encapsulate runtime functions, it includes | 20 // Class RuntimeEntry is used to encapsulate runtime functions, it includes |
21 // the entry point for the runtime function and the number of arguments expected | 21 // the entry point for the runtime function and the number of arguments expected |
22 // by the function. | 22 // by the function. |
23 class RuntimeEntry : public ValueObject { | 23 class RuntimeEntry : public ValueObject { |
24 public: | 24 public: |
25 RuntimeEntry(const char* name, RuntimeFunction function, | 25 RuntimeEntry(const char* name, RuntimeFunction function, |
26 int argument_count, bool is_leaf) | 26 int argument_count, bool is_leaf) |
| 27 // TODO(regis): In order to simulate leaf runtime calls taking floating point |
| 28 // arguments, we need to add an 'is_float' flag. |
27 : name_(name), | 29 : name_(name), |
28 function_(function), | 30 function_(function), |
29 argument_count_(argument_count), | 31 argument_count_(argument_count), |
30 is_leaf_(is_leaf) { } | 32 is_leaf_(is_leaf) { } |
31 ~RuntimeEntry() {} | 33 ~RuntimeEntry() {} |
32 | 34 |
33 const char* name() const { return name_; } | 35 const char* name() const { return name_; } |
34 RuntimeFunction function() const { return function_; } | 36 RuntimeFunction function() const { return function_; } |
35 int argument_count() const { return argument_count_; } | 37 int argument_count() const { return argument_count_; } |
36 bool is_leaf() const { return is_leaf_; } | 38 bool is_leaf() const { return is_leaf_; } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 84 |
83 #define END_LEAF_RUNTIME_ENTRY } | 85 #define END_LEAF_RUNTIME_ENTRY } |
84 | 86 |
85 #define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \ | 87 #define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \ |
86 extern const RuntimeEntry k##name##RuntimeEntry; \ | 88 extern const RuntimeEntry k##name##RuntimeEntry; \ |
87 extern "C" type DLRT_##name(__VA_ARGS__) | 89 extern "C" type DLRT_##name(__VA_ARGS__) |
88 | 90 |
89 } // namespace dart | 91 } // namespace dart |
90 | 92 |
91 #endif // VM_RUNTIME_ENTRY_H_ | 93 #endif // VM_RUNTIME_ENTRY_H_ |
OLD | NEW |