| 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 } \ | |
| 151 name##ArgumentsType args(args_length, args_object); \ | 142 name##ArgumentsType args(args_length, args_object); \ |
| 152 isolate->counters()->runtime_calls()->Increment(); \ | 143 isolate->counters()->runtime_calls()->Increment(); \ |
| 153 Object* value = Builtin_Impl_##name(args, isolate); \ | 144 return 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; \ | |
| 160 } \ | 145 } \ |
| 161 \ | |
| 162 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ | 146 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ |
| 163 Isolate* isolate) | 147 Isolate* isolate) |
| 164 | 148 |
| 165 // ---------------------------------------------------------------------------- | 149 // ---------------------------------------------------------------------------- |
| 166 | 150 |
| 167 | 151 |
| 168 #define CHECK_RECEIVER(Type, name, method) \ | 152 #define CHECK_RECEIVER(Type, name, method) \ |
| 169 if (!args.receiver()->Is##Type()) { \ | 153 if (!args.receiver()->Is##Type()) { \ |
| 170 THROW_NEW_ERROR_RETURN_FAILURE( \ | 154 THROW_NEW_ERROR_RETURN_FAILURE( \ |
| 171 isolate, \ | 155 isolate, \ |
| (...skipping 4075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4247 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 4231 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 4248 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 4232 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 4249 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4233 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 4250 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4234 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 4251 #undef DEFINE_BUILTIN_ACCESSOR_C | 4235 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 4252 #undef DEFINE_BUILTIN_ACCESSOR_A | 4236 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 4253 | 4237 |
| 4254 | 4238 |
| 4255 } // namespace internal | 4239 } // namespace internal |
| 4256 } // namespace v8 | 4240 } // namespace v8 |
| OLD | NEW |