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 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1961 | 1961 |
1962 // Prepare for tail call only if the debugger is not active. | 1962 // Prepare for tail call only if the debugger is not active. |
1963 Label done; | 1963 Label done; |
1964 ExternalReference debug_is_active = | 1964 ExternalReference debug_is_active = |
1965 ExternalReference::debug_is_active_address(masm->isolate()); | 1965 ExternalReference::debug_is_active_address(masm->isolate()); |
1966 __ Mov(scratch1, Operand(debug_is_active)); | 1966 __ Mov(scratch1, Operand(debug_is_active)); |
1967 __ Ldrb(scratch1, MemOperand(scratch1)); | 1967 __ Ldrb(scratch1, MemOperand(scratch1)); |
1968 __ Cmp(scratch1, Operand(0)); | 1968 __ Cmp(scratch1, Operand(0)); |
1969 __ B(ne, &done); | 1969 __ B(ne, &done); |
1970 | 1970 |
1971 // Drop possible internal frame pushed for calling CallICStub. | |
1972 // TODO(mythria): when we tail call the CallICStub, remove this. | |
1973 { | |
1974 Label no_internal_callic_frame; | |
1975 __ Ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); | |
1976 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::INTERNAL))); | |
1977 __ B(ne, &no_internal_callic_frame); | |
1978 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | |
1979 __ bind(&no_internal_callic_frame); | |
1980 } | |
1981 | |
1982 // Drop possible interpreter handler/stub frame. | 1971 // Drop possible interpreter handler/stub frame. |
1983 { | 1972 { |
1984 Label no_interpreter_frame; | 1973 Label no_interpreter_frame; |
1985 __ Ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); | 1974 __ Ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); |
1986 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); | 1975 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); |
1987 __ B(ne, &no_interpreter_frame); | 1976 __ B(ne, &no_interpreter_frame); |
1988 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1977 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1989 __ bind(&no_interpreter_frame); | 1978 __ bind(&no_interpreter_frame); |
1990 } | 1979 } |
1991 | 1980 |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2455 RelocInfo::CODE_TARGET); | 2444 RelocInfo::CODE_TARGET); |
2456 } | 2445 } |
2457 | 2446 |
2458 // Called Construct on an Object that doesn't have a [[Construct]] internal | 2447 // Called Construct on an Object that doesn't have a [[Construct]] internal |
2459 // method. | 2448 // method. |
2460 __ bind(&non_constructor); | 2449 __ bind(&non_constructor); |
2461 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), | 2450 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), |
2462 RelocInfo::CODE_TARGET); | 2451 RelocInfo::CODE_TARGET); |
2463 } | 2452 } |
2464 | 2453 |
2465 static void Generate_InterpreterPushArgs(MacroAssembler* masm, | |
2466 Register num_args, | |
2467 Register start_addr) { | |
2468 // Find the address of the last argument. | |
2469 __ add(x5, num_args, Operand(1)); // Add one for receiver. | |
2470 __ lsl(x5, x5, kPointerSizeLog2); | |
2471 __ sub(x6, start_addr, x5); | |
2472 | |
2473 // Push the arguments. | |
2474 Label loop_header, loop_check; | |
2475 __ Mov(x7, jssp); | |
2476 __ Claim(x5, 1); | |
2477 __ B(&loop_check); | |
2478 __ Bind(&loop_header); | |
2479 // TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned. | |
2480 __ Ldr(x5, MemOperand(start_addr, -kPointerSize, PostIndex)); | |
2481 __ Str(x5, MemOperand(x7, -kPointerSize, PreIndex)); | |
2482 __ Bind(&loop_check); | |
2483 __ Cmp(start_addr, x6); | |
2484 __ B(gt, &loop_header); | |
2485 } | |
2486 | |
2487 // static | |
2488 void Builtins::Generate_InterpreterPushArgsAndCallICImpl( | |
2489 MacroAssembler* masm, TailCallMode tail_call_mode) { | |
2490 // ----------- S t a t e ------------- | |
2491 // -- x0 : the number of arguments (not including the receiver) | |
2492 // -- x4 : the address of the first argument to be pushed. Subsequent | |
2493 // arguments should be consecutive above this, in the same order as | |
2494 // they are to be pushed onto the stack. | |
2495 // -- x1 : the target to call (can be any Object). | |
2496 // -- x3 : feedback vector slot id | |
2497 // -- x2 : type feedback vector | |
2498 // ----------------------------------- | |
2499 | |
2500 { | |
2501 FrameScope scope(masm, StackFrame::INTERNAL); | |
2502 | |
2503 // Push arguments to stack. Clobbers x5-x7 registers. | |
2504 Generate_InterpreterPushArgs(masm, x0, x4); | |
2505 | |
2506 // Call via the CallIC stub. | |
2507 CallICState call_ic_state(0, ConvertReceiverMode::kAny, tail_call_mode, | |
2508 true); | |
2509 CallICStub stub(masm->isolate(), call_ic_state); | |
2510 // TODO(mythria): This should be replaced by a TailCallStub, when we | |
2511 // update the code to find the target IC from jump instructions. | |
2512 __ CallStub(&stub); | |
2513 } | |
2514 __ Ret(); | |
2515 } | |
2516 | 2454 |
2517 // static | 2455 // static |
2518 void Builtins::Generate_InterpreterPushArgsAndCallImpl( | 2456 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
2519 MacroAssembler* masm, TailCallMode tail_call_mode) { | 2457 MacroAssembler* masm, TailCallMode tail_call_mode) { |
2520 // ----------- S t a t e ------------- | 2458 // ----------- S t a t e ------------- |
2521 // -- x0 : the number of arguments (not including the receiver) | 2459 // -- x0 : the number of arguments (not including the receiver) |
2522 // -- x2 : the address of the first argument to be pushed. Subsequent | 2460 // -- x2 : the address of the first argument to be pushed. Subsequent |
2523 // arguments should be consecutive above this, in the same order as | 2461 // arguments should be consecutive above this, in the same order as |
2524 // they are to be pushed onto the stack. | 2462 // they are to be pushed onto the stack. |
2525 // -- x1 : the target to call (can be any Object). | 2463 // -- x1 : the target to call (can be any Object). |
2526 // ----------------------------------- | 2464 // ----------------------------------- |
2527 | 2465 |
2528 // Push arguments to stack. Clobbers x5-x7 registers. | 2466 // Find the address of the last argument. |
2529 Generate_InterpreterPushArgs(masm, x0, x2); | 2467 __ add(x3, x0, Operand(1)); // Add one for receiver. |
| 2468 __ lsl(x3, x3, kPointerSizeLog2); |
| 2469 __ sub(x4, x2, x3); |
| 2470 |
| 2471 // Push the arguments. |
| 2472 Label loop_header, loop_check; |
| 2473 __ Mov(x5, jssp); |
| 2474 __ Claim(x3, 1); |
| 2475 __ B(&loop_check); |
| 2476 __ Bind(&loop_header); |
| 2477 // TODO(rmcilroy): Push two at a time once we ensure we keep stack aligned. |
| 2478 __ Ldr(x3, MemOperand(x2, -kPointerSize, PostIndex)); |
| 2479 __ Str(x3, MemOperand(x5, -kPointerSize, PreIndex)); |
| 2480 __ Bind(&loop_check); |
| 2481 __ Cmp(x2, x4); |
| 2482 __ B(gt, &loop_header); |
2530 | 2483 |
2531 // Call the target. | 2484 // Call the target. |
2532 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 2485 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
2533 tail_call_mode), | 2486 tail_call_mode), |
2534 RelocInfo::CODE_TARGET); | 2487 RelocInfo::CODE_TARGET); |
2535 } | 2488 } |
2536 | 2489 |
2537 | 2490 |
2538 // static | 2491 // static |
2539 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 2492 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2741 } | 2694 } |
2742 } | 2695 } |
2743 | 2696 |
2744 | 2697 |
2745 #undef __ | 2698 #undef __ |
2746 | 2699 |
2747 } // namespace internal | 2700 } // namespace internal |
2748 } // namespace v8 | 2701 } // namespace v8 |
2749 | 2702 |
2750 #endif // V8_TARGET_ARCH_ARM | 2703 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |