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