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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 264 |
265 double ClobberDoubleRegisters(double x1, double x2, double x3, double x4); | 265 double ClobberDoubleRegisters(double x1, double x2, double x3, double x4); |
266 | 266 |
267 | 267 |
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 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ | 278 base::ElapsedTimer timer; \ |
279 stats->Count_##Name++; \ | 279 if (FLAG_runtime_call_stats) { \ |
280 base::ElapsedTimer timer; \ | 280 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ |
281 bool timing = false; \ | 281 stats->Enter(&stats->Name); \ |
282 if (FLAG_runtime_call_stats && !stats->in_runtime_call) { \ | 282 timer.Start(); \ |
283 stats->in_runtime_call = true; \ | 283 } \ |
284 timing = true; \ | 284 Arguments args(args_length, args_object); \ |
285 timer.Start(); \ | 285 Type value = __RT_impl_##Name(args, isolate); \ |
286 } \ | 286 if (FLAG_runtime_call_stats) { \ |
287 Arguments args(args_length, args_object); \ | 287 isolate->counters()->runtime_call_stats()->Leave(timer.Elapsed()); \ |
288 Type value = __RT_impl_##Name(args, isolate); \ | 288 } \ |
289 if (timing) { \ | 289 return value; \ |
290 stats->in_runtime_call = false; \ | 290 } \ |
291 isolate->counters()->runtime_call_stats()->Time_##Name += \ | |
292 timer.Elapsed(); \ | |
293 } \ | |
294 return value; \ | |
295 } \ | |
296 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) | 291 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) |
297 | 292 |
298 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) | 293 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) |
299 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ | 294 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ |
300 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) | 295 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) |
301 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ | 296 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ |
302 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) | 297 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) |
303 | 298 |
304 } // namespace internal | 299 } // namespace internal |
305 } // namespace v8 | 300 } // namespace v8 |
306 | 301 |
307 #endif // V8_ARGUMENTS_H_ | 302 #endif // V8_ARGUMENTS_H_ |
OLD | NEW |