OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #ifndef V8_BUILTINS_H_ | 5 #ifndef V8_BUILTINS_H_ |
6 #define V8_BUILTINS_H_ | 6 #define V8_BUILTINS_H_ |
7 | 7 |
8 #include "src/handles.h" | 8 #include "src/handles.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 V(HandleApiCallAsFunction, NO_EXTRA_ARGUMENTS) \ | 78 V(HandleApiCallAsFunction, NO_EXTRA_ARGUMENTS) \ |
79 V(HandleApiCallAsConstructor, NO_EXTRA_ARGUMENTS) \ | 79 V(HandleApiCallAsConstructor, NO_EXTRA_ARGUMENTS) \ |
80 \ | 80 \ |
81 V(RestrictedFunctionPropertiesThrower, NO_EXTRA_ARGUMENTS) \ | 81 V(RestrictedFunctionPropertiesThrower, NO_EXTRA_ARGUMENTS) \ |
82 V(RestrictedStrictArgumentsPropertiesThrower, NO_EXTRA_ARGUMENTS) | 82 V(RestrictedStrictArgumentsPropertiesThrower, NO_EXTRA_ARGUMENTS) |
83 | 83 |
84 // Define list of builtins implemented in assembly. | 84 // Define list of builtins implemented in assembly. |
85 #define BUILTIN_LIST_A(V) \ | 85 #define BUILTIN_LIST_A(V) \ |
86 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 86 V(ArgumentsAdaptorTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
87 \ | 87 \ |
88 V(CallFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 88 V(CallFunction_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, \ |
89 V(Call, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 89 kNoExtraICState) \ |
| 90 V(CallFunction_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ |
| 91 kNoExtraICState) \ |
| 92 V(CallFunction_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 93 V(Call_ReceiverIsNullOrUndefined, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
| 94 V(Call_ReceiverIsNotNullOrUndefined, BUILTIN, UNINITIALIZED, \ |
| 95 kNoExtraICState) \ |
| 96 V(Call_ReceiverIsAny, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
90 \ | 97 \ |
91 V(ConstructFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 98 V(ConstructFunction, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
92 V(ConstructProxy, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 99 V(ConstructProxy, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
93 V(Construct, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 100 V(Construct, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
94 \ | 101 \ |
95 V(InOptimizationQueue, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 102 V(InOptimizationQueue, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
96 V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 103 V(JSConstructStubGeneric, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
97 V(JSConstructStubForDerived, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 104 V(JSConstructStubForDerived, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
98 V(JSConstructStubApi, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 105 V(JSConstructStubApi, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
99 V(JSEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ | 106 V(JSEntryTrampoline, BUILTIN, UNINITIALIZED, kNoExtraICState) \ |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 #define DECLARE_BUILTIN_ACCESSOR_A(name, kind, state, extra) \ | 228 #define DECLARE_BUILTIN_ACCESSOR_A(name, kind, state, extra) \ |
222 Handle<Code> name(); | 229 Handle<Code> name(); |
223 #define DECLARE_BUILTIN_ACCESSOR_H(name, kind) Handle<Code> name(); | 230 #define DECLARE_BUILTIN_ACCESSOR_H(name, kind) Handle<Code> name(); |
224 BUILTIN_LIST_C(DECLARE_BUILTIN_ACCESSOR_C) | 231 BUILTIN_LIST_C(DECLARE_BUILTIN_ACCESSOR_C) |
225 BUILTIN_LIST_A(DECLARE_BUILTIN_ACCESSOR_A) | 232 BUILTIN_LIST_A(DECLARE_BUILTIN_ACCESSOR_A) |
226 BUILTIN_LIST_H(DECLARE_BUILTIN_ACCESSOR_H) | 233 BUILTIN_LIST_H(DECLARE_BUILTIN_ACCESSOR_H) |
227 BUILTIN_LIST_DEBUG_A(DECLARE_BUILTIN_ACCESSOR_A) | 234 BUILTIN_LIST_DEBUG_A(DECLARE_BUILTIN_ACCESSOR_A) |
228 #undef DECLARE_BUILTIN_ACCESSOR_C | 235 #undef DECLARE_BUILTIN_ACCESSOR_C |
229 #undef DECLARE_BUILTIN_ACCESSOR_A | 236 #undef DECLARE_BUILTIN_ACCESSOR_A |
230 | 237 |
| 238 // Convenience wrappers. |
| 239 Handle<Code> CallFunction(ConvertReceiverMode = ConvertReceiverMode::kAny); |
| 240 Handle<Code> Call(ConvertReceiverMode = ConvertReceiverMode::kAny); |
| 241 |
231 Code* builtin(Name name) { | 242 Code* builtin(Name name) { |
232 // Code::cast cannot be used here since we access builtins | 243 // Code::cast cannot be used here since we access builtins |
233 // during the marking phase of mark sweep. See IC::Clear. | 244 // during the marking phase of mark sweep. See IC::Clear. |
234 return reinterpret_cast<Code*>(builtins_[name]); | 245 return reinterpret_cast<Code*>(builtins_[name]); |
235 } | 246 } |
236 | 247 |
237 Address builtin_address(Name name) { | 248 Address builtin_address(Name name) { |
238 return reinterpret_cast<Address>(&builtins_[name]); | 249 return reinterpret_cast<Address>(&builtins_[name]); |
239 } | 250 } |
240 | 251 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 static void Generate_JSEntryTrampoline(MacroAssembler* masm); | 290 static void Generate_JSEntryTrampoline(MacroAssembler* masm); |
280 static void Generate_JSConstructEntryTrampoline(MacroAssembler* masm); | 291 static void Generate_JSConstructEntryTrampoline(MacroAssembler* masm); |
281 static void Generate_NotifyDeoptimized(MacroAssembler* masm); | 292 static void Generate_NotifyDeoptimized(MacroAssembler* masm); |
282 static void Generate_NotifySoftDeoptimized(MacroAssembler* masm); | 293 static void Generate_NotifySoftDeoptimized(MacroAssembler* masm); |
283 static void Generate_NotifyLazyDeoptimized(MacroAssembler* masm); | 294 static void Generate_NotifyLazyDeoptimized(MacroAssembler* masm); |
284 static void Generate_NotifyStubFailure(MacroAssembler* masm); | 295 static void Generate_NotifyStubFailure(MacroAssembler* masm); |
285 static void Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm); | 296 static void Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm); |
286 static void Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm); | 297 static void Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm); |
287 | 298 |
288 // ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) | 299 // ES6 section 9.2.1 [[Call]] ( thisArgument, argumentsList) |
289 static void Generate_CallFunction(MacroAssembler* masm); | 300 static void Generate_CallFunction(MacroAssembler* masm, |
| 301 ConvertReceiverMode mode); |
| 302 static void Generate_CallFunction_ReceiverIsNullOrUndefined( |
| 303 MacroAssembler* masm) { |
| 304 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined); |
| 305 } |
| 306 static void Generate_CallFunction_ReceiverIsNotNullOrUndefined( |
| 307 MacroAssembler* masm) { |
| 308 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined); |
| 309 } |
| 310 static void Generate_CallFunction_ReceiverIsAny(MacroAssembler* masm) { |
| 311 Generate_CallFunction(masm, ConvertReceiverMode::kAny); |
| 312 } |
290 // ES6 section 7.3.12 Call(F, V, [argumentsList]) | 313 // ES6 section 7.3.12 Call(F, V, [argumentsList]) |
291 static void Generate_Call(MacroAssembler* masm); | 314 static void Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode); |
| 315 static void Generate_Call_ReceiverIsNullOrUndefined(MacroAssembler* masm) { |
| 316 Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined); |
| 317 } |
| 318 static void Generate_Call_ReceiverIsNotNullOrUndefined(MacroAssembler* masm) { |
| 319 Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined); |
| 320 } |
| 321 static void Generate_Call_ReceiverIsAny(MacroAssembler* masm) { |
| 322 Generate_Call(masm, ConvertReceiverMode::kAny); |
| 323 } |
292 | 324 |
293 // ES6 section 9.2.2 [[Construct]] ( argumentsList, newTarget) | 325 // ES6 section 9.2.2 [[Construct]] ( argumentsList, newTarget) |
294 static void Generate_ConstructFunction(MacroAssembler* masm); | 326 static void Generate_ConstructFunction(MacroAssembler* masm); |
295 // ES6 section 9.5.14 [[Construct]] ( argumentsList, newTarget) | 327 // ES6 section 9.5.14 [[Construct]] ( argumentsList, newTarget) |
296 static void Generate_ConstructProxy(MacroAssembler* masm); | 328 static void Generate_ConstructProxy(MacroAssembler* masm); |
297 // ES6 section 7.3.13 Construct (F, [argumentsList], [newTarget]) | 329 // ES6 section 7.3.13 Construct (F, [argumentsList], [newTarget]) |
298 static void Generate_Construct(MacroAssembler* masm); | 330 static void Generate_Construct(MacroAssembler* masm); |
299 | 331 |
300 static void Generate_FunctionCall(MacroAssembler* masm); | 332 static void Generate_FunctionCall(MacroAssembler* masm); |
301 static void Generate_FunctionApply(MacroAssembler* masm); | 333 static void Generate_FunctionApply(MacroAssembler* masm); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 friend class BuiltinFunctionTable; | 368 friend class BuiltinFunctionTable; |
337 friend class Isolate; | 369 friend class Isolate; |
338 | 370 |
339 DISALLOW_COPY_AND_ASSIGN(Builtins); | 371 DISALLOW_COPY_AND_ASSIGN(Builtins); |
340 }; | 372 }; |
341 | 373 |
342 } // namespace internal | 374 } // namespace internal |
343 } // namespace v8 | 375 } // namespace v8 |
344 | 376 |
345 #endif // V8_BUILTINS_H_ | 377 #endif // V8_BUILTINS_H_ |
OLD | NEW |