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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // } | 132 // } |
133 // | 133 // |
134 // In the body of the builtin function the arguments can be accessed | 134 // In the body of the builtin function the arguments can be accessed |
135 // through the BuiltinArguments object args. | 135 // through the BuiltinArguments object args. |
136 | 136 |
137 #define BUILTIN(name) \ | 137 #define BUILTIN(name) \ |
138 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ | 138 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ |
139 Isolate* isolate); \ | 139 Isolate* isolate); \ |
140 MUST_USE_RESULT static Object* Builtin_##name( \ | 140 MUST_USE_RESULT static Object* Builtin_##name( \ |
141 int args_length, Object** args_object, Isolate* isolate) { \ | 141 int args_length, Object** args_object, Isolate* isolate) { \ |
| 142 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ |
| 143 stats->Count_Builtin_##name++; \ |
| 144 base::ElapsedTimer timer; \ |
| 145 bool timing = false; \ |
| 146 if (FLAG_runtime_call_stats && !stats->in_runtime_call) { \ |
| 147 stats->in_runtime_call = true; \ |
| 148 timing = true; \ |
| 149 timer.Start(); \ |
| 150 } \ |
142 name##ArgumentsType args(args_length, args_object); \ | 151 name##ArgumentsType args(args_length, args_object); \ |
143 isolate->counters()->runtime_calls()->Increment(); \ | 152 isolate->counters()->runtime_calls()->Increment(); \ |
144 return Builtin_Impl_##name(args, isolate); \ | 153 Object* value = Builtin_Impl_##name(args, isolate); \ |
| 154 if (timing) { \ |
| 155 stats->in_runtime_call = false; \ |
| 156 isolate->counters()->runtime_call_stats()->Time_Builtin_##name += \ |
| 157 timer.Elapsed(); \ |
| 158 } \ |
| 159 return value; \ |
145 } \ | 160 } \ |
| 161 \ |
146 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ | 162 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ |
147 Isolate* isolate) | 163 Isolate* isolate) |
148 | 164 |
149 // ---------------------------------------------------------------------------- | 165 // ---------------------------------------------------------------------------- |
150 | 166 |
151 | 167 |
152 #define CHECK_RECEIVER(Type, name, method) \ | 168 #define CHECK_RECEIVER(Type, name, method) \ |
153 if (!args.receiver()->Is##Type()) { \ | 169 if (!args.receiver()->Is##Type()) { \ |
154 THROW_NEW_ERROR_RETURN_FAILURE( \ | 170 THROW_NEW_ERROR_RETURN_FAILURE( \ |
155 isolate, \ | 171 isolate, \ |
(...skipping 4075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4231 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 4247 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
4232 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 4248 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
4233 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4249 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
4234 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4250 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
4235 #undef DEFINE_BUILTIN_ACCESSOR_C | 4251 #undef DEFINE_BUILTIN_ACCESSOR_C |
4236 #undef DEFINE_BUILTIN_ACCESSOR_A | 4252 #undef DEFINE_BUILTIN_ACCESSOR_A |
4237 | 4253 |
4238 | 4254 |
4239 } // namespace internal | 4255 } // namespace internal |
4240 } // namespace v8 | 4256 } // namespace v8 |
OLD | NEW |