| 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 | 276 #define RUNTIME_FUNCTION_RETURNS_TYPE(Type, Name) \ |
| 277 #define RUNTIME_FUNCTION_RETURNS_TYPE(Type, Name) \ | 277 static INLINE(Type __RT_impl_##Name(Arguments args, Isolate* isolate)); \ |
| 278 static INLINE(Type __RT_impl_##Name(Arguments args, Isolate* isolate)); \ | 278 Type Name(int args_length, Object** args_object, Isolate* isolate) { \ |
| 279 Type Name(int args_length, Object** args_object, Isolate* isolate) { \ | 279 CLOBBER_DOUBLE_REGISTERS(); \ |
| 280 CLOBBER_DOUBLE_REGISTERS(); \ | 280 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ |
| 281 RuntimeCallStats* stats = isolate->runtime_state()->runtime_call_stats(); \ | 281 stats->Count_##Name++; \ |
| 282 stats->Count_##Name++; \ | 282 base::ElapsedTimer timer; \ |
| 283 base::ElapsedTimer timer; \ | 283 bool timing = false; \ |
| 284 bool timing = false; \ | 284 if (FLAG_runtime_call_stats && !stats->in_runtime_call) { \ |
| 285 if (FLAG_runtime_call_stats && !stats->in_runtime_call) { \ | 285 stats->in_runtime_call = true; \ |
| 286 stats->in_runtime_call = true; \ | 286 timing = true; \ |
| 287 timing = true; \ | 287 timer.Start(); \ |
| 288 timer.Start(); \ | 288 } \ |
| 289 } \ | 289 Arguments args(args_length, args_object); \ |
| 290 Arguments args(args_length, args_object); \ | 290 Type value = __RT_impl_##Name(args, isolate); \ |
| 291 Type value = __RT_impl_##Name(args, isolate); \ | 291 if (timing) { \ |
| 292 if (timing) { \ | 292 stats->in_runtime_call = false; \ |
| 293 stats->in_runtime_call = false; \ | 293 isolate->counters()->runtime_call_stats()->Time_##Name += \ |
| 294 isolate->runtime_state()->runtime_call_stats()->Time_##Name += \ | 294 timer.Elapsed(); \ |
| 295 timer.Elapsed(); \ | 295 } \ |
| 296 } \ | 296 return value; \ |
| 297 return value; \ | 297 } \ |
| 298 } \ | |
| 299 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) | 298 static Type __RT_impl_##Name(Arguments args, Isolate* isolate) |
| 300 | 299 |
| 301 | |
| 302 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) | 300 #define RUNTIME_FUNCTION(Name) RUNTIME_FUNCTION_RETURNS_TYPE(Object*, Name) |
| 303 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ | 301 #define RUNTIME_FUNCTION_RETURN_PAIR(Name) \ |
| 304 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) | 302 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectPair, Name) |
| 305 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ | 303 #define RUNTIME_FUNCTION_RETURN_TRIPLE(Name) \ |
| 306 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) | 304 RUNTIME_FUNCTION_RETURNS_TYPE(ObjectTriple, Name) |
| 307 | 305 |
| 308 } // namespace internal | 306 } // namespace internal |
| 309 } // namespace v8 | 307 } // namespace v8 |
| 310 | 308 |
| 311 #endif // V8_ARGUMENTS_H_ | 309 #endif // V8_ARGUMENTS_H_ |
| OLD | NEW |