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/isolate.h" | 9 #include "src/isolate.h" |
| 10 #include "src/tracing/trace-event.h" |
10 | 11 |
11 namespace v8 { | 12 namespace v8 { |
12 namespace internal { | 13 namespace internal { |
13 | 14 |
14 // Arguments provides access to runtime call parameters. | 15 // Arguments provides access to runtime call parameters. |
15 // | 16 // |
16 // It uses the fact that the instance fields of Arguments | 17 // It uses the fact that the instance fields of Arguments |
17 // (length_, arguments_) are "overlayed" with the parameters | 18 // (length_, arguments_) are "overlayed" with the parameters |
18 // (no. of parameters, and the parameter pointer) passed so | 19 // (no. of parameters, and the parameter pointer) passed so |
19 // that inside the C++ function, the parameters passed can | 20 // that inside the C++ function, the parameters passed can |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 #else | 271 #else |
271 #define CLOBBER_DOUBLE_REGISTERS() | 272 #define CLOBBER_DOUBLE_REGISTERS() |
272 #endif | 273 #endif |
273 | 274 |
274 #define RUNTIME_FUNCTION_RETURNS_TYPE(Type, Name) \ | 275 #define RUNTIME_FUNCTION_RETURNS_TYPE(Type, Name) \ |
275 static INLINE(Type __RT_impl_##Name(Arguments args, Isolate* isolate)); \ | 276 static INLINE(Type __RT_impl_##Name(Arguments args, Isolate* isolate)); \ |
276 Type Name(int args_length, Object** args_object, Isolate* isolate) { \ | 277 Type Name(int args_length, Object** args_object, Isolate* isolate) { \ |
277 CLOBBER_DOUBLE_REGISTERS(); \ | 278 CLOBBER_DOUBLE_REGISTERS(); \ |
278 Arguments args(args_length, args_object); \ | 279 Arguments args(args_length, args_object); \ |
279 Type value; \ | 280 Type value; \ |
| 281 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), "V8." #Name); \ |
280 if (FLAG_runtime_call_stats) { \ | 282 if (FLAG_runtime_call_stats) { \ |
281 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ | 283 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ |
282 RuntimeCallTimerScope timer(isolate, &stats->Name); \ | 284 RuntimeCallTimerScope timer(isolate, &stats->Name); \ |
283 value = __RT_impl_##Name(args, isolate); \ | 285 value = __RT_impl_##Name(args, isolate); \ |
284 } else { \ | 286 } else { \ |
285 value = __RT_impl_##Name(args, isolate); \ | 287 value = __RT_impl_##Name(args, isolate); \ |
286 } \ | 288 } \ |
287 return value; \ | 289 return value; \ |
288 } \ | 290 } \ |
289 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) | 291 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) |
290 | 292 |
291 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) | 293 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) |
292 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ | 294 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ |
293 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) | 295 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) |
294 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ | 296 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ |
295 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) | 297 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) |
296 | 298 |
297 } // namespace internal | 299 } // namespace internal |
298 } // namespace v8 | 300 } // namespace v8 |
299 | 301 |
300 #endif // V8_ARGUMENTS_H_ | 302 #endif // V8_ARGUMENTS_H_ |
OLD | NEW |