| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 __ IncrementCounter(counters->string_ctor_string_value(), 1, x10, x11); | 222 __ IncrementCounter(counters->string_ctor_string_value(), 1, x10, x11); |
| 223 __ B(&argument_is_string); | 223 __ B(&argument_is_string); |
| 224 | 224 |
| 225 // Invoke the conversion builtin and put the result into x2. | 225 // Invoke the conversion builtin and put the result into x2. |
| 226 __ Bind(&convert_argument); | 226 __ Bind(&convert_argument); |
| 227 __ Push(function); // Preserve the function. | 227 __ Push(function); // Preserve the function. |
| 228 __ IncrementCounter(counters->string_ctor_conversions(), 1, x10, x11); | 228 __ IncrementCounter(counters->string_ctor_conversions(), 1, x10, x11); |
| 229 { | 229 { |
| 230 FrameScope scope(masm, StackFrame::INTERNAL); | 230 FrameScope scope(masm, StackFrame::INTERNAL); |
| 231 __ Push(arg); | 231 __ Push(arg); |
| 232 __ InvokeBuiltin(Builtins::TO_STRING, CALL_FUNCTION); | 232 __ InvokeBuiltin(Context::TO_STRING_BUILTIN_INDEX, CALL_FUNCTION); |
| 233 } | 233 } |
| 234 __ Pop(function); | 234 __ Pop(function); |
| 235 __ Mov(argument, x0); | 235 __ Mov(argument, x0); |
| 236 __ B(&argument_is_string); | 236 __ B(&argument_is_string); |
| 237 | 237 |
| 238 // Load the empty string into x2, remove the receiver from the | 238 // Load the empty string into x2, remove the receiver from the |
| 239 // stack, and jump back to the case where the argument is a string. | 239 // stack, and jump back to the case where the argument is a string. |
| 240 __ Bind(&no_arguments); | 240 __ Bind(&no_arguments); |
| 241 __ LoadRoot(argument, Heap::kempty_stringRootIndex); | 241 __ LoadRoot(argument, Heap::kempty_stringRootIndex); |
| 242 __ Drop(1); | 242 __ Drop(1); |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 DCHECK(argc_is_tagged == kArgcIsUntaggedInt); | 773 DCHECK(argc_is_tagged == kArgcIsUntaggedInt); |
| 774 __ Cmp(x10, Operand(argc, LSL, kPointerSizeLog2)); | 774 __ Cmp(x10, Operand(argc, LSL, kPointerSizeLog2)); |
| 775 } | 775 } |
| 776 __ B(gt, &enough_stack_space); | 776 __ B(gt, &enough_stack_space); |
| 777 // There is not enough stack space, so use a builtin to throw an appropriate | 777 // There is not enough stack space, so use a builtin to throw an appropriate |
| 778 // error. | 778 // error. |
| 779 if (argc_is_tagged == kArgcIsUntaggedInt) { | 779 if (argc_is_tagged == kArgcIsUntaggedInt) { |
| 780 __ SmiTag(argc); | 780 __ SmiTag(argc); |
| 781 } | 781 } |
| 782 __ Push(function, argc); | 782 __ Push(function, argc); |
| 783 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 783 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
| 784 // We should never return from the APPLY_OVERFLOW builtin. | 784 // We should never return from the APPLY_OVERFLOW builtin. |
| 785 if (__ emit_debug_code()) { | 785 if (__ emit_debug_code()) { |
| 786 __ Unreachable(); | 786 __ Unreachable(); |
| 787 } | 787 } |
| 788 | 788 |
| 789 __ Bind(&enough_stack_space); | 789 __ Bind(&enough_stack_space); |
| 790 } | 790 } |
| 791 | 791 |
| 792 | 792 |
| 793 // Input: | 793 // Input: |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 // Load frame size from the BytecodeArray object. | 938 // Load frame size from the BytecodeArray object. |
| 939 __ Ldr(w11, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 939 __ Ldr(w11, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
| 940 BytecodeArray::kFrameSizeOffset)); | 940 BytecodeArray::kFrameSizeOffset)); |
| 941 | 941 |
| 942 // Do a stack check to ensure we don't go over the limit. | 942 // Do a stack check to ensure we don't go over the limit. |
| 943 Label ok; | 943 Label ok; |
| 944 DCHECK(jssp.Is(__ StackPointer())); | 944 DCHECK(jssp.Is(__ StackPointer())); |
| 945 __ Sub(x10, jssp, Operand(x11)); | 945 __ Sub(x10, jssp, Operand(x11)); |
| 946 __ CompareRoot(x10, Heap::kRealStackLimitRootIndex); | 946 __ CompareRoot(x10, Heap::kRealStackLimitRootIndex); |
| 947 __ B(hs, &ok); | 947 __ B(hs, &ok); |
| 948 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 948 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
| 949 __ Bind(&ok); | 949 __ Bind(&ok); |
| 950 | 950 |
| 951 // If ok, push undefined as the initial value for all register file entries. | 951 // If ok, push undefined as the initial value for all register file entries. |
| 952 // Note: there should always be at least one stack slot for the return | 952 // Note: there should always be at least one stack slot for the return |
| 953 // register in the register file. | 953 // register in the register file. |
| 954 Label loop_header; | 954 Label loop_header; |
| 955 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); | 955 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); |
| 956 // TODO(rmcilroy): Ensure we always have an even number of registers to | 956 // TODO(rmcilroy): Ensure we always have an even number of registers to |
| 957 // allow stack to be 16 bit aligned (and remove need for jssp). | 957 // allow stack to be 16 bit aligned (and remove need for jssp). |
| 958 __ Lsr(x11, x11, kPointerSizeLog2); | 958 __ Lsr(x11, x11, kPointerSizeLog2); |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 // call type (0: JS function, 1: function proxy, 2: non-function) | 1431 // call type (0: JS function, 1: function proxy, 2: non-function) |
| 1432 { Label js_function, non_proxy; | 1432 { Label js_function, non_proxy; |
| 1433 __ Cbz(call_type, &js_function); | 1433 __ Cbz(call_type, &js_function); |
| 1434 // Expected number of arguments is 0 for CALL_NON_FUNCTION. | 1434 // Expected number of arguments is 0 for CALL_NON_FUNCTION. |
| 1435 __ Mov(x2, 0); | 1435 __ Mov(x2, 0); |
| 1436 __ Cmp(call_type, static_cast<int>(call_type_func_proxy)); | 1436 __ Cmp(call_type, static_cast<int>(call_type_func_proxy)); |
| 1437 __ B(ne, &non_proxy); | 1437 __ B(ne, &non_proxy); |
| 1438 | 1438 |
| 1439 __ Push(function); // Re-add proxy object as additional argument. | 1439 __ Push(function); // Re-add proxy object as additional argument. |
| 1440 __ Add(argc, argc, 1); | 1440 __ Add(argc, argc, 1); |
| 1441 __ GetBuiltinFunction(function, Builtins::CALL_FUNCTION_PROXY); | 1441 __ GetBuiltinFunction(function, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX); |
| 1442 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1442 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1443 RelocInfo::CODE_TARGET); | 1443 RelocInfo::CODE_TARGET); |
| 1444 | 1444 |
| 1445 __ Bind(&non_proxy); | 1445 __ Bind(&non_proxy); |
| 1446 __ GetBuiltinFunction(function, Builtins::CALL_NON_FUNCTION); | 1446 __ GetBuiltinFunction(function, Context::CALL_NON_FUNCTION_BUILTIN_INDEX); |
| 1447 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1447 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1448 RelocInfo::CODE_TARGET); | 1448 RelocInfo::CODE_TARGET); |
| 1449 __ Bind(&js_function); | 1449 __ Bind(&js_function); |
| 1450 } | 1450 } |
| 1451 | 1451 |
| 1452 // 5b. Get the code to call from the function and check that the number of | 1452 // 5b. Get the code to call from the function and check that the number of |
| 1453 // expected arguments matches what we're providing. If so, jump | 1453 // expected arguments matches what we're providing. If so, jump |
| 1454 // (tail-call) to the code in register edx without checking arguments. | 1454 // (tail-call) to the code in register edx without checking arguments. |
| 1455 __ Ldr(x3, FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); | 1455 __ Ldr(x3, FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
| 1456 __ Ldrsw(x2, | 1456 __ Ldrsw(x2, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 | 1535 |
| 1536 Register args = x12; | 1536 Register args = x12; |
| 1537 Register receiver = x14; | 1537 Register receiver = x14; |
| 1538 Register function = x15; | 1538 Register function = x15; |
| 1539 | 1539 |
| 1540 // Get the length of the arguments via a builtin call. | 1540 // Get the length of the arguments via a builtin call. |
| 1541 __ Ldr(function, MemOperand(fp, kFunctionOffset)); | 1541 __ Ldr(function, MemOperand(fp, kFunctionOffset)); |
| 1542 __ Ldr(args, MemOperand(fp, kArgumentsOffset)); | 1542 __ Ldr(args, MemOperand(fp, kArgumentsOffset)); |
| 1543 __ Push(function, args); | 1543 __ Push(function, args); |
| 1544 if (targetIsArgument) { | 1544 if (targetIsArgument) { |
| 1545 __ InvokeBuiltin(Builtins::REFLECT_APPLY_PREPARE, CALL_FUNCTION); | 1545 __ InvokeBuiltin(Context::REFLECT_APPLY_PREPARE_BUILTIN_INDEX, |
| 1546 CALL_FUNCTION); |
| 1546 } else { | 1547 } else { |
| 1547 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); | 1548 __ InvokeBuiltin(Context::APPLY_PREPARE_BUILTIN_INDEX, CALL_FUNCTION); |
| 1548 } | 1549 } |
| 1549 Register argc = x0; | 1550 Register argc = x0; |
| 1550 | 1551 |
| 1551 Generate_CheckStackOverflow(masm, kFunctionOffset, argc, kArgcIsSmiTagged); | 1552 Generate_CheckStackOverflow(masm, kFunctionOffset, argc, kArgcIsSmiTagged); |
| 1552 | 1553 |
| 1553 // Push current limit and index. | 1554 // Push current limit and index. |
| 1554 __ Mov(x1, 0); // Initial index. | 1555 __ Mov(x1, 0); // Initial index. |
| 1555 __ Push(argc, x1); | 1556 __ Push(argc, x1); |
| 1556 | 1557 |
| 1557 Label push_receiver; | 1558 Label push_receiver; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 __ Drop(kStackSize); | 1623 __ Drop(kStackSize); |
| 1623 __ Ret(); | 1624 __ Ret(); |
| 1624 | 1625 |
| 1625 // Call the function proxy. | 1626 // Call the function proxy. |
| 1626 __ Bind(&call_proxy); | 1627 __ Bind(&call_proxy); |
| 1627 // x0 : argc | 1628 // x0 : argc |
| 1628 // x1 : function | 1629 // x1 : function |
| 1629 __ Push(function); // Add function proxy as last argument. | 1630 __ Push(function); // Add function proxy as last argument. |
| 1630 __ Add(x0, x0, 1); | 1631 __ Add(x0, x0, 1); |
| 1631 __ Mov(x2, 0); | 1632 __ Mov(x2, 0); |
| 1632 __ GetBuiltinFunction(x1, Builtins::CALL_FUNCTION_PROXY); | 1633 __ GetBuiltinFunction(x1, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX); |
| 1633 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1634 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1634 RelocInfo::CODE_TARGET); | 1635 RelocInfo::CODE_TARGET); |
| 1635 } | 1636 } |
| 1636 __ Drop(kStackSize); | 1637 __ Drop(kStackSize); |
| 1637 __ Ret(); | 1638 __ Ret(); |
| 1638 } | 1639 } |
| 1639 | 1640 |
| 1640 | 1641 |
| 1641 static void Generate_ConstructHelper(MacroAssembler* masm) { | 1642 static void Generate_ConstructHelper(MacroAssembler* masm) { |
| 1642 const int kFormalParameters = 3; | 1643 const int kFormalParameters = 3; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1666 __ B(ne, &validate_arguments); | 1667 __ B(ne, &validate_arguments); |
| 1667 __ Ldr(x0, MemOperand(fp, kFunctionOffset)); | 1668 __ Ldr(x0, MemOperand(fp, kFunctionOffset)); |
| 1668 __ Str(x0, MemOperand(fp, kNewTargetOffset)); | 1669 __ Str(x0, MemOperand(fp, kNewTargetOffset)); |
| 1669 | 1670 |
| 1670 // Validate arguments | 1671 // Validate arguments |
| 1671 __ Bind(&validate_arguments); | 1672 __ Bind(&validate_arguments); |
| 1672 __ Ldr(function, MemOperand(fp, kFunctionOffset)); | 1673 __ Ldr(function, MemOperand(fp, kFunctionOffset)); |
| 1673 __ Ldr(args, MemOperand(fp, kArgumentsOffset)); | 1674 __ Ldr(args, MemOperand(fp, kArgumentsOffset)); |
| 1674 __ Ldr(newTarget, MemOperand(fp, kNewTargetOffset)); | 1675 __ Ldr(newTarget, MemOperand(fp, kNewTargetOffset)); |
| 1675 __ Push(function, args, newTarget); | 1676 __ Push(function, args, newTarget); |
| 1676 __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); | 1677 __ InvokeBuiltin(Context::REFLECT_CONSTRUCT_PREPARE_BUILTIN_INDEX, |
| 1678 CALL_FUNCTION); |
| 1677 Register argc = x0; | 1679 Register argc = x0; |
| 1678 | 1680 |
| 1679 Generate_CheckStackOverflow(masm, kFunctionOffset, argc, kArgcIsSmiTagged); | 1681 Generate_CheckStackOverflow(masm, kFunctionOffset, argc, kArgcIsSmiTagged); |
| 1680 | 1682 |
| 1681 // Push current limit and index & constructor function as callee. | 1683 // Push current limit and index & constructor function as callee. |
| 1682 __ Mov(x1, 0); // Initial index. | 1684 __ Mov(x1, 0); // Initial index. |
| 1683 __ Push(argc, x1, function); | 1685 __ Push(argc, x1, function); |
| 1684 | 1686 |
| 1685 // Copy all arguments from the array to the stack. | 1687 // Copy all arguments from the array to the stack. |
| 1686 Generate_PushAppliedArguments( | 1688 Generate_PushAppliedArguments( |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 __ Ret(); | 1921 __ Ret(); |
| 1920 | 1922 |
| 1921 // Call the entry point without adapting the arguments. | 1923 // Call the entry point without adapting the arguments. |
| 1922 __ Bind(&dont_adapt_arguments); | 1924 __ Bind(&dont_adapt_arguments); |
| 1923 __ Jump(code_entry); | 1925 __ Jump(code_entry); |
| 1924 | 1926 |
| 1925 __ Bind(&stack_overflow); | 1927 __ Bind(&stack_overflow); |
| 1926 { | 1928 { |
| 1927 FrameScope frame(masm, StackFrame::MANUAL); | 1929 FrameScope frame(masm, StackFrame::MANUAL); |
| 1928 EnterArgumentsAdaptorFrame(masm); | 1930 EnterArgumentsAdaptorFrame(masm); |
| 1929 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 1931 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
| 1930 __ Unreachable(); | 1932 __ Unreachable(); |
| 1931 } | 1933 } |
| 1932 } | 1934 } |
| 1933 | 1935 |
| 1934 | 1936 |
| 1935 #undef __ | 1937 #undef __ |
| 1936 | 1938 |
| 1937 } // namespace internal | 1939 } // namespace internal |
| 1938 } // namespace v8 | 1940 } // namespace v8 |
| 1939 | 1941 |
| 1940 #endif // V8_TARGET_ARCH_ARM | 1942 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |