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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 isolate->counters()->runtime_calls()->Increment(); \ | 145 isolate->counters()->runtime_calls()->Increment(); \ |
146 base::ElapsedTimer timer; \ | 146 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ |
147 if (FLAG_runtime_call_stats) { \ | 147 RuntimeCallTimerScope timer(isolate, &stats->Builtin_##name); \ |
148 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ | |
149 stats->Enter(&stats->Builtin_##name); \ | |
150 timer.Start(); \ | |
151 } \ | |
152 name##ArgumentsType args(args_length, args_object); \ | 148 name##ArgumentsType args(args_length, args_object); \ |
153 Object* value = Builtin_Impl_##name(args, isolate); \ | 149 Object* value = Builtin_Impl_##name(args, isolate); \ |
154 if (FLAG_runtime_call_stats) { \ | |
155 isolate->counters()->runtime_call_stats()->Leave(timer.Elapsed()); \ | |
156 } \ | |
157 return value; \ | 150 return value; \ |
158 } \ | 151 } \ |
159 \ | 152 \ |
160 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ | 153 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ |
161 Isolate* isolate) | 154 Isolate* isolate) |
162 | 155 |
163 // ---------------------------------------------------------------------------- | 156 // ---------------------------------------------------------------------------- |
164 | 157 |
165 | 158 |
166 #define CHECK_RECEIVER(Type, name, method) \ | 159 #define CHECK_RECEIVER(Type, name, method) \ |
(...skipping 4395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4562 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 4555 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
4563 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 4556 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
4564 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4557 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
4565 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4558 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
4566 #undef DEFINE_BUILTIN_ACCESSOR_C | 4559 #undef DEFINE_BUILTIN_ACCESSOR_C |
4567 #undef DEFINE_BUILTIN_ACCESSOR_A | 4560 #undef DEFINE_BUILTIN_ACCESSOR_A |
4568 | 4561 |
4569 | 4562 |
4570 } // namespace internal | 4563 } // namespace internal |
4571 } // namespace v8 | 4564 } // namespace v8 |
OLD | NEW |