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 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1459 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
1460 RelocInfo::CODE_TARGET, ne); | 1460 RelocInfo::CODE_TARGET, ne); |
1461 | 1461 |
1462 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); | 1462 __ LoadP(ip, FieldMemOperand(r4, JSFunction::kCodeEntryOffset)); |
1463 ParameterCount expected(0); | 1463 ParameterCount expected(0); |
1464 __ InvokeCode(ip, expected, expected, JUMP_FUNCTION, NullCallWrapper()); | 1464 __ InvokeCode(ip, expected, expected, JUMP_FUNCTION, NullCallWrapper()); |
1465 } | 1465 } |
1466 | 1466 |
1467 | 1467 |
1468 static void Generate_PushAppliedArguments(MacroAssembler* masm, | 1468 static void Generate_PushAppliedArguments(MacroAssembler* masm, |
| 1469 const int vectorOffset, |
1469 const int argumentsOffset, | 1470 const int argumentsOffset, |
1470 const int indexOffset, | 1471 const int indexOffset, |
1471 const int limitOffset) { | 1472 const int limitOffset) { |
1472 Register receiver = LoadDescriptor::ReceiverRegister(); | 1473 Register receiver = LoadDescriptor::ReceiverRegister(); |
1473 Register key = LoadDescriptor::NameRegister(); | 1474 Register key = LoadDescriptor::NameRegister(); |
1474 Register slot = LoadDescriptor::SlotRegister(); | 1475 Register slot = LoadDescriptor::SlotRegister(); |
1475 Register vector = LoadWithVectorDescriptor::VectorRegister(); | 1476 Register vector = LoadWithVectorDescriptor::VectorRegister(); |
1476 | 1477 |
1477 // Copy all arguments from the array to the stack. | 1478 // Copy all arguments from the array to the stack. |
1478 Label entry, loop; | 1479 Label entry, loop; |
1479 __ LoadP(key, MemOperand(fp, indexOffset)); | 1480 __ LoadP(key, MemOperand(fp, indexOffset)); |
1480 __ b(&entry); | 1481 __ b(&entry); |
1481 __ bind(&loop); | 1482 __ bind(&loop); |
1482 __ LoadP(receiver, MemOperand(fp, argumentsOffset)); | 1483 __ LoadP(receiver, MemOperand(fp, argumentsOffset)); |
1483 | 1484 |
1484 // Use inline caching to speed up access to arguments. | 1485 // Use inline caching to speed up access to arguments. |
1485 Code::Kind kinds[] = {Code::KEYED_LOAD_IC}; | 1486 int slot_index = TypeFeedbackVector::PushAppliedArgumentsIndex(); |
1486 FeedbackVectorSpec spec(0, 1, kinds); | 1487 __ LoadSmiLiteral(slot, Smi::FromInt(slot_index)); |
1487 Handle<TypeFeedbackVector> feedback_vector = | 1488 __ LoadP(vector, MemOperand(fp, vectorOffset)); |
1488 masm->isolate()->factory()->NewTypeFeedbackVector(&spec); | |
1489 int index = feedback_vector->GetIndex(FeedbackVectorICSlot(0)); | |
1490 __ LoadSmiLiteral(slot, Smi::FromInt(index)); | |
1491 __ Move(vector, feedback_vector); | |
1492 Handle<Code> ic = | 1489 Handle<Code> ic = |
1493 KeyedLoadICStub(masm->isolate(), LoadICState(kNoExtraICState)).GetCode(); | 1490 KeyedLoadICStub(masm->isolate(), LoadICState(kNoExtraICState)).GetCode(); |
1494 __ Call(ic, RelocInfo::CODE_TARGET); | 1491 __ Call(ic, RelocInfo::CODE_TARGET); |
1495 | 1492 |
1496 // Push the nth argument. | 1493 // Push the nth argument. |
1497 __ push(r3); | 1494 __ push(r3); |
1498 | 1495 |
1499 // Update the index on the stack and in register key. | 1496 // Update the index on the stack and in register key. |
1500 __ LoadP(key, MemOperand(fp, indexOffset)); | 1497 __ LoadP(key, MemOperand(fp, indexOffset)); |
1501 __ AddSmiLiteral(key, key, Smi::FromInt(1), r0); | 1498 __ AddSmiLiteral(key, key, Smi::FromInt(1), r0); |
(...skipping 14 matching lines...) Expand all Loading... |
1516 // Used by FunctionApply and ReflectApply | 1513 // Used by FunctionApply and ReflectApply |
1517 static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) { | 1514 static void Generate_ApplyHelper(MacroAssembler* masm, bool targetIsArgument) { |
1518 const int kFormalParameters = targetIsArgument ? 3 : 2; | 1515 const int kFormalParameters = targetIsArgument ? 3 : 2; |
1519 const int kStackSize = kFormalParameters + 1; | 1516 const int kStackSize = kFormalParameters + 1; |
1520 | 1517 |
1521 { | 1518 { |
1522 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); | 1519 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); |
1523 const int kArgumentsOffset = kFPOnStackSize + kPCOnStackSize; | 1520 const int kArgumentsOffset = kFPOnStackSize + kPCOnStackSize; |
1524 const int kReceiverOffset = kArgumentsOffset + kPointerSize; | 1521 const int kReceiverOffset = kArgumentsOffset + kPointerSize; |
1525 const int kFunctionOffset = kReceiverOffset + kPointerSize; | 1522 const int kFunctionOffset = kReceiverOffset + kPointerSize; |
| 1523 const int kVectorOffset = |
| 1524 InternalFrameConstants::kCodeOffset - 1 * kPointerSize; |
| 1525 |
| 1526 // Push the vector. |
| 1527 __ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 1528 __ LoadP(r4, |
| 1529 FieldMemOperand(r4, SharedFunctionInfo::kFeedbackVectorOffset)); |
| 1530 __ push(r4); |
1526 | 1531 |
1527 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function | 1532 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function |
1528 __ push(r3); | 1533 __ push(r3); |
1529 __ LoadP(r3, MemOperand(fp, kArgumentsOffset)); // get the args array | 1534 __ LoadP(r3, MemOperand(fp, kArgumentsOffset)); // get the args array |
1530 __ push(r3); | 1535 __ push(r3); |
1531 if (targetIsArgument) { | 1536 if (targetIsArgument) { |
1532 __ InvokeBuiltin(Builtins::REFLECT_APPLY_PREPARE, CALL_FUNCTION); | 1537 __ InvokeBuiltin(Builtins::REFLECT_APPLY_PREPARE, CALL_FUNCTION); |
1533 } else { | 1538 } else { |
1534 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); | 1539 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); |
1535 } | 1540 } |
1536 | 1541 |
1537 Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged); | 1542 Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged); |
1538 | 1543 |
1539 // Push current limit and index. | 1544 // Push current limit and index. |
1540 const int kIndexOffset = | 1545 const int kIndexOffset = kVectorOffset - (2 * kPointerSize); |
1541 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1546 const int kLimitOffset = kVectorOffset - (1 * kPointerSize); |
1542 const int kLimitOffset = | |
1543 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); | |
1544 __ li(r4, Operand::Zero()); | 1547 __ li(r4, Operand::Zero()); |
1545 __ Push(r3, r4); // limit and initial index. | 1548 __ Push(r3, r4); // limit and initial index. |
1546 | 1549 |
1547 // Get the receiver. | 1550 // Get the receiver. |
1548 __ LoadP(r3, MemOperand(fp, kReceiverOffset)); | 1551 __ LoadP(r3, MemOperand(fp, kReceiverOffset)); |
1549 | 1552 |
1550 // Check that the function is a JS function (otherwise it must be a proxy). | 1553 // Check that the function is a JS function (otherwise it must be a proxy). |
1551 Label push_receiver; | 1554 Label push_receiver; |
1552 __ LoadP(r4, MemOperand(fp, kFunctionOffset)); | 1555 __ LoadP(r4, MemOperand(fp, kFunctionOffset)); |
1553 __ CompareObjectType(r4, r5, r5, JS_FUNCTION_TYPE); | 1556 __ CompareObjectType(r4, r5, r5, JS_FUNCTION_TYPE); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 __ bind(&use_global_proxy); | 1609 __ bind(&use_global_proxy); |
1607 __ LoadP(r3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); | 1610 __ LoadP(r3, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); |
1608 __ LoadP(r3, FieldMemOperand(r3, GlobalObject::kGlobalProxyOffset)); | 1611 __ LoadP(r3, FieldMemOperand(r3, GlobalObject::kGlobalProxyOffset)); |
1609 | 1612 |
1610 // Push the receiver. | 1613 // Push the receiver. |
1611 // r3: receiver | 1614 // r3: receiver |
1612 __ bind(&push_receiver); | 1615 __ bind(&push_receiver); |
1613 __ push(r3); | 1616 __ push(r3); |
1614 | 1617 |
1615 // Copy all arguments from the array to the stack. | 1618 // Copy all arguments from the array to the stack. |
1616 Generate_PushAppliedArguments(masm, kArgumentsOffset, kIndexOffset, | 1619 Generate_PushAppliedArguments(masm, kVectorOffset, kArgumentsOffset, |
1617 kLimitOffset); | 1620 kIndexOffset, kLimitOffset); |
1618 | 1621 |
1619 // Call the function. | 1622 // Call the function. |
1620 Label call_proxy; | 1623 Label call_proxy; |
1621 ParameterCount actual(r3); | 1624 ParameterCount actual(r3); |
1622 __ LoadP(r4, MemOperand(fp, kFunctionOffset)); | 1625 __ LoadP(r4, MemOperand(fp, kFunctionOffset)); |
1623 __ CompareObjectType(r4, r5, r5, JS_FUNCTION_TYPE); | 1626 __ CompareObjectType(r4, r5, r5, JS_FUNCTION_TYPE); |
1624 __ bne(&call_proxy); | 1627 __ bne(&call_proxy); |
1625 __ InvokeFunction(r4, actual, CALL_FUNCTION, NullCallWrapper()); | 1628 __ InvokeFunction(r4, actual, CALL_FUNCTION, NullCallWrapper()); |
1626 | 1629 |
1627 __ LeaveFrame(StackFrame::INTERNAL, kStackSize * kPointerSize); | 1630 __ LeaveFrame(StackFrame::INTERNAL, kStackSize * kPointerSize); |
(...skipping 17 matching lines...) Expand all Loading... |
1645 | 1648 |
1646 static void Generate_ConstructHelper(MacroAssembler* masm) { | 1649 static void Generate_ConstructHelper(MacroAssembler* masm) { |
1647 const int kFormalParameters = 3; | 1650 const int kFormalParameters = 3; |
1648 const int kStackSize = kFormalParameters + 1; | 1651 const int kStackSize = kFormalParameters + 1; |
1649 | 1652 |
1650 { | 1653 { |
1651 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); | 1654 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); |
1652 const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize; | 1655 const int kNewTargetOffset = kFPOnStackSize + kPCOnStackSize; |
1653 const int kArgumentsOffset = kNewTargetOffset + kPointerSize; | 1656 const int kArgumentsOffset = kNewTargetOffset + kPointerSize; |
1654 const int kFunctionOffset = kArgumentsOffset + kPointerSize; | 1657 const int kFunctionOffset = kArgumentsOffset + kPointerSize; |
| 1658 static const int kVectorOffset = |
| 1659 InternalFrameConstants::kCodeOffset - 1 * kPointerSize; |
| 1660 |
| 1661 // Push the vector. |
| 1662 __ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 1663 __ LoadP(r4, |
| 1664 FieldMemOperand(r4, SharedFunctionInfo::kFeedbackVectorOffset)); |
| 1665 __ push(r4); |
1655 | 1666 |
1656 // If newTarget is not supplied, set it to constructor | 1667 // If newTarget is not supplied, set it to constructor |
1657 Label validate_arguments; | 1668 Label validate_arguments; |
1658 __ LoadP(r3, MemOperand(fp, kNewTargetOffset)); | 1669 __ LoadP(r3, MemOperand(fp, kNewTargetOffset)); |
1659 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); | 1670 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); |
1660 __ bne(&validate_arguments); | 1671 __ bne(&validate_arguments); |
1661 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); | 1672 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); |
1662 __ StoreP(r3, MemOperand(fp, kNewTargetOffset)); | 1673 __ StoreP(r3, MemOperand(fp, kNewTargetOffset)); |
1663 | 1674 |
1664 // Validate arguments | 1675 // Validate arguments |
1665 __ bind(&validate_arguments); | 1676 __ bind(&validate_arguments); |
1666 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function | 1677 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); // get the function |
1667 __ push(r3); | 1678 __ push(r3); |
1668 __ LoadP(r3, MemOperand(fp, kArgumentsOffset)); // get the args array | 1679 __ LoadP(r3, MemOperand(fp, kArgumentsOffset)); // get the args array |
1669 __ push(r3); | 1680 __ push(r3); |
1670 __ LoadP(r3, MemOperand(fp, kNewTargetOffset)); // get the new.target | 1681 __ LoadP(r3, MemOperand(fp, kNewTargetOffset)); // get the new.target |
1671 __ push(r3); | 1682 __ push(r3); |
1672 __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); | 1683 __ InvokeBuiltin(Builtins::REFLECT_CONSTRUCT_PREPARE, CALL_FUNCTION); |
1673 | 1684 |
1674 Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged); | 1685 Generate_CheckStackOverflow(masm, kFunctionOffset, r3, kArgcIsSmiTagged); |
1675 | 1686 |
1676 // Push current limit and index. | 1687 // Push current limit and index. |
1677 const int kIndexOffset = | 1688 const int kIndexOffset = kVectorOffset - (2 * kPointerSize); |
1678 StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize); | 1689 const int kLimitOffset = kVectorOffset - (1 * kPointerSize); |
1679 const int kLimitOffset = | |
1680 StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize); | |
1681 __ li(r4, Operand::Zero()); | 1690 __ li(r4, Operand::Zero()); |
1682 __ Push(r3, r4); // limit and initial index. | 1691 __ Push(r3, r4); // limit and initial index. |
1683 // Push the constructor function as callee | 1692 // Push the constructor function as callee |
1684 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); | 1693 __ LoadP(r3, MemOperand(fp, kFunctionOffset)); |
1685 __ push(r3); | 1694 __ push(r3); |
1686 | 1695 |
1687 // Copy all arguments from the array to the stack. | 1696 // Copy all arguments from the array to the stack. |
1688 Generate_PushAppliedArguments(masm, kArgumentsOffset, kIndexOffset, | 1697 Generate_PushAppliedArguments(masm, kVectorOffset, kArgumentsOffset, |
1689 kLimitOffset); | 1698 kIndexOffset, kLimitOffset); |
1690 | 1699 |
1691 // Use undefined feedback vector | 1700 // Use undefined feedback vector |
1692 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); | 1701 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); |
1693 __ LoadP(r4, MemOperand(fp, kFunctionOffset)); | 1702 __ LoadP(r4, MemOperand(fp, kFunctionOffset)); |
1694 __ LoadP(r7, MemOperand(fp, kNewTargetOffset)); | 1703 __ LoadP(r7, MemOperand(fp, kNewTargetOffset)); |
1695 | 1704 |
1696 // Call the function. | 1705 // Call the function. |
1697 CallConstructStub stub(masm->isolate(), SUPER_CONSTRUCTOR_CALL); | 1706 CallConstructStub stub(masm->isolate(), SUPER_CONSTRUCTOR_CALL); |
1698 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 1707 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
1699 | 1708 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 __ bkpt(0); | 1932 __ bkpt(0); |
1924 } | 1933 } |
1925 } | 1934 } |
1926 | 1935 |
1927 | 1936 |
1928 #undef __ | 1937 #undef __ |
1929 } // namespace internal | 1938 } // namespace internal |
1930 } // namespace v8 | 1939 } // namespace v8 |
1931 | 1940 |
1932 #endif // V8_TARGET_ARCH_PPC | 1941 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |