| 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 #include "vm/timer_scope.h" | |
| 13 | 12 |
| 14 namespace dart { | 13 namespace dart { |
| 15 | 14 |
| 16 DECLARE_FLAG(bool, trace_runtime_calls); | 15 DECLARE_FLAG(bool, trace_runtime_calls); |
| 17 | 16 |
| 18 typedef void (*RuntimeFunction)(NativeArguments arguments); | 17 typedef void (*RuntimeFunction)(NativeArguments arguments); |
| 19 | 18 |
| 20 | 19 |
| 21 // Class RuntimeEntry is used to encapsulate runtime functions, it includes | 20 // Class RuntimeEntry is used to encapsulate runtime functions, it includes |
| 22 // 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 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 54 |
| 56 // Helper macros for declaring and defining runtime entries. | 55 // Helper macros for declaring and defining runtime entries. |
| 57 | 56 |
| 58 #define DEFINE_RUNTIME_ENTRY(name, argument_count) \ | 57 #define DEFINE_RUNTIME_ENTRY(name, argument_count) \ |
| 59 extern void DRT_##name(NativeArguments arguments); \ | 58 extern void DRT_##name(NativeArguments arguments); \ |
| 60 extern const RuntimeEntry k##name##RuntimeEntry( \ | 59 extern const RuntimeEntry k##name##RuntimeEntry( \ |
| 61 "DRT_"#name, &DRT_##name, argument_count, false, false); \ | 60 "DRT_"#name, &DRT_##name, argument_count, false, false); \ |
| 62 static void DRT_Helper##name(Isolate* isolate, NativeArguments arguments); \ | 61 static void DRT_Helper##name(Isolate* isolate, NativeArguments arguments); \ |
| 63 void DRT_##name(NativeArguments arguments) { \ | 62 void DRT_##name(NativeArguments arguments) { \ |
| 64 CHECK_STACK_ALIGNMENT; \ | 63 CHECK_STACK_ALIGNMENT; \ |
| 65 DartToVmTimerScope timer(arguments.isolate()); \ | |
| 66 VERIFY_ON_TRANSITION; \ | 64 VERIFY_ON_TRANSITION; \ |
| 67 ASSERT(arguments.ArgCount() == argument_count); \ | 65 ASSERT(arguments.ArgCount() == argument_count); \ |
| 68 if (FLAG_trace_runtime_calls) OS::Print("Runtime call: %s\n", ""#name); \ | 66 if (FLAG_trace_runtime_calls) OS::Print("Runtime call: %s\n", ""#name); \ |
| 69 { \ | 67 { \ |
| 70 StackZone zone(arguments.isolate()); \ | 68 StackZone zone(arguments.isolate()); \ |
| 71 HANDLESCOPE(arguments.isolate()); \ | 69 HANDLESCOPE(arguments.isolate()); \ |
| 72 DRT_Helper##name(arguments.isolate(), arguments); \ | 70 DRT_Helper##name(arguments.isolate(), arguments); \ |
| 73 } \ | 71 } \ |
| 74 VERIFY_ON_TRANSITION; \ | 72 VERIFY_ON_TRANSITION; \ |
| 75 } \ | 73 } \ |
| (...skipping 13 matching lines...) Expand all Loading... |
| 89 | 87 |
| 90 #define END_LEAF_RUNTIME_ENTRY } | 88 #define END_LEAF_RUNTIME_ENTRY } |
| 91 | 89 |
| 92 #define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \ | 90 #define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \ |
| 93 extern const RuntimeEntry k##name##RuntimeEntry; \ | 91 extern const RuntimeEntry k##name##RuntimeEntry; \ |
| 94 extern "C" type DLRT_##name(__VA_ARGS__) | 92 extern "C" type DLRT_##name(__VA_ARGS__) |
| 95 | 93 |
| 96 } // namespace dart | 94 } // namespace dart |
| 97 | 95 |
| 98 #endif // VM_RUNTIME_ENTRY_H_ | 96 #endif // VM_RUNTIME_ENTRY_H_ |
| OLD | NEW |