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 | 10 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 #ifdef DEBUG | 268 #ifdef DEBUG |
269 #define CLOBBER_DOUBLE_REGISTERS() ClobberDoubleRegisters(1, 2, 3, 4); | 269 #define CLOBBER_DOUBLE_REGISTERS() ClobberDoubleRegisters(1, 2, 3, 4); |
270 #else | 270 #else |
271 #define CLOBBER_DOUBLE_REGISTERS() | 271 #define CLOBBER_DOUBLE_REGISTERS() |
272 #endif | 272 #endif |
273 | 273 |
274 #define RUNTIME_FUNCTION_RETURNS_TYPE(Type, Name) \ | 274 #define RUNTIME_FUNCTION_RETURNS_TYPE(Type, Name) \ |
275 static INLINE(Type __RT_impl_##Name(Arguments args, Isolate* isolate)); \ | 275 static INLINE(Type __RT_impl_##Name(Arguments args, Isolate* isolate)); \ |
276 Type Name(int args_length, Object** args_object, Isolate* isolate) { \ | 276 Type Name(int args_length, Object** args_object, Isolate* isolate) { \ |
277 CLOBBER_DOUBLE_REGISTERS(); \ | 277 CLOBBER_DOUBLE_REGISTERS(); \ |
278 base::ElapsedTimer timer; \ | |
279 if (FLAG_runtime_call_stats) { \ | 278 if (FLAG_runtime_call_stats) { \ |
280 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ | 279 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ |
281 stats->Enter(&stats->Name); \ | 280 stats->Enter(&stats->Name); \ |
282 timer.Start(); \ | |
283 } \ | 281 } \ |
284 Arguments args(args_length, args_object); \ | 282 Arguments args(args_length, args_object); \ |
285 Type value = __RT_impl_##Name(args, isolate); \ | 283 Type value = __RT_impl_##Name(args, isolate); \ |
286 if (FLAG_runtime_call_stats) { \ | 284 if (FLAG_runtime_call_stats) { \ |
287 isolate->counters()->runtime_call_stats()->Leave(timer.Elapsed()); \ | 285 isolate->counters()->runtime_call_stats()->Leave(); \ |
288 } \ | 286 } \ |
289 return value; \ | 287 return value; \ |
290 } \ | 288 } \ |
291 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) | 289 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) |
292 | 290 |
293 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) | 291 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) |
294 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ | 292 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ |
295 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) | 293 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) |
296 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ | 294 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ |
297 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) | 295 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) |
298 | 296 |
299 } // namespace internal | 297 } // namespace internal |
300 } // namespace v8 | 298 } // namespace v8 |
301 | 299 |
302 #endif // V8_ARGUMENTS_H_ | 300 #endif // V8_ARGUMENTS_H_ |
OLD | NEW |