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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // | 127 // |
128 // A builtin function is defined by writing: | 128 // A builtin function is defined by writing: |
129 // | 129 // |
130 // BUILTIN(name) { | 130 // BUILTIN(name) { |
131 // ... | 131 // ... |
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( \ | 138 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ |
139 name##ArgumentsType args, 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 name##ArgumentsType args(args_length, args_object); \ | 142 name##ArgumentsType args(args_length, args_object); \ |
143 return Builtin_Impl_##name(args, isolate); \ | 143 isolate->counters()->runtime_calls()->Increment(); \ |
144 } \ | 144 return Builtin_Impl_##name(args, isolate); \ |
145 MUST_USE_RESULT static Object* Builtin_Impl_##name( \ | 145 } \ |
146 name##ArgumentsType args, Isolate* isolate) | 146 MUST_USE_RESULT static Object* Builtin_Impl_##name(name##ArgumentsType args, \ |
147 | 147 Isolate* isolate) |
148 | 148 |
149 // ---------------------------------------------------------------------------- | 149 // ---------------------------------------------------------------------------- |
150 | 150 |
151 | 151 |
152 #define CHECK_RECEIVER(Type, name, method) \ | 152 #define CHECK_RECEIVER(Type, name, method) \ |
153 if (!args.receiver()->Is##Type()) { \ | 153 if (!args.receiver()->Is##Type()) { \ |
154 THROW_NEW_ERROR_RETURN_FAILURE( \ | 154 THROW_NEW_ERROR_RETURN_FAILURE( \ |
155 isolate, \ | 155 isolate, \ |
156 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, \ | 156 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, \ |
157 isolate->factory()->NewStringFromAsciiChecked(method), \ | 157 isolate->factory()->NewStringFromAsciiChecked(method), \ |
(...skipping 4027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4185 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 4185 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
4186 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 4186 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
4187 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4187 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
4188 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4188 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
4189 #undef DEFINE_BUILTIN_ACCESSOR_C | 4189 #undef DEFINE_BUILTIN_ACCESSOR_C |
4190 #undef DEFINE_BUILTIN_ACCESSOR_A | 4190 #undef DEFINE_BUILTIN_ACCESSOR_A |
4191 | 4191 |
4192 | 4192 |
4193 } // namespace internal | 4193 } // namespace internal |
4194 } // namespace v8 | 4194 } // namespace v8 |
OLD | NEW |