OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2318 | 2318 |
2319 Label non_callable, non_function, non_smi; | 2319 Label non_callable, non_function, non_smi; |
2320 __ JumpIfSmi(r4, &non_callable); | 2320 __ JumpIfSmi(r4, &non_callable); |
2321 __ bind(&non_smi); | 2321 __ bind(&non_smi); |
2322 __ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE); | 2322 __ CompareObjectType(r4, r7, r8, JS_FUNCTION_TYPE); |
2323 __ Jump(masm->isolate()->builtins()->CallFunction(mode, tail_call_mode), | 2323 __ Jump(masm->isolate()->builtins()->CallFunction(mode, tail_call_mode), |
2324 RelocInfo::CODE_TARGET, eq); | 2324 RelocInfo::CODE_TARGET, eq); |
2325 __ cmpi(r8, Operand(JS_BOUND_FUNCTION_TYPE)); | 2325 __ cmpi(r8, Operand(JS_BOUND_FUNCTION_TYPE)); |
2326 __ Jump(masm->isolate()->builtins()->CallBoundFunction(tail_call_mode), | 2326 __ Jump(masm->isolate()->builtins()->CallBoundFunction(tail_call_mode), |
2327 RelocInfo::CODE_TARGET, eq); | 2327 RelocInfo::CODE_TARGET, eq); |
| 2328 |
| 2329 // Check if target has a [[Call]] internal method. |
| 2330 __ lbz(r7, FieldMemOperand(r7, Map::kBitFieldOffset)); |
| 2331 __ TestBit(r7, Map::kIsCallable, r0); |
| 2332 __ beq(&non_callable, cr0); |
| 2333 |
2328 __ cmpi(r8, Operand(JS_PROXY_TYPE)); | 2334 __ cmpi(r8, Operand(JS_PROXY_TYPE)); |
2329 __ bne(&non_function); | 2335 __ bne(&non_function); |
2330 | 2336 |
2331 // 0. Prepare for tail call if necessary. | 2337 // 0. Prepare for tail call if necessary. |
2332 if (tail_call_mode == TailCallMode::kAllow) { | 2338 if (tail_call_mode == TailCallMode::kAllow) { |
2333 PrepareForTailCall(masm, r3, r6, r7, r8); | 2339 PrepareForTailCall(masm, r3, r6, r7, r8); |
2334 } | 2340 } |
2335 | 2341 |
2336 // 1. Runtime fallback for Proxy [[Call]]. | 2342 // 1. Runtime fallback for Proxy [[Call]]. |
2337 __ Push(r4); | 2343 __ Push(r4); |
2338 // Increase the arguments size to include the pushed function and the | 2344 // Increase the arguments size to include the pushed function and the |
2339 // existing receiver on the stack. | 2345 // existing receiver on the stack. |
2340 __ addi(r3, r3, Operand(2)); | 2346 __ addi(r3, r3, Operand(2)); |
2341 // Tail-call to the runtime. | 2347 // Tail-call to the runtime. |
2342 __ JumpToExternalReference( | 2348 __ JumpToExternalReference( |
2343 ExternalReference(Runtime::kJSProxyCall, masm->isolate())); | 2349 ExternalReference(Runtime::kJSProxyCall, masm->isolate())); |
2344 | 2350 |
2345 // 2. Call to something else, which might have a [[Call]] internal method (if | 2351 // 2. Call to something else, which might have a [[Call]] internal method (if |
2346 // not we raise an exception). | 2352 // not we raise an exception). |
2347 __ bind(&non_function); | 2353 __ bind(&non_function); |
2348 // Check if target has a [[Call]] internal method. | |
2349 __ lbz(r7, FieldMemOperand(r7, Map::kBitFieldOffset)); | |
2350 __ TestBit(r7, Map::kIsCallable, r0); | |
2351 __ beq(&non_callable, cr0); | |
2352 // Overwrite the original receiver the (original) target. | 2354 // Overwrite the original receiver the (original) target. |
2353 __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); | 2355 __ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2)); |
2354 __ StorePX(r4, MemOperand(sp, r8)); | 2356 __ StorePX(r4, MemOperand(sp, r8)); |
2355 // Let the "call_as_function_delegate" take care of the rest. | 2357 // Let the "call_as_function_delegate" take care of the rest. |
2356 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, r4); | 2358 __ LoadNativeContextSlot(Context::CALL_AS_FUNCTION_DELEGATE_INDEX, r4); |
2357 __ Jump(masm->isolate()->builtins()->CallFunction( | 2359 __ Jump(masm->isolate()->builtins()->CallFunction( |
2358 ConvertReceiverMode::kNotNullOrUndefined, tail_call_mode), | 2360 ConvertReceiverMode::kNotNullOrUndefined, tail_call_mode), |
2359 RelocInfo::CODE_TARGET); | 2361 RelocInfo::CODE_TARGET); |
2360 | 2362 |
2361 // 3. Call to something that is not callable. | 2363 // 3. Call to something that is not callable. |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2649 __ bkpt(0); | 2651 __ bkpt(0); |
2650 } | 2652 } |
2651 } | 2653 } |
2652 | 2654 |
2653 | 2655 |
2654 #undef __ | 2656 #undef __ |
2655 } // namespace internal | 2657 } // namespace internal |
2656 } // namespace v8 | 2658 } // namespace v8 |
2657 | 2659 |
2658 #endif // V8_TARGET_ARCH_PPC | 2660 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |