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