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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 266 |
267 double ClobberDoubleRegisters(double x1, double x2, double x3, double x4); | 267 double ClobberDoubleRegisters(double x1, double x2, double x3, double x4); |
268 | 268 |
269 | 269 |
270 #ifdef DEBUG | 270 #ifdef DEBUG |
271 #define CLOBBER_DOUBLE_REGISTERS() ClobberDoubleRegisters(1, 2, 3, 4); | 271 #define CLOBBER_DOUBLE_REGISTERS() ClobberDoubleRegisters(1, 2, 3, 4); |
272 #else | 272 #else |
273 #define CLOBBER_DOUBLE_REGISTERS() | 273 #define CLOBBER_DOUBLE_REGISTERS() |
274 #endif | 274 #endif |
275 | 275 |
276 #define RUNTIME_FUNCTION_RETURNS_TYPE(Type, Name) \ | 276 |
277 static INLINE(Type __RT_impl_##Name(Arguments args, Isolate* isolate)); \ | 277 #define RUNTIME_FUNCTION_RETURNS_TYPE(Type, Name) \ |
278 Type Name(int args_length, Object** args_object, Isolate* isolate) { \ | 278 static INLINE(Type __RT_impl_##Name(Arguments args, Isolate* isolate)); \ |
279 CLOBBER_DOUBLE_REGISTERS(); \ | 279 Type Name(int args_length, Object** args_object, Isolate* isolate) { \ |
280 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ | 280 CLOBBER_DOUBLE_REGISTERS(); \ |
281 stats->Count_##Name++; \ | 281 RuntimeCallStats* stats = isolate->runtime_state()->runtime_call_stats(); \ |
282 base::ElapsedTimer timer; \ | 282 stats->Count_##Name++; \ |
283 bool timing = false; \ | 283 base::ElapsedTimer timer; \ |
284 if (FLAG_runtime_call_stats && !stats->in_runtime_call) { \ | 284 bool timing = false; \ |
285 stats->in_runtime_call = true; \ | 285 if (FLAG_runtime_call_stats && !stats->in_runtime_call) { \ |
286 timing = true; \ | 286 stats->in_runtime_call = true; \ |
287 timer.Start(); \ | 287 timing = true; \ |
288 } \ | 288 timer.Start(); \ |
289 Arguments args(args_length, args_object); \ | 289 } \ |
290 Type value = __RT_impl_##Name(args, isolate); \ | 290 Arguments args(args_length, args_object); \ |
291 if (timing) { \ | 291 Type value = __RT_impl_##Name(args, isolate); \ |
292 stats->in_runtime_call = false; \ | 292 if (timing) { \ |
293 isolate->counters()->runtime_call_stats()->Time_##Name += \ | 293 stats->in_runtime_call = false; \ |
294 timer.Elapsed(); \ | 294 isolate->runtime_state()->runtime_call_stats()->Time_##Name += \ |
295 } \ | 295 timer.Elapsed(); \ |
296 return value; \ | 296 } \ |
297 } \ | 297 return value; \ |
| 298 } \ |
298 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) | 299 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) |
299 | 300 |
| 301 |
300 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) | 302 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) |
301 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ | 303 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ |
302 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) | 304 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) |
303 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ | 305 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ |
304 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) | 306 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) |
305 | 307 |
306 } // namespace internal | 308 } // namespace internal |
307 } // namespace v8 | 309 } // namespace v8 |
308 | 310 |
309 #endif // V8_ARGUMENTS_H_ | 311 #endif // V8_ARGUMENTS_H_ |
OLD | NEW |