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 base::ElapsedTimer timer; \ | 278 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ |
279 if (FLAG_runtime_call_stats) { \ | 279 RuntimeCallTimerScope timer(isolate, &stats->Name); \ |
280 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ | 280 Arguments args(args_length, args_object); \ |
281 stats->Enter(&stats->Name); \ | 281 Type value = __RT_impl_##Name(args, isolate); \ |
282 timer.Start(); \ | 282 return value; \ |
283 } \ | 283 } \ |
284 Arguments args(args_length, args_object); \ | |
285 Type value = __RT_impl_##Name(args, isolate); \ | |
286 if (FLAG_runtime_call_stats) { \ | |
287 isolate->counters()->runtime_call_stats()->Leave(timer.Elapsed()); \ | |
288 } \ | |
289 return value; \ | |
290 } \ | |
291 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) | 284 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) |
292 | 285 |
293 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) | 286 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) |
294 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ | 287 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ |
295 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) | 288 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) |
296 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ | 289 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ |
297 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) | 290 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) |
298 | 291 |
299 } // namespace internal | 292 } // namespace internal |
300 } // namespace v8 | 293 } // namespace v8 |
301 | 294 |
302 #endif // V8_ARGUMENTS_H_ | 295 #endif // V8_ARGUMENTS_H_ |
OLD | NEW |