| 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 511 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
| 512 bool is_api_function, | 512 bool is_api_function, |
| 513 bool create_implicit_receiver, | 513 bool create_implicit_receiver, |
| 514 bool check_derived_construct) { | 514 bool check_derived_construct) { |
| 515 // ----------- S t a t e ------------- | 515 // ----------- S t a t e ------------- |
| 516 // -- x0 : number of arguments | 516 // -- x0 : number of arguments |
| 517 // -- x1 : constructor function | 517 // -- x1 : constructor function |
| 518 // -- x2 : allocation site or undefined | 518 // -- x2 : allocation site or undefined |
| 519 // -- x3 : new target | 519 // -- x3 : new target |
| 520 // -- lr : return address | 520 // -- lr : return address |
| 521 // -- cp : context pointer |
| 521 // -- sp[...]: constructor arguments | 522 // -- sp[...]: constructor arguments |
| 522 // ----------------------------------- | 523 // ----------------------------------- |
| 523 | 524 |
| 524 ASM_LOCATION("Builtins::Generate_JSConstructStubHelper"); | 525 ASM_LOCATION("Builtins::Generate_JSConstructStubHelper"); |
| 525 | 526 |
| 526 Isolate* isolate = masm->isolate(); | 527 Isolate* isolate = masm->isolate(); |
| 527 | 528 |
| 528 // Enter a construct frame. | 529 // Enter a construct frame. |
| 529 { | 530 { |
| 530 FrameScope scope(masm, StackFrame::CONSTRUCT); | 531 FrameScope scope(masm, StackFrame::CONSTRUCT); |
| 531 | 532 |
| 532 // Preserve the four incoming parameters on the stack. | 533 // Preserve the four incoming parameters on the stack. |
| 533 Register argc = x0; | 534 Register argc = x0; |
| 534 Register constructor = x1; | 535 Register constructor = x1; |
| 535 Register allocation_site = x2; | 536 Register allocation_site = x2; |
| 536 Register new_target = x3; | 537 Register new_target = x3; |
| 537 | 538 |
| 538 // Preserve the incoming parameters on the stack. | 539 // Preserve the incoming parameters on the stack. |
| 539 __ AssertUndefinedOrAllocationSite(allocation_site, x10); | 540 __ AssertUndefinedOrAllocationSite(allocation_site, x10); |
| 541 __ Push(cp); |
| 540 __ SmiTag(argc); | 542 __ SmiTag(argc); |
| 541 __ Push(allocation_site, argc); | 543 __ Push(allocation_site, argc); |
| 542 | 544 |
| 543 if (create_implicit_receiver) { | 545 if (create_implicit_receiver) { |
| 544 // Allocate the new receiver object. | 546 // Allocate the new receiver object. |
| 545 __ Push(constructor, new_target); | 547 __ Push(constructor, new_target); |
| 546 FastNewObjectStub stub(masm->isolate()); | 548 FastNewObjectStub stub(masm->isolate()); |
| 547 __ CallStub(&stub); | 549 __ CallStub(&stub); |
| 548 __ Mov(x4, x0); | 550 __ Mov(x4, x0); |
| 549 __ Pop(new_target, constructor); | 551 __ Pop(new_target, constructor); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 618 |
| 617 // Store offset of return address for deoptimizer. | 619 // Store offset of return address for deoptimizer. |
| 618 if (create_implicit_receiver && !is_api_function) { | 620 if (create_implicit_receiver && !is_api_function) { |
| 619 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); | 621 masm->isolate()->heap()->SetConstructStubDeoptPCOffset(masm->pc_offset()); |
| 620 } | 622 } |
| 621 | 623 |
| 622 // Restore the context from the frame. | 624 // Restore the context from the frame. |
| 623 // x0: result | 625 // x0: result |
| 624 // jssp[0]: receiver | 626 // jssp[0]: receiver |
| 625 // jssp[1]: number of arguments (smi-tagged) | 627 // jssp[1]: number of arguments (smi-tagged) |
| 626 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 628 __ Ldr(cp, MemOperand(fp, ConstructFrameConstants::kContextOffset)); |
| 627 | 629 |
| 628 if (create_implicit_receiver) { | 630 if (create_implicit_receiver) { |
| 629 // If the result is an object (in the ECMA sense), we should get rid | 631 // If the result is an object (in the ECMA sense), we should get rid |
| 630 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 | 632 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 |
| 631 // on page 74. | 633 // on page 74. |
| 632 Label use_receiver, exit; | 634 Label use_receiver, exit; |
| 633 | 635 |
| 634 // If the result is a smi, it is *not* an object in the ECMA sense. | 636 // If the result is a smi, it is *not* an object in the ECMA sense. |
| 635 // x0: result | 637 // x0: result |
| 636 // jssp[0]: receiver (newly allocated object) | 638 // jssp[0]: receiver (newly allocated object) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 // Called from JSEntryStub::GenerateBody(). | 758 // Called from JSEntryStub::GenerateBody(). |
| 757 Register new_target = x0; | 759 Register new_target = x0; |
| 758 Register function = x1; | 760 Register function = x1; |
| 759 Register receiver = x2; | 761 Register receiver = x2; |
| 760 Register argc = x3; | 762 Register argc = x3; |
| 761 Register argv = x4; | 763 Register argv = x4; |
| 762 Register scratch = x10; | 764 Register scratch = x10; |
| 763 | 765 |
| 764 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 766 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
| 765 | 767 |
| 766 // Clear the context before we push it when entering the internal frame. | |
| 767 __ Mov(cp, 0); | |
| 768 | |
| 769 { | 768 { |
| 770 // Enter an internal frame. | 769 // Enter an internal frame. |
| 771 FrameScope scope(masm, StackFrame::INTERNAL); | 770 FrameScope scope(masm, StackFrame::INTERNAL); |
| 772 | 771 |
| 773 // Setup the context (we need to use the caller context from the isolate). | 772 // Setup the context (we need to use the caller context from the isolate). |
| 774 __ Mov(scratch, Operand(ExternalReference(Isolate::kContextAddress, | 773 __ Mov(scratch, Operand(ExternalReference(Isolate::kContextAddress, |
| 775 masm->isolate()))); | 774 masm->isolate()))); |
| 776 __ Ldr(cp, MemOperand(scratch)); | 775 __ Ldr(cp, MemOperand(scratch)); |
| 777 | 776 |
| 778 __ InitializeRootRegister(); | 777 __ InitializeRootRegister(); |
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 ExternalReference debug_is_active = | 1976 ExternalReference debug_is_active = |
| 1978 ExternalReference::debug_is_active_address(masm->isolate()); | 1977 ExternalReference::debug_is_active_address(masm->isolate()); |
| 1979 __ Mov(scratch1, Operand(debug_is_active)); | 1978 __ Mov(scratch1, Operand(debug_is_active)); |
| 1980 __ Ldrb(scratch1, MemOperand(scratch1)); | 1979 __ Ldrb(scratch1, MemOperand(scratch1)); |
| 1981 __ Cmp(scratch1, Operand(0)); | 1980 __ Cmp(scratch1, Operand(0)); |
| 1982 __ B(ne, &done); | 1981 __ B(ne, &done); |
| 1983 | 1982 |
| 1984 // Drop possible interpreter handler/stub frame. | 1983 // Drop possible interpreter handler/stub frame. |
| 1985 { | 1984 { |
| 1986 Label no_interpreter_frame; | 1985 Label no_interpreter_frame; |
| 1987 __ Ldr(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); | 1986 __ Ldr(scratch3, |
| 1987 MemOperand(fp, CommonFrameConstants::kContextOrFrameTypeOffset)); |
| 1988 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); | 1988 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::STUB))); |
| 1989 __ B(ne, &no_interpreter_frame); | 1989 __ B(ne, &no_interpreter_frame); |
| 1990 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1990 __ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 1991 __ bind(&no_interpreter_frame); | 1991 __ bind(&no_interpreter_frame); |
| 1992 } | 1992 } |
| 1993 | 1993 |
| 1994 // Check if next frame is an arguments adaptor frame. | 1994 // Check if next frame is an arguments adaptor frame. |
| 1995 Register caller_args_count_reg = scratch1; | 1995 Register caller_args_count_reg = scratch1; |
| 1996 Label no_arguments_adaptor, formal_parameter_count_loaded; | 1996 Label no_arguments_adaptor, formal_parameter_count_loaded; |
| 1997 __ Ldr(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1997 __ Ldr(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 1998 __ Ldr(scratch3, | 1998 __ Ldr(scratch3, |
| 1999 MemOperand(scratch2, StandardFrameConstants::kContextOffset)); | 1999 MemOperand(scratch2, CommonFrameConstants::kContextOrFrameTypeOffset)); |
| 2000 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 2000 __ Cmp(scratch3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 2001 __ B(ne, &no_arguments_adaptor); | 2001 __ B(ne, &no_arguments_adaptor); |
| 2002 | 2002 |
| 2003 // Drop current frame and load arguments count from arguments adaptor frame. | 2003 // Drop current frame and load arguments count from arguments adaptor frame. |
| 2004 __ mov(fp, scratch2); | 2004 __ mov(fp, scratch2); |
| 2005 __ Ldr(caller_args_count_reg, | 2005 __ Ldr(caller_args_count_reg, |
| 2006 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2006 MemOperand(fp, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 2007 __ SmiUntag(caller_args_count_reg); | 2007 __ SmiUntag(caller_args_count_reg); |
| 2008 __ B(&formal_parameter_count_loaded); | 2008 __ B(&formal_parameter_count_loaded); |
| 2009 | 2009 |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2670 } | 2670 } |
| 2671 } | 2671 } |
| 2672 | 2672 |
| 2673 | 2673 |
| 2674 #undef __ | 2674 #undef __ |
| 2675 | 2675 |
| 2676 } // namespace internal | 2676 } // namespace internal |
| 2677 } // namespace v8 | 2677 } // namespace v8 |
| 2678 | 2678 |
| 2679 #endif // V8_TARGET_ARCH_ARM | 2679 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |