| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 __ IncrementCounter(counters->string_ctor_conversions(), 1, r6, r7); | 227 __ IncrementCounter(counters->string_ctor_conversions(), 1, r6, r7); |
| 228 __ b(&argument_is_string); | 228 __ b(&argument_is_string); |
| 229 | 229 |
| 230 // Invoke the conversion builtin and put the result into r5. | 230 // Invoke the conversion builtin and put the result into r5. |
| 231 __ bind(&convert_argument); | 231 __ bind(&convert_argument); |
| 232 __ push(function); // Preserve the function. | 232 __ push(function); // Preserve the function. |
| 233 __ IncrementCounter(counters->string_ctor_conversions(), 1, r6, r7); | 233 __ IncrementCounter(counters->string_ctor_conversions(), 1, r6, r7); |
| 234 { | 234 { |
| 235 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 235 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 236 __ push(r3); | 236 __ push(r3); |
| 237 __ InvokeBuiltin(Builtins::TO_STRING, CALL_FUNCTION); | 237 __ InvokeBuiltin(Context::TO_STRING_BUILTIN_INDEX, CALL_FUNCTION); |
| 238 } | 238 } |
| 239 __ pop(function); | 239 __ pop(function); |
| 240 __ mr(argument, r3); | 240 __ mr(argument, r3); |
| 241 __ b(&argument_is_string); | 241 __ b(&argument_is_string); |
| 242 | 242 |
| 243 // Load the empty string into r5, remove the receiver from the | 243 // Load the empty string into r5, remove the receiver from the |
| 244 // stack, and jump back to the case where the argument is a string. | 244 // stack, and jump back to the case where the argument is a string. |
| 245 __ bind(&no_arguments); | 245 __ bind(&no_arguments); |
| 246 __ LoadRoot(argument, Heap::kempty_stringRootIndex); | 246 __ LoadRoot(argument, Heap::kempty_stringRootIndex); |
| 247 __ Drop(1); | 247 __ Drop(1); |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } | 753 } |
| 754 __ cmp(r5, r0); | 754 __ cmp(r5, r0); |
| 755 __ bgt(&okay); // Signed comparison. | 755 __ bgt(&okay); // Signed comparison. |
| 756 | 756 |
| 757 // Out of stack space. | 757 // Out of stack space. |
| 758 __ LoadP(r4, MemOperand(fp, calleeOffset)); | 758 __ LoadP(r4, MemOperand(fp, calleeOffset)); |
| 759 if (argc_is_tagged == kArgcIsUntaggedInt) { | 759 if (argc_is_tagged == kArgcIsUntaggedInt) { |
| 760 __ SmiTag(argc); | 760 __ SmiTag(argc); |
| 761 } | 761 } |
| 762 __ Push(r4, argc); | 762 __ Push(r4, argc); |
| 763 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 763 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
| 764 | 764 |
| 765 __ bind(&okay); | 765 __ bind(&okay); |
| 766 } | 766 } |
| 767 | 767 |
| 768 | 768 |
| 769 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 769 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
| 770 bool is_construct) { | 770 bool is_construct) { |
| 771 // Called from Generate_JS_Entry | 771 // Called from Generate_JS_Entry |
| 772 // r3: code entry | 772 // r3: code entry |
| 773 // r4: function | 773 // r4: function |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 // Load frame size (word) from the BytecodeArray object. | 902 // Load frame size (word) from the BytecodeArray object. |
| 903 __ lwz(r5, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 903 __ lwz(r5, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
| 904 BytecodeArray::kFrameSizeOffset)); | 904 BytecodeArray::kFrameSizeOffset)); |
| 905 | 905 |
| 906 // Do a stack check to ensure we don't go over the limit. | 906 // Do a stack check to ensure we don't go over the limit. |
| 907 Label ok; | 907 Label ok; |
| 908 __ sub(r6, sp, r5); | 908 __ sub(r6, sp, r5); |
| 909 __ LoadRoot(r0, Heap::kRealStackLimitRootIndex); | 909 __ LoadRoot(r0, Heap::kRealStackLimitRootIndex); |
| 910 __ cmp(r6, r0); | 910 __ cmp(r6, r0); |
| 911 __ bge(&ok); | 911 __ bge(&ok); |
| 912 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 912 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
| 913 __ bind(&ok); | 913 __ bind(&ok); |
| 914 | 914 |
| 915 // If ok, push undefined as the initial value for all register file entries. | 915 // If ok, push undefined as the initial value for all register file entries. |
| 916 // Note: there should always be at least one stack slot for the return | 916 // Note: there should always be at least one stack slot for the return |
| 917 // register in the register file. | 917 // register in the register file. |
| 918 // TODO(rmcilroy): Consider doing more than one push per loop iteration. | 918 // TODO(rmcilroy): Consider doing more than one push per loop iteration. |
| 919 Label loop_header; | 919 Label loop_header; |
| 920 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); | 920 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); |
| 921 __ ShiftRightImm(r5, r5, Operand(kPointerSizeLog2)); | 921 __ ShiftRightImm(r5, r5, Operand(kPointerSizeLog2)); |
| 922 __ mtctr(r5); | 922 __ mtctr(r5); |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 Label function, non_proxy; | 1424 Label function, non_proxy; |
| 1425 __ cmpi(r7, Operand::Zero()); | 1425 __ cmpi(r7, Operand::Zero()); |
| 1426 __ beq(&function); | 1426 __ beq(&function); |
| 1427 // Expected number of arguments is 0 for CALL_NON_FUNCTION. | 1427 // Expected number of arguments is 0 for CALL_NON_FUNCTION. |
| 1428 __ li(r5, Operand::Zero()); | 1428 __ li(r5, Operand::Zero()); |
| 1429 __ cmpi(r7, Operand(1)); | 1429 __ cmpi(r7, Operand(1)); |
| 1430 __ bne(&non_proxy); | 1430 __ bne(&non_proxy); |
| 1431 | 1431 |
| 1432 __ push(r4); // re-add proxy object as additional argument | 1432 __ push(r4); // re-add proxy object as additional argument |
| 1433 __ addi(r3, r3, Operand(1)); | 1433 __ addi(r3, r3, Operand(1)); |
| 1434 __ GetBuiltinFunction(r4, Builtins::CALL_FUNCTION_PROXY); | 1434 __ GetBuiltinFunction(r4, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX); |
| 1435 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1435 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1436 RelocInfo::CODE_TARGET); | 1436 RelocInfo::CODE_TARGET); |
| 1437 | 1437 |
| 1438 __ bind(&non_proxy); | 1438 __ bind(&non_proxy); |
| 1439 __ GetBuiltinFunction(r4, Builtins::CALL_NON_FUNCTION); | 1439 __ GetBuiltinFunction(r4, Context::CALL_NON_FUNCTION_BUILTIN_INDEX); |
| 1440 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1440 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1441 RelocInfo::CODE_TARGET); | 1441 RelocInfo::CODE_TARGET); |
| 1442 __ bind(&function); | 1442 __ bind(&function); |
| 1443 } | 1443 } |
| 1444 | 1444 |
| 1445 // 5b. Get the code to call from the function and check that the number of | 1445 // 5b. Get the code to call from the function and check that the number of |
| 1446 // expected arguments matches what we're providing. If so, jump | 1446 // expected arguments matches what we're providing. If so, jump |
| 1447 // (tail-call) to the code in register ip without checking arguments. | 1447 // (tail-call) to the code in register ip without checking arguments. |
| 1448 // r3: actual number of arguments | 1448 // r3: actual number of arguments |
| 1449 // r4: function | 1449 // r4: function |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1520 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); | 1520 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); |
| 1521 const int kArgumentsOffset = kFPOnStackSize + kPCOnStackSize; | 1521 const int kArgumentsOffset = kFPOnStackSize + kPCOnStackSize; |
| 1522 const int kReceiverOffset = kArgumentsOffset + kPointerSize; | 1522 const int kReceiverOffset = kArgumentsOffset + kPointerSize; |
| 1523 const int kFunctionOffset = kReceiverOffset + kPointerSize; | 1523 const int kFunctionOffset = kReceiverOffset + kPointerSize; |
| 1524 | 1524 |
| 1525 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function | 1525 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function |
| 1526 __ push(r3); | 1526 __ push(r3); |
| 1527 __ LoadP(r3, MemOperand(fp, kArgumentsOffset)); // get the args array | 1527 __ LoadP(r3, MemOperand(fp, kArgumentsOffset)); // get the args array |
| 1528 __ push(r3); | 1528 __ push(r3); |
| 1529 if (targetIsArgument) { | 1529 if (targetIsArgument) { |
| 1530 __ InvokeBuiltin(Builtins::REFLECT_APPLY_PREPARE, CALL_FUNCTION); | 1530 __ InvokeBuiltin(Context::REFLECT_APPLY_PREPARE_BUILTIN_INDEX, |
| 1531 CALL_FUNCTION); |
| 1531 } else { | 1532 } else { |
| 1532 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); | 1533 __ InvokeBuiltin(Context::APPLY_PREPARE_BUILTIN_INDEX, CALL_FUNCTION); |
| 1533 } | 1534 } |
| 1534 | 1535 |
| 1535 Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged); | 1536 Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged); |
| 1536 | 1537 |
| 1537 // Push current limit and index. | 1538 // Push current limit and index. |
| 1538 const int kIndexOffset = | 1539 const int kIndexOffset = |
| 1539 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1540 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); |
| 1540 const int kLimitOffset = | 1541 const int kLimitOffset = |
| 1541 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); | 1542 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); |
| 1542 __ li(r4, Operand::Zero()); | 1543 __ li(r4, Operand::Zero()); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 __ InvokeFunction(r4, actual, CALL_FUNCTION, NullCallWrapper()); | 1624 __ InvokeFunction(r4, actual, CALL_FUNCTION, NullCallWrapper()); |
| 1624 | 1625 |
| 1625 __ LeaveFrame(StackFrame::INTERNAL, kStackSize * kPointerSize); | 1626 __ LeaveFrame(StackFrame::INTERNAL, kStackSize * kPointerSize); |
| 1626 __ blr(); | 1627 __ blr(); |
| 1627 | 1628 |
| 1628 // Call the function proxy. | 1629 // Call the function proxy. |
| 1629 __ bind(&call_proxy); | 1630 __ bind(&call_proxy); |
| 1630 __ push(r4); // add function proxy as last argument | 1631 __ push(r4); // add function proxy as last argument |
| 1631 __ addi(r3, r3, Operand(1)); | 1632 __ addi(r3, r3, Operand(1)); |
| 1632 __ li(r5, Operand::Zero()); | 1633 __ li(r5, Operand::Zero()); |
| 1633 __ GetBuiltinFunction(r4, Builtins::CALL_FUNCTION_PROXY); | 1634 __ GetBuiltinFunction(r4, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX); |
| 1634 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1635 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1635 RelocInfo::CODE_TARGET); | 1636 RelocInfo::CODE_TARGET); |
| 1636 | 1637 |
| 1637 // Tear down the internal frame and remove function, receiver and args. | 1638 // Tear down the internal frame and remove function, receiver and args. |
| 1638 } | 1639 } |
| 1639 __ addi(sp, sp, Operand(kStackSize * kPointerSize)); | 1640 __ addi(sp, sp, Operand(kStackSize * kPointerSize)); |
| 1640 __ blr(); | 1641 __ blr(); |
| 1641 } | 1642 } |
| 1642 | 1643 |
| 1643 | 1644 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1660 __ StoreP(r3, MemOperand(fp, kNewTargetOffset)); | 1661 __ StoreP(r3, MemOperand(fp, kNewTargetOffset)); |
| 1661 | 1662 |
| 1662 // Validate arguments | 1663 // Validate arguments |
| 1663 __ bind(&validate_arguments); | 1664 __ bind(&validate_arguments); |
| 1664 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function | 1665 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function |
| 1665 __ push(r3); | 1666 __ push(r3); |
| 1666 __ LoadP(r3, MemOperand(fp, kArgumentsOffset)); // get the args array | 1667 __ LoadP(r3, MemOperand(fp, kArgumentsOffset)); // get the args array |
| 1667 __ push(r3); | 1668 __ push(r3); |
| 1668 __ LoadP(r3, MemOperand(fp, kNewTargetOffset)); // get the new.target | 1669 __ LoadP(r3, MemOperand(fp, kNewTargetOffset)); // get the new.target |
| 1669 __ push(r3); | 1670 __ push(r3); |
| 1670 __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); | 1671 __ InvokeBuiltin(Context::REFLECT_CONSTRUCT_PREPARE_BUILTIN_INDEX, |
| 1672 CALL_FUNCTION); |
| 1671 | 1673 |
| 1672 Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged); | 1674 Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged); |
| 1673 | 1675 |
| 1674 // Push current limit and index. | 1676 // Push current limit and index. |
| 1675 const int kIndexOffset = | 1677 const int kIndexOffset = |
| 1676 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1678 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); |
| 1677 const int kLimitOffset = | 1679 const int kLimitOffset = |
| 1678 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); | 1680 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); |
| 1679 __ li(r4, Operand::Zero()); | 1681 __ li(r4, Operand::Zero()); |
| 1680 __ Push(r3, r4); // limit and initial index. | 1682 __ Push(r3, r4); // limit and initial index. |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 // ------------------------------------------- | 1912 // ------------------------------------------- |
| 1911 // Dont adapt arguments. | 1913 // Dont adapt arguments. |
| 1912 // ------------------------------------------- | 1914 // ------------------------------------------- |
| 1913 __ bind(&dont_adapt_arguments); | 1915 __ bind(&dont_adapt_arguments); |
| 1914 __ JumpToJSEntry(ip); | 1916 __ JumpToJSEntry(ip); |
| 1915 | 1917 |
| 1916 __ bind(&stack_overflow); | 1918 __ bind(&stack_overflow); |
| 1917 { | 1919 { |
| 1918 FrameScope frame(masm, StackFrame::MANUAL); | 1920 FrameScope frame(masm, StackFrame::MANUAL); |
| 1919 EnterArgumentsAdaptorFrame(masm); | 1921 EnterArgumentsAdaptorFrame(masm); |
| 1920 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 1922 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
| 1921 __ bkpt(0); | 1923 __ bkpt(0); |
| 1922 } | 1924 } |
| 1923 } | 1925 } |
| 1924 | 1926 |
| 1925 | 1927 |
| 1926 #undef __ | 1928 #undef __ |
| 1927 } // namespace internal | 1929 } // namespace internal |
| 1928 } // namespace v8 | 1930 } // namespace v8 |
| 1929 | 1931 |
| 1930 #endif // V8_TARGET_ARCH_PPC | 1932 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |