| 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/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/native_arguments.h" | 10 #include "vm/native_arguments.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 const char* name_; | 69 const char* name_; |
| 70 const RuntimeFunction function_; | 70 const RuntimeFunction function_; |
| 71 const intptr_t argument_count_; | 71 const intptr_t argument_count_; |
| 72 const bool is_leaf_; | 72 const bool is_leaf_; |
| 73 const bool is_float_; | 73 const bool is_float_; |
| 74 const RuntimeEntry* next_; | 74 const RuntimeEntry* next_; |
| 75 | 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(RuntimeEntry); | 76 DISALLOW_COPY_AND_ASSIGN(RuntimeEntry); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 #ifndef PRODUCT |
| 80 #define TRACE_RUNTIME_CALL(format, name) \ |
| 81 if (FLAG_trace_runtime_calls) { \ |
| 82 OS::Print("Runtime call: " format "\n", name); \ |
| 83 } |
| 84 #else |
| 85 #define TRACE_RUNTIME_CALL(format, name) \ |
| 86 do { } while (0) |
| 87 #endif |
| 79 | 88 |
| 80 // Helper macros for declaring and defining runtime entries. | 89 // Helper macros for declaring and defining runtime entries. |
| 81 | 90 |
| 82 #define DEFINE_RUNTIME_ENTRY(name, argument_count) \ | 91 #define DEFINE_RUNTIME_ENTRY(name, argument_count) \ |
| 83 extern void DRT_##name(NativeArguments arguments); \ | 92 extern void DRT_##name(NativeArguments arguments); \ |
| 84 extern const RuntimeEntry k##name##RuntimeEntry( \ | 93 extern const RuntimeEntry k##name##RuntimeEntry( \ |
| 85 "DRT_"#name, &DRT_##name, argument_count, false, false); \ | 94 "DRT_"#name, &DRT_##name, argument_count, false, false); \ |
| 86 static void DRT_Helper##name(Isolate* isolate, \ | 95 static void DRT_Helper##name(Isolate* isolate, \ |
| 87 Thread* thread, \ | 96 Thread* thread, \ |
| 88 Zone* zone, \ | 97 Zone* zone, \ |
| 89 NativeArguments arguments); \ | 98 NativeArguments arguments); \ |
| 90 void DRT_##name(NativeArguments arguments) { \ | 99 void DRT_##name(NativeArguments arguments) { \ |
| 91 CHECK_STACK_ALIGNMENT; \ | 100 CHECK_STACK_ALIGNMENT; \ |
| 92 VERIFY_ON_TRANSITION; \ | 101 VERIFY_ON_TRANSITION; \ |
| 93 ASSERT(arguments.ArgCount() == argument_count); \ | 102 ASSERT(arguments.ArgCount() == argument_count); \ |
| 94 if (FLAG_trace_runtime_calls) OS::Print("Runtime call: %s\n", ""#name); \ | 103 TRACE_RUNTIME_CALL("%s", ""#name); \ |
| 95 { \ | 104 { \ |
| 96 Thread* thread = arguments.thread(); \ | 105 Thread* thread = arguments.thread(); \ |
| 97 ASSERT(thread == Thread::Current()); \ | 106 ASSERT(thread == Thread::Current()); \ |
| 98 Isolate* isolate = thread->isolate(); \ | 107 Isolate* isolate = thread->isolate(); \ |
| 99 TransitionGeneratedToVM transition(thread); \ | 108 TransitionGeneratedToVM transition(thread); \ |
| 100 StackZone zone(thread); \ | 109 StackZone zone(thread); \ |
| 101 HANDLESCOPE(thread); \ | 110 HANDLESCOPE(thread); \ |
| 102 DRT_Helper##name(isolate, thread, zone.GetZone(), arguments); \ | 111 DRT_Helper##name(isolate, thread, zone.GetZone(), arguments); \ |
| 103 } \ | 112 } \ |
| 104 VERIFY_ON_TRANSITION; \ | 113 VERIFY_ON_TRANSITION; \ |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 #define CHECK_LEAF_RUNTIME_ADDRESS(type, name, ...) \ | 180 #define CHECK_LEAF_RUNTIME_ADDRESS(type, name, ...) \ |
| 172 if (address == k##name##RuntimeEntry.GetEntryPoint()) return k##name##Id; | 181 if (address == k##name##RuntimeEntry.GetEntryPoint()) return k##name##Id; |
| 173 LEAF_RUNTIME_ENTRY_LIST(CHECK_LEAF_RUNTIME_ADDRESS) | 182 LEAF_RUNTIME_ENTRY_LIST(CHECK_LEAF_RUNTIME_ADDRESS) |
| 174 #undef CHECK_LEAF_RUNTIME_ADDRESS | 183 #undef CHECK_LEAF_RUNTIME_ADDRESS |
| 175 return kNoRuntimeFunctionId; | 184 return kNoRuntimeFunctionId; |
| 176 } | 185 } |
| 177 | 186 |
| 178 } // namespace dart | 187 } // namespace dart |
| 179 | 188 |
| 180 #endif // VM_RUNTIME_ENTRY_H_ | 189 #endif // VM_RUNTIME_ENTRY_H_ |
| OLD | NEW |