| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 6 | 6 |
| 7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4); | 229 __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4); |
| 230 __ b(&argument_is_string); | 230 __ b(&argument_is_string); |
| 231 | 231 |
| 232 // Invoke the conversion builtin and put the result into r2. | 232 // Invoke the conversion builtin and put the result into r2. |
| 233 __ bind(&convert_argument); | 233 __ bind(&convert_argument); |
| 234 __ push(function); // Preserve the function. | 234 __ push(function); // Preserve the function. |
| 235 __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4); | 235 __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4); |
| 236 { | 236 { |
| 237 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 237 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 238 __ push(r0); | 238 __ push(r0); |
| 239 __ InvokeBuiltin(Builtins::TO_STRING, CALL_FUNCTION); | 239 __ InvokeBuiltin(Context::TO_STRING_BUILTIN_INDEX, CALL_FUNCTION); |
| 240 } | 240 } |
| 241 __ pop(function); | 241 __ pop(function); |
| 242 __ mov(argument, r0); | 242 __ mov(argument, r0); |
| 243 __ b(&argument_is_string); | 243 __ b(&argument_is_string); |
| 244 | 244 |
| 245 // Load the empty string into r2, remove the receiver from the | 245 // Load the empty string into r2, remove the receiver from the |
| 246 // stack, and jump back to the case where the argument is a string. | 246 // stack, and jump back to the case where the argument is a string. |
| 247 __ bind(&no_arguments); | 247 __ bind(&no_arguments); |
| 248 __ LoadRoot(argument, Heap::kempty_stringRootIndex); | 248 __ LoadRoot(argument, Heap::kempty_stringRootIndex); |
| 249 __ Drop(1); | 249 __ Drop(1); |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 __ cmp(r2, Operand(argc, LSL, kPointerSizeLog2)); | 761 __ cmp(r2, Operand(argc, LSL, kPointerSizeLog2)); |
| 762 } | 762 } |
| 763 __ b(gt, &okay); // Signed comparison. | 763 __ b(gt, &okay); // Signed comparison. |
| 764 | 764 |
| 765 // Out of stack space. | 765 // Out of stack space. |
| 766 __ ldr(r1, MemOperand(fp, calleeOffset)); | 766 __ ldr(r1, MemOperand(fp, calleeOffset)); |
| 767 if (argc_is_tagged == kArgcIsUntaggedInt) { | 767 if (argc_is_tagged == kArgcIsUntaggedInt) { |
| 768 __ SmiTag(argc); | 768 __ SmiTag(argc); |
| 769 } | 769 } |
| 770 __ Push(r1, argc); | 770 __ Push(r1, argc); |
| 771 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 771 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
| 772 | 772 |
| 773 __ bind(&okay); | 773 __ bind(&okay); |
| 774 } | 774 } |
| 775 | 775 |
| 776 | 776 |
| 777 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 777 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
| 778 bool is_construct) { | 778 bool is_construct) { |
| 779 // Called from Generate_JS_Entry | 779 // Called from Generate_JS_Entry |
| 780 // r0: code entry | 780 // r0: code entry |
| 781 // r1: function | 781 // r1: function |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 // Load frame size from the BytecodeArray object. | 913 // Load frame size from the BytecodeArray object. |
| 914 __ ldr(r4, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 914 __ ldr(r4, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
| 915 BytecodeArray::kFrameSizeOffset)); | 915 BytecodeArray::kFrameSizeOffset)); |
| 916 | 916 |
| 917 // Do a stack check to ensure we don't go over the limit. | 917 // Do a stack check to ensure we don't go over the limit. |
| 918 Label ok; | 918 Label ok; |
| 919 __ sub(r9, sp, Operand(r4)); | 919 __ sub(r9, sp, Operand(r4)); |
| 920 __ LoadRoot(r2, Heap::kRealStackLimitRootIndex); | 920 __ LoadRoot(r2, Heap::kRealStackLimitRootIndex); |
| 921 __ cmp(r9, Operand(r2)); | 921 __ cmp(r9, Operand(r2)); |
| 922 __ b(hs, &ok); | 922 __ b(hs, &ok); |
| 923 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 923 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
| 924 __ bind(&ok); | 924 __ bind(&ok); |
| 925 | 925 |
| 926 // If ok, push undefined as the initial value for all register file entries. | 926 // If ok, push undefined as the initial value for all register file entries. |
| 927 Label loop_header; | 927 Label loop_header; |
| 928 Label loop_check; | 928 Label loop_check; |
| 929 __ LoadRoot(r9, Heap::kUndefinedValueRootIndex); | 929 __ LoadRoot(r9, Heap::kUndefinedValueRootIndex); |
| 930 __ b(&loop_check, al); | 930 __ b(&loop_check, al); |
| 931 __ bind(&loop_header); | 931 __ bind(&loop_header); |
| 932 // TODO(rmcilroy): Consider doing more than one push per loop iteration. | 932 // TODO(rmcilroy): Consider doing more than one push per loop iteration. |
| 933 __ push(r9); | 933 __ push(r9); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 { Label function, non_proxy; | 1397 { Label function, non_proxy; |
| 1398 __ tst(r4, r4); | 1398 __ tst(r4, r4); |
| 1399 __ b(eq, &function); | 1399 __ b(eq, &function); |
| 1400 // Expected number of arguments is 0 for CALL_NON_FUNCTION. | 1400 // Expected number of arguments is 0 for CALL_NON_FUNCTION. |
| 1401 __ mov(r2, Operand::Zero()); | 1401 __ mov(r2, Operand::Zero()); |
| 1402 __ cmp(r4, Operand(1)); | 1402 __ cmp(r4, Operand(1)); |
| 1403 __ b(ne, &non_proxy); | 1403 __ b(ne, &non_proxy); |
| 1404 | 1404 |
| 1405 __ push(r1); // re-add proxy object as additional argument | 1405 __ push(r1); // re-add proxy object as additional argument |
| 1406 __ add(r0, r0, Operand(1)); | 1406 __ add(r0, r0, Operand(1)); |
| 1407 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY); | 1407 __ GetBuiltinFunction(r1, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX); |
| 1408 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1408 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1409 RelocInfo::CODE_TARGET); | 1409 RelocInfo::CODE_TARGET); |
| 1410 | 1410 |
| 1411 __ bind(&non_proxy); | 1411 __ bind(&non_proxy); |
| 1412 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION); | 1412 __ GetBuiltinFunction(r1, Context::CALL_NON_FUNCTION_BUILTIN_INDEX); |
| 1413 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1413 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1414 RelocInfo::CODE_TARGET); | 1414 RelocInfo::CODE_TARGET); |
| 1415 __ bind(&function); | 1415 __ bind(&function); |
| 1416 } | 1416 } |
| 1417 | 1417 |
| 1418 // 5b. Get the code to call from the function and check that the number of | 1418 // 5b. Get the code to call from the function and check that the number of |
| 1419 // expected arguments matches what we're providing. If so, jump | 1419 // expected arguments matches what we're providing. If so, jump |
| 1420 // (tail-call) to the code in register edx without checking arguments. | 1420 // (tail-call) to the code in register edx without checking arguments. |
| 1421 // r0: actual number of arguments | 1421 // r0: actual number of arguments |
| 1422 // r1: function | 1422 // r1: function |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); | 1493 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); |
| 1494 const int kArgumentsOffset = kFPOnStackSize + kPCOnStackSize; | 1494 const int kArgumentsOffset = kFPOnStackSize + kPCOnStackSize; |
| 1495 const int kReceiverOffset = kArgumentsOffset + kPointerSize; | 1495 const int kReceiverOffset = kArgumentsOffset + kPointerSize; |
| 1496 const int kFunctionOffset = kReceiverOffset + kPointerSize; | 1496 const int kFunctionOffset = kReceiverOffset + kPointerSize; |
| 1497 | 1497 |
| 1498 __ ldr(r0, MemOperand(fp, kFunctionOffset)); // get the function | 1498 __ ldr(r0, MemOperand(fp, kFunctionOffset)); // get the function |
| 1499 __ push(r0); | 1499 __ push(r0); |
| 1500 __ ldr(r0, MemOperand(fp, kArgumentsOffset)); // get the args array | 1500 __ ldr(r0, MemOperand(fp, kArgumentsOffset)); // get the args array |
| 1501 __ push(r0); | 1501 __ push(r0); |
| 1502 if (targetIsArgument) { | 1502 if (targetIsArgument) { |
| 1503 __ InvokeBuiltin(Builtins::REFLECT_APPLY_PREPARE, CALL_FUNCTION); | 1503 __ InvokeBuiltin(Context::REFLECT_APPLY_PREPARE_BUILTIN_INDEX, |
| 1504 CALL_FUNCTION); |
| 1504 } else { | 1505 } else { |
| 1505 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); | 1506 __ InvokeBuiltin(Context::APPLY_PREPARE_BUILTIN_INDEX, CALL_FUNCTION); |
| 1506 } | 1507 } |
| 1507 | 1508 |
| 1508 Generate_CheckStackOverflow(masm, kFunctionOffset, r0, kArgcIsSmiTagged); | 1509 Generate_CheckStackOverflow(masm, kFunctionOffset, r0, kArgcIsSmiTagged); |
| 1509 | 1510 |
| 1510 // Push current limit and index. | 1511 // Push current limit and index. |
| 1511 const int kIndexOffset = | 1512 const int kIndexOffset = |
| 1512 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1513 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); |
| 1513 const int kLimitOffset = | 1514 const int kLimitOffset = |
| 1514 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); | 1515 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); |
| 1515 __ push(r0); // limit | 1516 __ push(r0); // limit |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 | 1588 |
| 1588 frame_scope.GenerateLeaveFrame(); | 1589 frame_scope.GenerateLeaveFrame(); |
| 1589 __ add(sp, sp, Operand(kStackSize * kPointerSize)); | 1590 __ add(sp, sp, Operand(kStackSize * kPointerSize)); |
| 1590 __ Jump(lr); | 1591 __ Jump(lr); |
| 1591 | 1592 |
| 1592 // Call the function proxy. | 1593 // Call the function proxy. |
| 1593 __ bind(&call_proxy); | 1594 __ bind(&call_proxy); |
| 1594 __ push(r1); // add function proxy as last argument | 1595 __ push(r1); // add function proxy as last argument |
| 1595 __ add(r0, r0, Operand(1)); | 1596 __ add(r0, r0, Operand(1)); |
| 1596 __ mov(r2, Operand::Zero()); | 1597 __ mov(r2, Operand::Zero()); |
| 1597 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY); | 1598 __ GetBuiltinFunction(r1, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX); |
| 1598 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1599 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1599 RelocInfo::CODE_TARGET); | 1600 RelocInfo::CODE_TARGET); |
| 1600 | 1601 |
| 1601 // Tear down the internal frame and remove function, receiver and args. | 1602 // Tear down the internal frame and remove function, receiver and args. |
| 1602 } | 1603 } |
| 1603 __ add(sp, sp, Operand(kStackSize * kPointerSize)); | 1604 __ add(sp, sp, Operand(kStackSize * kPointerSize)); |
| 1604 __ Jump(lr); | 1605 __ Jump(lr); |
| 1605 } | 1606 } |
| 1606 | 1607 |
| 1607 | 1608 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1624 __ str(r0, MemOperand(fp, kNewTargetOffset)); | 1625 __ str(r0, MemOperand(fp, kNewTargetOffset)); |
| 1625 | 1626 |
| 1626 // Validate arguments | 1627 // Validate arguments |
| 1627 __ bind(&validate_arguments); | 1628 __ bind(&validate_arguments); |
| 1628 __ ldr(r0, MemOperand(fp, kFunctionOffset)); // get the function | 1629 __ ldr(r0, MemOperand(fp, kFunctionOffset)); // get the function |
| 1629 __ push(r0); | 1630 __ push(r0); |
| 1630 __ ldr(r0, MemOperand(fp, kArgumentsOffset)); // get the args array | 1631 __ ldr(r0, MemOperand(fp, kArgumentsOffset)); // get the args array |
| 1631 __ push(r0); | 1632 __ push(r0); |
| 1632 __ ldr(r0, MemOperand(fp, kNewTargetOffset)); // get the new.target | 1633 __ ldr(r0, MemOperand(fp, kNewTargetOffset)); // get the new.target |
| 1633 __ push(r0); | 1634 __ push(r0); |
| 1634 __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); | 1635 __ InvokeBuiltin(Context::REFLECT_CONSTRUCT_PREPARE_BUILTIN_INDEX, |
| 1636 CALL_FUNCTION); |
| 1635 | 1637 |
| 1636 Generate_CheckStackOverflow(masm, kFunctionOffset, r0, kArgcIsSmiTagged); | 1638 Generate_CheckStackOverflow(masm, kFunctionOffset, r0, kArgcIsSmiTagged); |
| 1637 | 1639 |
| 1638 // Push current limit and index. | 1640 // Push current limit and index. |
| 1639 const int kIndexOffset = | 1641 const int kIndexOffset = |
| 1640 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1642 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); |
| 1641 const int kLimitOffset = | 1643 const int kLimitOffset = |
| 1642 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); | 1644 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); |
| 1643 __ push(r0); // limit | 1645 __ push(r0); // limit |
| 1644 __ mov(r1, Operand::Zero()); // initial index | 1646 __ mov(r1, Operand::Zero()); // initial index |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 // ------------------------------------------- | 1857 // ------------------------------------------- |
| 1856 // Dont adapt arguments. | 1858 // Dont adapt arguments. |
| 1857 // ------------------------------------------- | 1859 // ------------------------------------------- |
| 1858 __ bind(&dont_adapt_arguments); | 1860 __ bind(&dont_adapt_arguments); |
| 1859 __ Jump(r3); | 1861 __ Jump(r3); |
| 1860 | 1862 |
| 1861 __ bind(&stack_overflow); | 1863 __ bind(&stack_overflow); |
| 1862 { | 1864 { |
| 1863 FrameScope frame(masm, StackFrame::MANUAL); | 1865 FrameScope frame(masm, StackFrame::MANUAL); |
| 1864 EnterArgumentsAdaptorFrame(masm); | 1866 EnterArgumentsAdaptorFrame(masm); |
| 1865 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 1867 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
| 1866 __ bkpt(0); | 1868 __ bkpt(0); |
| 1867 } | 1869 } |
| 1868 } | 1870 } |
| 1869 | 1871 |
| 1870 | 1872 |
| 1871 #undef __ | 1873 #undef __ |
| 1872 | 1874 |
| 1873 } // namespace internal | 1875 } // namespace internal |
| 1874 } // namespace v8 | 1876 } // namespace v8 |
| 1875 | 1877 |
| 1876 #endif // V8_TARGET_ARCH_ARM | 1878 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |