OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2293 | 2293 |
2294 Label non_callable, non_function, non_smi; | 2294 Label non_callable, non_function, non_smi; |
2295 __ JumpIfSmi(x1, &non_callable); | 2295 __ JumpIfSmi(x1, &non_callable); |
2296 __ Bind(&non_smi); | 2296 __ Bind(&non_smi); |
2297 __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE); | 2297 __ CompareObjectType(x1, x4, x5, JS_FUNCTION_TYPE); |
2298 __ Jump(masm->isolate()->builtins()->CallFunction(mode, tail_call_mode), | 2298 __ Jump(masm->isolate()->builtins()->CallFunction(mode, tail_call_mode), |
2299 RelocInfo::CODE_TARGET, eq); | 2299 RelocInfo::CODE_TARGET, eq); |
2300 __ Cmp(x5, JS_BOUND_FUNCTION_TYPE); | 2300 __ Cmp(x5, JS_BOUND_FUNCTION_TYPE); |
2301 __ Jump(masm->isolate()->builtins()->CallBoundFunction(tail_call_mode), | 2301 __ Jump(masm->isolate()->builtins()->CallBoundFunction(tail_call_mode), |
2302 RelocInfo::CODE_TARGET, eq); | 2302 RelocInfo::CODE_TARGET, eq); |
| 2303 |
| 2304 // Check if target has a [[Call]] internal method. |
| 2305 __ Ldrb(x4, FieldMemOperand(x4, Map::kBitFieldOffset)); |
| 2306 __ TestAndBranchIfAllClear(x4, 1 << Map::kIsCallable, &non_callable); |
| 2307 |
2303 __ Cmp(x5, JS_PROXY_TYPE); | 2308 __ Cmp(x5, JS_PROXY_TYPE); |
2304 __ B(ne, &non_function); | 2309 __ B(ne, &non_function); |
2305 | 2310 |
2306 // 0. Prepare for tail call if necessary. | 2311 // 0. Prepare for tail call if necessary. |
2307 if (tail_call_mode == TailCallMode::kAllow) { | 2312 if (tail_call_mode == TailCallMode::kAllow) { |
2308 PrepareForTailCall(masm, x0, x3, x4, x5); | 2313 PrepareForTailCall(masm, x0, x3, x4, x5); |
2309 } | 2314 } |
2310 | 2315 |
2311 // 1. Runtime fallback for Proxy [[Call]]. | 2316 // 1. Runtime fallback for Proxy [[Call]]. |
2312 __ Push(x1); | 2317 __ Push(x1); |
2313 // Increase the arguments size to include the pushed function and the | 2318 // Increase the arguments size to include the pushed function and the |
2314 // existing receiver on the stack. | 2319 // existing receiver on the stack. |
2315 __ Add(x0, x0, Operand(2)); | 2320 __ Add(x0, x0, Operand(2)); |
2316 // Tail-call to the runtime. | 2321 // Tail-call to the runtime. |
2317 __ JumpToExternalReference( | 2322 __ JumpToExternalReference( |
2318 ExternalReference(Runtime::kJSProxyCall, masm->isolate())); | 2323 ExternalReference(Runtime::kJSProxyCall, masm->isolate())); |
2319 | 2324 |
2320 // 2. Call to something else, which might have a [[Call]] internal method (if | 2325 // 2. Call to something else, which might have a [[Call]] internal method (if |
2321 // not we raise an exception). | 2326 // not we raise an exception). |
2322 __ Bind(&non_function); | 2327 __ Bind(&non_function); |
2323 // Check if target has a [[Call]] internal method. | |
2324 __ Ldrb(x4, FieldMemOperand(x4, Map::kBitFieldOffset)); | |
2325 __ TestAndBranchIfAllClear(x4, 1 << Map::kIsCallable, &non_callable); | |
2326 // Overwrite the original receiver with the (original) target. | 2328 // Overwrite the original receiver with the (original) target. |
2327 __ Poke(x1, Operand(x0, LSL, kXRegSizeLog2)); | 2329 __ Poke(x1, Operand(x0, LSL, kXRegSizeLog2)); |
2328 // Let the "call_as_function_delegate" take care of the rest. | 2330 // Let the "call_as_function_delegate" take care of the rest. |
2329 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, x1); | 2331 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, x1); |
2330 __ Jump(masm->isolate()->builtins()->CallFunction( | 2332 __ Jump(masm->isolate()->builtins()->CallFunction( |
2331 ConvertReceiverMode::kNotNullOrUndefined, tail_call_mode), | 2333 ConvertReceiverMode::kNotNullOrUndefined, tail_call_mode), |
2332 RelocInfo::CODE_TARGET); | 2334 RelocInfo::CODE_TARGET); |
2333 | 2335 |
2334 // 3. Call to something that is not callable. | 2336 // 3. Call to something that is not callable. |
2335 __ bind(&non_callable); | 2337 __ bind(&non_callable); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2707 } | 2709 } |
2708 } | 2710 } |
2709 | 2711 |
2710 | 2712 |
2711 #undef __ | 2713 #undef __ |
2712 | 2714 |
2713 } // namespace internal | 2715 } // namespace internal |
2714 } // namespace v8 | 2716 } // namespace v8 |
2715 | 2717 |
2716 #endif // V8_TARGET_ARCH_ARM | 2718 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |