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 |
1971 // Drop possible interpreter handler/stub frame. | 1982 // Drop possible interpreter handler/stub frame. |
1972 { | 1983 { |
1973 Label no_interpreter_frame; | 1984 Label no_interpreter_frame; |
1974 __ Ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); | 1985 __ Ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); |
1975 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); | 1986 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); |
1976 __ B(ne, &no_interpreter_frame); | 1987 __ B(ne, &no_interpreter_frame); |
1977 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1988 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1978 __ bind(&no_interpreter_frame); | 1989 __ bind(&no_interpreter_frame); |
1979 } | 1990 } |
1980 | 1991 |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2444 RelocInfo::CODE_TARGET); | 2455 RelocInfo::CODE_TARGET); |
2445 } | 2456 } |
2446 | 2457 |
2447 // Called Construct on an Object that doesn't have a [[Construct]] internal | 2458 // Called Construct on an Object that doesn't have a [[Construct]] internal |
2448 // method. | 2459 // method. |
2449 __ bind(&non_constructor); | 2460 __ bind(&non_constructor); |
2450 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), | 2461 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), |
2451 RelocInfo::CODE_TARGET); | 2462 RelocInfo::CODE_TARGET); |
2452 } | 2463 } |
2453 | 2464 |
| 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 } |
2454 | 2516 |
2455 // static | 2517 // static |
2456 void Builtins::Generate_InterpreterPushArgsAndCallImpl( | 2518 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
2457 MacroAssembler* masm, TailCallMode tail_call_mode) { | 2519 MacroAssembler* masm, TailCallMode tail_call_mode) { |
2458 // ----------- S t a t e ------------- | 2520 // ----------- S t a t e ------------- |
2459 // -- x0 : the number of arguments (not including the receiver) | 2521 // -- x0 : the number of arguments (not including the receiver) |
2460 // -- x2 : the address of the first argument to be pushed. Subsequent | 2522 // -- x2 : the address of the first argument to be pushed. Subsequent |
2461 // arguments should be consecutive above this, in the same order as | 2523 // arguments should be consecutive above this, in the same order as |
2462 // they are to be pushed onto the stack. | 2524 // they are to be pushed onto the stack. |
2463 // -- x1 : the target to call (can be any Object). | 2525 // -- x1 : the target to call (can be any Object). |
2464 // ----------------------------------- | 2526 // ----------------------------------- |
2465 | 2527 |
2466 // Find the address of the last argument. | 2528 // Push arguments to stack. Clobbers x5-x7 registers. |
2467 __ add(x3, x0, Operand(1)); // Add one for receiver. | 2529 Generate_InterpreterPushArgs(masm, x0, x2); |
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); | |
2483 | 2530 |
2484 // Call the target. | 2531 // Call the target. |
2485 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 2532 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
2486 tail_call_mode), | 2533 tail_call_mode), |
2487 RelocInfo::CODE_TARGET); | 2534 RelocInfo::CODE_TARGET); |
2488 } | 2535 } |
2489 | 2536 |
2490 | 2537 |
2491 // static | 2538 // static |
2492 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 2539 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2694 } | 2741 } |
2695 } | 2742 } |
2696 | 2743 |
2697 | 2744 |
2698 #undef __ | 2745 #undef __ |
2699 | 2746 |
2700 } // namespace internal | 2747 } // namespace internal |
2701 } // namespace v8 | 2748 } // namespace v8 |
2702 | 2749 |
2703 #endif // V8_TARGET_ARCH_ARM | 2750 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |