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 Object* value; \ |
145 isolate->counters()->runtime_calls()->Increment(); \ | 146 isolate->counters()->runtime_calls()->Increment(); \ |
146 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ | |
147 RuntimeCallTimerScope timer(isolate, &stats->Builtin_##name); \ | |
148 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), \ | 147 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), \ |
149 "V8.Builtin_" #name); \ | 148 "V8.Builtin_" #name); \ |
150 name##ArgumentsType args(args_length, args_object); \ | 149 name##ArgumentsType args(args_length, args_object); \ |
151 Object* value = Builtin_Impl_##name(args, isolate); \ | 150 if (FLAG_runtime_call_stats) { \ |
| 151 RuntimeCallStats* stats = isolate->counters()->runtime_call_stats(); \ |
| 152 RuntimeCallTimerScope timer(isolate, &stats->Builtin_##name); \ |
| 153 value = Builtin_Impl_##name(args, isolate); \ |
| 154 } else { \ |
| 155 value = Builtin_Impl_##name(args, isolate); \ |
| 156 } \ |
152 return value; \ | 157 return value; \ |
153 } \ | 158 } \ |
154 \ | 159 \ |
155 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ | 160 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ |
156 Isolate* isolate) | 161 Isolate* isolate) |
157 | 162 |
158 // ---------------------------------------------------------------------------- | 163 // ---------------------------------------------------------------------------- |
159 | 164 |
160 | 165 |
161 #define CHECK_RECEIVER(Type, name, method) \ | 166 #define CHECK_RECEIVER(Type, name, method) \ |
(...skipping 4376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4538 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 4543 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
4539 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 4544 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
4540 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4545 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
4541 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4546 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
4542 #undef DEFINE_BUILTIN_ACCESSOR_C | 4547 #undef DEFINE_BUILTIN_ACCESSOR_C |
4543 #undef DEFINE_BUILTIN_ACCESSOR_A | 4548 #undef DEFINE_BUILTIN_ACCESSOR_A |
4544 | 4549 |
4545 | 4550 |
4546 } // namespace internal | 4551 } // namespace internal |
4547 } // namespace v8 | 4552 } // namespace v8 |
OLD | NEW |