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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 // Reload true/false because they were clobbered in the builtin call. | 1636 // Reload true/false because they were clobbered in the builtin call. |
1637 __ LoadTrueFalseRoots(res_true, res_false); | 1637 __ LoadTrueFalseRoots(res_true, res_false); |
1638 __ Cmp(result, 0); | 1638 __ Cmp(result, 0); |
1639 __ Csel(result, res_true, res_false, eq); | 1639 __ Csel(result, res_true, res_false, eq); |
1640 } | 1640 } |
1641 __ Ret(); | 1641 __ Ret(); |
1642 } | 1642 } |
1643 | 1643 |
1644 | 1644 |
1645 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 1645 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
1646 CHECK(!has_new_target()); | |
1647 Register arg_count = ArgumentsAccessReadDescriptor::parameter_count(); | 1646 Register arg_count = ArgumentsAccessReadDescriptor::parameter_count(); |
1648 Register key = ArgumentsAccessReadDescriptor::index(); | 1647 Register key = ArgumentsAccessReadDescriptor::index(); |
1649 DCHECK(arg_count.is(x0)); | 1648 DCHECK(arg_count.is(x0)); |
1650 DCHECK(key.is(x1)); | 1649 DCHECK(key.is(x1)); |
1651 | 1650 |
1652 // The displacement is the offset of the last parameter (if any) relative | 1651 // The displacement is the offset of the last parameter (if any) relative |
1653 // to the frame pointer. | 1652 // to the frame pointer. |
1654 static const int kDisplacement = | 1653 static const int kDisplacement = |
1655 StandardFrameConstants::kCallerSPOffset - kPointerSize; | 1654 StandardFrameConstants::kCallerSPOffset - kPointerSize; |
1656 | 1655 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); | 1692 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); |
1694 } | 1693 } |
1695 | 1694 |
1696 | 1695 |
1697 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { | 1696 void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { |
1698 // Stack layout on entry. | 1697 // Stack layout on entry. |
1699 // jssp[0]: number of parameters (tagged) | 1698 // jssp[0]: number of parameters (tagged) |
1700 // jssp[8]: address of receiver argument | 1699 // jssp[8]: address of receiver argument |
1701 // jssp[16]: function | 1700 // jssp[16]: function |
1702 | 1701 |
1703 CHECK(!has_new_target()); | |
1704 | |
1705 // Check if the calling frame is an arguments adaptor frame. | 1702 // Check if the calling frame is an arguments adaptor frame. |
1706 Label runtime; | 1703 Label runtime; |
1707 Register caller_fp = x10; | 1704 Register caller_fp = x10; |
1708 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 1705 __ Ldr(caller_fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
1709 // Load and untag the context. | 1706 // Load and untag the context. |
1710 __ Ldr(w11, UntagSmiMemOperand(caller_fp, | 1707 __ Ldr(w11, UntagSmiMemOperand(caller_fp, |
1711 StandardFrameConstants::kContextOffset)); | 1708 StandardFrameConstants::kContextOffset)); |
1712 __ Cmp(w11, StackFrame::ARGUMENTS_ADAPTOR); | 1709 __ Cmp(w11, StackFrame::ARGUMENTS_ADAPTOR); |
1713 __ B(ne, &runtime); | 1710 __ B(ne, &runtime); |
1714 | 1711 |
(...skipping 11 matching lines...) Expand all Loading... |
1726 | 1723 |
1727 | 1724 |
1728 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { | 1725 void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
1729 // Stack layout on entry. | 1726 // Stack layout on entry. |
1730 // jssp[0]: number of parameters (tagged) | 1727 // jssp[0]: number of parameters (tagged) |
1731 // jssp[8]: address of receiver argument | 1728 // jssp[8]: address of receiver argument |
1732 // jssp[16]: function | 1729 // jssp[16]: function |
1733 // | 1730 // |
1734 // Returns pointer to result object in x0. | 1731 // Returns pointer to result object in x0. |
1735 | 1732 |
1736 CHECK(!has_new_target()); | |
1737 | |
1738 // Note: arg_count_smi is an alias of param_count_smi. | 1733 // Note: arg_count_smi is an alias of param_count_smi. |
1739 Register arg_count_smi = x3; | 1734 Register arg_count_smi = x3; |
1740 Register param_count_smi = x3; | 1735 Register param_count_smi = x3; |
1741 Register param_count = x7; | 1736 Register param_count = x7; |
1742 Register recv_arg = x14; | 1737 Register recv_arg = x14; |
1743 Register function = x4; | 1738 Register function = x4; |
1744 __ Pop(param_count_smi, recv_arg, function); | 1739 __ Pop(param_count_smi, recv_arg, function); |
1745 __ SmiUntag(param_count, param_count_smi); | 1740 __ SmiUntag(param_count, param_count_smi); |
1746 | 1741 |
1747 // Check if the calling frame is an arguments adaptor frame. | 1742 // Check if the calling frame is an arguments adaptor frame. |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2054 // x2 params pointer to parameters | 2049 // x2 params pointer to parameters |
2055 // x3 function function pointer | 2050 // x3 function function pointer |
2056 // x11 caller_fp caller's frame pointer | 2051 // x11 caller_fp caller's frame pointer |
2057 // x13 param_count number of parameters passed to function | 2052 // x13 param_count number of parameters passed to function |
2058 | 2053 |
2059 // Patch the argument length and parameters pointer. | 2054 // Patch the argument length and parameters pointer. |
2060 __ Ldr(param_count_smi, | 2055 __ Ldr(param_count_smi, |
2061 MemOperand(caller_fp, | 2056 MemOperand(caller_fp, |
2062 ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2057 ArgumentsAdaptorFrameConstants::kLengthOffset)); |
2063 __ SmiUntag(param_count, param_count_smi); | 2058 __ SmiUntag(param_count, param_count_smi); |
2064 if (has_new_target()) { | |
2065 // Skip new.target: it is not a part of arguments. | |
2066 __ Sub(param_count, param_count, Operand(1)); | |
2067 __ SmiTag(param_count_smi, param_count); | |
2068 } | |
2069 __ Add(x10, caller_fp, Operand(param_count, LSL, kPointerSizeLog2)); | 2059 __ Add(x10, caller_fp, Operand(param_count, LSL, kPointerSizeLog2)); |
2070 __ Add(params, x10, StandardFrameConstants::kCallerSPOffset); | 2060 __ Add(params, x10, StandardFrameConstants::kCallerSPOffset); |
2071 | 2061 |
2072 // Try the new space allocation. Start out with computing the size of the | 2062 // Try the new space allocation. Start out with computing the size of the |
2073 // arguments object and the elements array in words. | 2063 // arguments object and the elements array in words. |
2074 Register size = x10; | 2064 Register size = x10; |
2075 __ Bind(&try_allocate); | 2065 __ Bind(&try_allocate); |
2076 __ Add(size, param_count, FixedArray::kHeaderSize / kPointerSize); | 2066 __ Add(size, param_count, FixedArray::kHeaderSize / kPointerSize); |
2077 __ Cmp(param_count, 0); | 2067 __ Cmp(param_count, 0); |
2078 __ CzeroX(size, eq); | 2068 __ CzeroX(size, eq); |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2942 __ Ldr(x5, FieldMemOperand(x2, AllocationSite::kMapOffset)); | 2932 __ Ldr(x5, FieldMemOperand(x2, AllocationSite::kMapOffset)); |
2943 __ JumpIfRoot(x5, Heap::kAllocationSiteMapRootIndex, | 2933 __ JumpIfRoot(x5, Heap::kAllocationSiteMapRootIndex, |
2944 &feedback_register_initialized); | 2934 &feedback_register_initialized); |
2945 __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); | 2935 __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); |
2946 __ bind(&feedback_register_initialized); | 2936 __ bind(&feedback_register_initialized); |
2947 } | 2937 } |
2948 | 2938 |
2949 __ AssertUndefinedOrAllocationSite(x2, x5); | 2939 __ AssertUndefinedOrAllocationSite(x2, x5); |
2950 } | 2940 } |
2951 | 2941 |
2952 if (IsSuperConstructorCall()) { | 2942 __ Mov(x3, function); |
2953 __ Mov(x4, Operand(1 * kPointerSize)); | |
2954 __ Add(x4, x4, Operand(x0, LSL, kPointerSizeLog2)); | |
2955 __ Peek(x3, x4); | |
2956 } else { | |
2957 __ Mov(x3, function); | |
2958 } | |
2959 | 2943 |
2960 // Jump to the function-specific construct stub. | 2944 // Jump to the function-specific construct stub. |
2961 Register jump_reg = x4; | 2945 Register jump_reg = x4; |
2962 Register shared_func_info = jump_reg; | 2946 Register shared_func_info = jump_reg; |
2963 Register cons_stub = jump_reg; | 2947 Register cons_stub = jump_reg; |
2964 Register cons_stub_code = jump_reg; | 2948 Register cons_stub_code = jump_reg; |
2965 __ Ldr(shared_func_info, | 2949 __ Ldr(shared_func_info, |
2966 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); | 2950 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
2967 __ Ldr(cons_stub, | 2951 __ Ldr(cons_stub, |
2968 FieldMemOperand(shared_func_info, | 2952 FieldMemOperand(shared_func_info, |
(...skipping 2465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5434 kStackUnwindSpace, NULL, spill_offset, | 5418 kStackUnwindSpace, NULL, spill_offset, |
5435 MemOperand(fp, 6 * kPointerSize), NULL); | 5419 MemOperand(fp, 6 * kPointerSize), NULL); |
5436 } | 5420 } |
5437 | 5421 |
5438 | 5422 |
5439 #undef __ | 5423 #undef __ |
5440 | 5424 |
5441 } } // namespace v8::internal | 5425 } } // namespace v8::internal |
5442 | 5426 |
5443 #endif // V8_TARGET_ARCH_ARM64 | 5427 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |