OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_ARGUMENTS_H_ | 5 #ifndef V8_ARGUMENTS_H_ |
6 #define V8_ARGUMENTS_H_ | 6 #define V8_ARGUMENTS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 #include "src/tracing/trace-event.h" | 10 #include "src/tracing/trace-event.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 // TODO(cbruni): add global flag to check whether any tracing events have been | 82 // TODO(cbruni): add global flag to check whether any tracing events have been |
83 // enabled. | 83 // enabled. |
84 // TODO(cbruni): Convert the IsContext CHECK back to a DCHECK. | 84 // TODO(cbruni): Convert the IsContext CHECK back to a DCHECK. |
85 #define RUNTIME_FUNCTION_RETURNS_TYPE(Type, Name) \ | 85 #define RUNTIME_FUNCTION_RETURNS_TYPE(Type, Name) \ |
86 static INLINE(Type __RT_impl_##Name(Arguments args, Isolate* isolate)); \ | 86 static INLINE(Type __RT_impl_##Name(Arguments args, Isolate* isolate)); \ |
87 \ | 87 \ |
88 V8_NOINLINE static Type Stats_##Name(int args_length, Object** args_object, \ | 88 V8_NOINLINE static Type Stats_##Name(int args_length, Object** args_object, \ |
89 Isolate* isolate) { \ | 89 Isolate* isolate) { \ |
90 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Name); \ | 90 RuntimeCallTimerScope timer(isolate, &RuntimeCallStats::Name); \ |
| 91 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), \ |
| 92 "V8.Runtime_" #Name); \ |
91 Arguments args(args_length, args_object); \ | 93 Arguments args(args_length, args_object); \ |
92 TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_SCOPED( \ | |
93 isolate, &tracing::TraceEventStatsTable::Name); \ | |
94 return __RT_impl_##Name(args, isolate); \ | 94 return __RT_impl_##Name(args, isolate); \ |
95 } \ | 95 } \ |
96 \ | 96 \ |
97 Type Name(int args_length, Object** args_object, Isolate* isolate) { \ | 97 Type Name(int args_length, Object** args_object, Isolate* isolate) { \ |
98 CHECK(isolate->context() == nullptr || isolate->context()->IsContext()); \ | 98 CHECK(isolate->context() == nullptr || isolate->context()->IsContext()); \ |
99 CLOBBER_DOUBLE_REGISTERS(); \ | 99 CLOBBER_DOUBLE_REGISTERS(); \ |
100 if (V8_UNLIKELY(TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() || \ | 100 if (V8_UNLIKELY(TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() || \ |
101 FLAG_runtime_call_stats)) { \ | 101 FLAG_runtime_call_stats)) { \ |
102 return Stats_##Name(args_length, args_object, isolate); \ | 102 return Stats_##Name(args_length, args_object, isolate); \ |
103 } \ | 103 } \ |
104 Arguments args(args_length, args_object); \ | 104 Arguments args(args_length, args_object); \ |
105 return __RT_impl_##Name(args, isolate); \ | 105 return __RT_impl_##Name(args, isolate); \ |
106 } \ | 106 } \ |
107 \ | 107 \ |
108 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) | 108 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) |
109 | 109 |
110 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) | 110 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) |
111 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ | 111 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ |
112 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) | 112 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) |
113 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ | 113 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ |
114 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) | 114 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) |
115 | 115 |
116 } // namespace internal | 116 } // namespace internal |
117 } // namespace v8 | 117 } // namespace v8 |
118 | 118 |
119 #endif // V8_ARGUMENTS_H_ | 119 #endif // V8_ARGUMENTS_H_ |
OLD | NEW |