| 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 #include "src/builtins.h" | 5 #include "src/builtins.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // } | 135 // } |
| 136 // | 136 // |
| 137 // In the body of the builtin function the arguments can be accessed | 137 // In the body of the builtin function the arguments can be accessed |
| 138 // through the BuiltinArguments object args. | 138 // through the BuiltinArguments object args. |
| 139 | 139 |
| 140 #define BUILTIN(name) \ | 140 #define BUILTIN(name) \ |
| 141 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ | 141 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ |
| 142 Isolate* isolate); \ | 142 Isolate* isolate); \ |
| 143 MUST_USE_RESULT static Object* Builtin_##name( \ | 143 MUST_USE_RESULT static Object* Builtin_##name( \ |
| 144 int args_length, Object** args_object, Isolate* isolate) { \ | 144 int args_length, Object** args_object, Isolate* isolate) { \ |
| 145 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ | 145 isolate->counters()->runtime_calls()->Increment(); \ |
| 146 stats->Count_Builtin_##name++; \ | |
| 147 base::ElapsedTimer timer; \ | 146 base::ElapsedTimer timer; \ |
| 148 bool timing = false; \ | 147 if (FLAG_runtime_call_stats) { \ |
| 149 if (FLAG_runtime_call_stats && !stats->in_runtime_call) { \ | 148 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ |
| 150 stats->in_runtime_call = true; \ | 149 stats->Enter(&stats->Builtin_##name); \ |
| 151 timing = true; \ | |
| 152 timer.Start(); \ | 150 timer.Start(); \ |
| 153 } \ | 151 } \ |
| 154 name##ArgumentsType args(args_length, args_object); \ | 152 name##ArgumentsType args(args_length, args_object); \ |
| 155 isolate->counters()->runtime_calls()->Increment(); \ | |
| 156 Object* value = Builtin_Impl_##name(args, isolate); \ | 153 Object* value = Builtin_Impl_##name(args, isolate); \ |
| 157 if (timing) { \ | 154 if (FLAG_runtime_call_stats) { \ |
| 158 stats->in_runtime_call = false; \ | 155 isolate->counters()->runtime_call_stats()->Leave(timer.Elapsed()); \ |
| 159 isolate->counters()->runtime_call_stats()->Time_Builtin_##name += \ | |
| 160 timer.Elapsed(); \ | |
| 161 } \ | 156 } \ |
| 162 return value; \ | 157 return value; \ |
| 163 } \ | 158 } \ |
| 164 \ | 159 \ |
| 165 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ | 160 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ |
| 166 Isolate* isolate) | 161 Isolate* isolate) |
| 167 | 162 |
| 168 // ---------------------------------------------------------------------------- | 163 // ---------------------------------------------------------------------------- |
| 169 | 164 |
| 170 | 165 |
| (...skipping 4216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4387 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 4382 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 4388 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 4383 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 4389 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4384 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 4390 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4385 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 4391 #undef DEFINE_BUILTIN_ACCESSOR_C | 4386 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 4392 #undef DEFINE_BUILTIN_ACCESSOR_A | 4387 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 4393 | 4388 |
| 4394 | 4389 |
| 4395 } // namespace internal | 4390 } // namespace internal |
| 4396 } // namespace v8 | 4391 } // namespace v8 |
| OLD | NEW |