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 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compilation-dependencies.h" | 6 #include "src/compilation-dependencies.h" |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 | 1507 |
1508 Reduction JSTypedLowering::ReduceJSCreateArguments(Node* node) { | 1508 Reduction JSTypedLowering::ReduceJSCreateArguments(Node* node) { |
1509 DCHECK_EQ(IrOpcode::kJSCreateArguments, node->opcode()); | 1509 DCHECK_EQ(IrOpcode::kJSCreateArguments, node->opcode()); |
1510 CreateArgumentsParameters const& p = CreateArgumentsParametersOf(node->op()); | 1510 CreateArgumentsParameters const& p = CreateArgumentsParametersOf(node->op()); |
1511 Node* const frame_state = NodeProperties::GetFrameStateInput(node, 0); | 1511 Node* const frame_state = NodeProperties::GetFrameStateInput(node, 0); |
1512 Node* const outer_state = frame_state->InputAt(kFrameStateOuterStateInput); | 1512 Node* const outer_state = frame_state->InputAt(kFrameStateOuterStateInput); |
1513 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state); | 1513 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state); |
1514 | 1514 |
1515 // Use the ArgumentsAccessStub for materializing both mapped and unmapped | 1515 // Use the ArgumentsAccessStub for materializing both mapped and unmapped |
1516 // arguments object, but only for non-inlined (i.e. outermost) frames. | 1516 // arguments object, but only for non-inlined (i.e. outermost) frames. |
1517 if (p.type() != CreateArgumentsParameters::kRestArray && | 1517 if (outer_state->opcode() != IrOpcode::kFrameState) { |
1518 outer_state->opcode() != IrOpcode::kFrameState) { | |
1519 Handle<SharedFunctionInfo> shared; | 1518 Handle<SharedFunctionInfo> shared; |
1520 Isolate* isolate = jsgraph()->isolate(); | 1519 Isolate* isolate = jsgraph()->isolate(); |
1521 if (!state_info.shared_info().ToHandle(&shared)) return NoChange(); | 1520 if (!state_info.shared_info().ToHandle(&shared)) return NoChange(); |
1522 bool unmapped = p.type() == CreateArgumentsParameters::kUnmappedArguments; | 1521 |
1523 Callable callable = CodeFactory::ArgumentsAccess( | |
1524 isolate, unmapped, shared->has_duplicate_parameters()); | |
1525 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | |
1526 isolate, graph()->zone(), callable.descriptor(), 0, | |
1527 CallDescriptor::kNeedsFrameState); | |
1528 const Operator* new_op = common()->Call(desc); | |
1529 int parameter_count = state_info.parameter_count() - 1; | 1522 int parameter_count = state_info.parameter_count() - 1; |
1530 int parameter_offset = parameter_count * kPointerSize; | 1523 int parameter_offset = parameter_count * kPointerSize; |
1531 int offset = StandardFrameConstants::kCallerSPOffset + parameter_offset; | 1524 int offset = StandardFrameConstants::kCallerSPOffset + parameter_offset; |
1532 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | |
1533 Node* parameter_pointer = graph()->NewNode( | 1525 Node* parameter_pointer = graph()->NewNode( |
1534 machine()->IntAdd(), graph()->NewNode(machine()->LoadFramePointer()), | 1526 machine()->IntAdd(), graph()->NewNode(machine()->LoadFramePointer()), |
1535 jsgraph()->IntPtrConstant(offset)); | 1527 jsgraph()->IntPtrConstant(offset)); |
1536 node->InsertInput(graph()->zone(), 0, stub_code); | |
1537 node->InsertInput(graph()->zone(), 2, jsgraph()->Constant(parameter_count)); | |
1538 node->InsertInput(graph()->zone(), 3, parameter_pointer); | |
1539 NodeProperties::ChangeOp(node, new_op); | |
1540 return Changed(node); | |
1541 } | |
1542 | 1528 |
1543 // Use inline allocation for all mapped arguments objects within inlined | 1529 if (p.type() != CreateArgumentsParameters::kRestArray) { |
1544 // (i.e. non-outermost) frames, independent of the object size. | 1530 bool unmapped = p.type() == CreateArgumentsParameters::kUnmappedArguments; |
1545 if (p.type() == CreateArgumentsParameters::kMappedArguments && | 1531 Callable callable = CodeFactory::ArgumentsAccess( |
1546 outer_state->opcode() == IrOpcode::kFrameState) { | 1532 isolate, unmapped, shared->has_duplicate_parameters()); |
1547 Handle<SharedFunctionInfo> shared; | 1533 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
1548 if (!state_info.shared_info().ToHandle(&shared)) return NoChange(); | 1534 isolate, graph()->zone(), callable.descriptor(), 0, |
1549 Node* const callee = NodeProperties::GetValueInput(node, 0); | 1535 CallDescriptor::kNeedsFrameState); |
1550 Node* const effect = NodeProperties::GetEffectInput(node); | 1536 const Operator* new_op = common()->Call(desc); |
1551 Node* const control = NodeProperties::GetControlInput(node); | 1537 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
1552 Node* const context = NodeProperties::GetContextInput(node); | 1538 node->InsertInput(graph()->zone(), 0, stub_code); |
1553 // TODO(mstarzinger): Duplicate parameters are not handled yet. | 1539 node->InsertInput(graph()->zone(), 2, |
1554 if (shared->has_duplicate_parameters()) return NoChange(); | 1540 jsgraph()->Constant(parameter_count)); |
1555 // Choose the correct frame state and frame state info depending on whether | 1541 node->InsertInput(graph()->zone(), 3, parameter_pointer); |
1556 // there conceptually is an arguments adaptor frame in the call chain. | 1542 NodeProperties::ChangeOp(node, new_op); |
1557 Node* const args_state = GetArgumentsFrameState(frame_state); | 1543 return Changed(node); |
1558 FrameStateInfo args_state_info = OpParameter<FrameStateInfo>(args_state); | 1544 } else { |
1559 // Prepare element backing store to be used by arguments object. | 1545 Callable callable = CodeFactory::RestArgumentsAccess(isolate); |
1560 bool has_aliased_arguments = false; | 1546 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
1561 Node* const elements = AllocateAliasedArguments( | 1547 isolate, graph()->zone(), callable.descriptor(), 0, |
1562 effect, control, args_state, context, shared, &has_aliased_arguments); | 1548 CallDescriptor::kNeedsFrameState); |
1563 Node* allocate_effect = | 1549 const Operator* new_op = common()->Call(desc); |
1564 elements->op()->EffectOutputCount() > 0 ? elements : effect; | 1550 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
1565 // Load the arguments object map from the current native context. | 1551 node->InsertInput(graph()->zone(), 0, stub_code); |
1566 Node* const load_native_context = graph()->NewNode( | 1552 node->ReplaceInput(1, jsgraph()->Constant(parameter_count)); |
1567 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), | 1553 node->InsertInput(graph()->zone(), 2, parameter_pointer); |
1568 context, context, effect); | 1554 node->InsertInput(graph()->zone(), 3, |
1569 Node* const load_arguments_map = graph()->NewNode( | 1555 jsgraph()->Constant(p.start_index())); |
1570 simplified()->LoadField(AccessBuilder::ForContextSlot( | 1556 node->InsertInput(graph()->zone(), 4, |
1571 has_aliased_arguments ? Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX | 1557 jsgraph()->Constant(shared->language_mode())); |
1572 : Context::SLOPPY_ARGUMENTS_MAP_INDEX)), | 1558 NodeProperties::ChangeOp(node, new_op); |
1573 load_native_context, effect, control); | 1559 return Changed(node); |
1574 // Actually allocate and initialize the arguments object. | 1560 } |
1575 AllocationBuilder a(jsgraph(), allocate_effect, control); | 1561 } else if (outer_state->opcode() == IrOpcode::kFrameState) { |
1576 Node* properties = jsgraph()->EmptyFixedArrayConstant(); | 1562 // Use inline allocation for all mapped arguments objects within inlined |
1577 int length = args_state_info.parameter_count() - 1; // Minus receiver. | 1563 // (i.e. non-outermost) frames, independent of the object size. |
1578 STATIC_ASSERT(Heap::kSloppyArgumentsObjectSize == 5 * kPointerSize); | 1564 if (p.type() == CreateArgumentsParameters::kMappedArguments) { |
1579 a.Allocate(Heap::kSloppyArgumentsObjectSize); | 1565 Handle<SharedFunctionInfo> shared; |
1580 a.Store(AccessBuilder::ForMap(), load_arguments_map); | 1566 if (!state_info.shared_info().ToHandle(&shared)) return NoChange(); |
1581 a.Store(AccessBuilder::ForJSObjectProperties(), properties); | 1567 Node* const callee = NodeProperties::GetValueInput(node, 0); |
1582 a.Store(AccessBuilder::ForJSObjectElements(), elements); | 1568 Node* const control = NodeProperties::GetControlInput(node); |
1583 a.Store(AccessBuilder::ForArgumentsLength(), jsgraph()->Constant(length)); | 1569 Node* const context = NodeProperties::GetContextInput(node); |
1584 a.Store(AccessBuilder::ForArgumentsCallee(), callee); | 1570 Node* effect = NodeProperties::GetEffectInput(node); |
1585 RelaxControls(node); | 1571 // TODO(mstarzinger): Duplicate parameters are not handled yet. |
1586 a.FinishAndChange(node); | 1572 if (shared->has_duplicate_parameters()) return NoChange(); |
1587 return Changed(node); | 1573 // Choose the correct frame state and frame state info depending on |
1588 } | 1574 // whether there conceptually is an arguments adaptor frame in the call |
| 1575 // chain. |
| 1576 Node* const args_state = GetArgumentsFrameState(frame_state); |
| 1577 FrameStateInfo args_state_info = OpParameter<FrameStateInfo>(args_state); |
| 1578 // Prepare element backing store to be used by arguments object. |
| 1579 bool has_aliased_arguments = false; |
| 1580 Node* const elements = AllocateAliasedArguments( |
| 1581 effect, control, args_state, context, shared, &has_aliased_arguments); |
| 1582 effect = elements->op()->EffectOutputCount() > 0 ? elements : effect; |
| 1583 // Load the arguments object map from the current native context. |
| 1584 Node* const load_native_context = effect = graph()->NewNode( |
| 1585 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), |
| 1586 context, context, effect); |
| 1587 Node* const load_arguments_map = effect = graph()->NewNode( |
| 1588 simplified()->LoadField(AccessBuilder::ForContextSlot( |
| 1589 has_aliased_arguments ? Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX |
| 1590 : Context::SLOPPY_ARGUMENTS_MAP_INDEX)), |
| 1591 load_native_context, effect, control); |
| 1592 // Actually allocate and initialize the arguments object. |
| 1593 AllocationBuilder a(jsgraph(), effect, control); |
| 1594 Node* properties = jsgraph()->EmptyFixedArrayConstant(); |
| 1595 int length = args_state_info.parameter_count() - 1; // Minus receiver. |
| 1596 STATIC_ASSERT(Heap::kSloppyArgumentsObjectSize == 5 * kPointerSize); |
| 1597 a.Allocate(Heap::kSloppyArgumentsObjectSize); |
| 1598 a.Store(AccessBuilder::ForMap(), load_arguments_map); |
| 1599 a.Store(AccessBuilder::ForJSObjectProperties(), properties); |
| 1600 a.Store(AccessBuilder::ForJSObjectElements(), elements); |
| 1601 a.Store(AccessBuilder::ForArgumentsLength(), jsgraph()->Constant(length)); |
| 1602 a.Store(AccessBuilder::ForArgumentsCallee(), callee); |
| 1603 RelaxControls(node); |
| 1604 a.FinishAndChange(node); |
| 1605 return Changed(node); |
| 1606 } else if (p.type() == CreateArgumentsParameters::kUnmappedArguments) { |
| 1607 // Use inline allocation for all unmapped arguments objects within inlined |
| 1608 // (i.e. non-outermost) frames, independent of the object size. |
| 1609 Node* const control = NodeProperties::GetControlInput(node); |
| 1610 Node* const context = NodeProperties::GetContextInput(node); |
| 1611 Node* effect = NodeProperties::GetEffectInput(node); |
| 1612 // Choose the correct frame state and frame state info depending on |
| 1613 // whether there conceptually is an arguments adaptor frame in the call |
| 1614 // chain. |
| 1615 Node* const args_state = GetArgumentsFrameState(frame_state); |
| 1616 FrameStateInfo args_state_info = OpParameter<FrameStateInfo>(args_state); |
| 1617 // Prepare element backing store to be used by arguments object. |
| 1618 Node* const elements = AllocateArguments(effect, control, args_state); |
| 1619 effect = elements->op()->EffectOutputCount() > 0 ? elements : effect; |
| 1620 // Load the arguments object map from the current native context. |
| 1621 Node* const load_native_context = effect = graph()->NewNode( |
| 1622 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), |
| 1623 context, context, effect); |
| 1624 Node* const load_arguments_map = effect = graph()->NewNode( |
| 1625 simplified()->LoadField(AccessBuilder::ForContextSlot( |
| 1626 Context::STRICT_ARGUMENTS_MAP_INDEX)), |
| 1627 load_native_context, effect, control); |
| 1628 // Actually allocate and initialize the arguments object. |
| 1629 AllocationBuilder a(jsgraph(), effect, control); |
| 1630 Node* properties = jsgraph()->EmptyFixedArrayConstant(); |
| 1631 int length = args_state_info.parameter_count() - 1; // Minus receiver. |
| 1632 STATIC_ASSERT(Heap::kStrictArgumentsObjectSize == 4 * kPointerSize); |
| 1633 a.Allocate(Heap::kStrictArgumentsObjectSize); |
| 1634 a.Store(AccessBuilder::ForMap(), load_arguments_map); |
| 1635 a.Store(AccessBuilder::ForJSObjectProperties(), properties); |
| 1636 a.Store(AccessBuilder::ForJSObjectElements(), elements); |
| 1637 a.Store(AccessBuilder::ForArgumentsLength(), jsgraph()->Constant(length)); |
| 1638 RelaxControls(node); |
| 1639 a.FinishAndChange(node); |
| 1640 return Changed(node); |
| 1641 } else if (p.type() == CreateArgumentsParameters::kRestArray) { |
| 1642 // Use inline allocation for all unmapped arguments objects within inlined |
| 1643 // (i.e. non-outermost) frames, independent of the object size. |
| 1644 Node* const control = NodeProperties::GetControlInput(node); |
| 1645 Node* const context = NodeProperties::GetContextInput(node); |
| 1646 Node* effect = NodeProperties::GetEffectInput(node); |
| 1647 // Choose the correct frame state and frame state info depending on |
| 1648 // whether there conceptually is an arguments adaptor frame in the call |
| 1649 // chain. |
| 1650 Node* const args_state = GetArgumentsFrameState(frame_state); |
| 1651 FrameStateInfo args_state_info = OpParameter<FrameStateInfo>(args_state); |
| 1652 // Prepare element backing store to be used by the rest array. |
| 1653 Node* const elements = |
| 1654 AllocateRestArguments(effect, control, args_state, p.start_index()); |
| 1655 effect = elements->op()->EffectOutputCount() > 0 ? elements : effect; |
| 1656 // Load the JSArray object map from the current native context. |
| 1657 Node* const load_native_context = effect = graph()->NewNode( |
| 1658 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), |
| 1659 context, context, effect); |
| 1660 Node* const load_jsarray_map = effect = graph()->NewNode( |
| 1661 simplified()->LoadField(AccessBuilder::ForContextSlot( |
| 1662 Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX)), |
| 1663 load_native_context, effect, control); |
| 1664 // Actually allocate and initialize the jsarray. |
| 1665 AllocationBuilder a(jsgraph(), effect, control); |
| 1666 Node* properties = jsgraph()->EmptyFixedArrayConstant(); |
1589 | 1667 |
1590 // Use inline allocation for all unmapped arguments objects within inlined | 1668 // -1 to minus receiver |
1591 // (i.e. non-outermost) frames, independent of the object size. | 1669 int argument_count = args_state_info.parameter_count() - 1; |
1592 if (p.type() == CreateArgumentsParameters::kUnmappedArguments && | 1670 int length = std::max(0, argument_count - p.start_index()); |
1593 outer_state->opcode() == IrOpcode::kFrameState) { | 1671 STATIC_ASSERT(JSArray::kSize == 4 * kPointerSize); |
1594 Node* const effect = NodeProperties::GetEffectInput(node); | 1672 a.Allocate(JSArray::kSize); |
1595 Node* const control = NodeProperties::GetControlInput(node); | 1673 a.Store(AccessBuilder::ForMap(), load_jsarray_map); |
1596 Node* const context = NodeProperties::GetContextInput(node); | 1674 a.Store(AccessBuilder::ForJSObjectProperties(), properties); |
1597 // Choose the correct frame state and frame state info depending on whether | 1675 a.Store(AccessBuilder::ForJSObjectElements(), elements); |
1598 // there conceptually is an arguments adaptor frame in the call chain. | 1676 a.Store(AccessBuilder::ForJSArrayLength(FAST_ELEMENTS), |
1599 Node* const args_state = GetArgumentsFrameState(frame_state); | 1677 jsgraph()->Constant(length)); |
1600 FrameStateInfo args_state_info = OpParameter<FrameStateInfo>(args_state); | 1678 RelaxControls(node); |
1601 // Prepare element backing store to be used by arguments object. | 1679 a.FinishAndChange(node); |
1602 Node* const elements = AllocateArguments(effect, control, args_state); | 1680 return Changed(node); |
1603 Node* allocate_effect = | 1681 } |
1604 elements->op()->EffectOutputCount() > 0 ? elements : effect; | |
1605 // Load the arguments object map from the current native context. | |
1606 Node* const load_native_context = graph()->NewNode( | |
1607 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), | |
1608 context, context, effect); | |
1609 Node* const load_arguments_map = graph()->NewNode( | |
1610 simplified()->LoadField( | |
1611 AccessBuilder::ForContextSlot(Context::STRICT_ARGUMENTS_MAP_INDEX)), | |
1612 load_native_context, effect, control); | |
1613 // Actually allocate and initialize the arguments object. | |
1614 AllocationBuilder a(jsgraph(), allocate_effect, control); | |
1615 Node* properties = jsgraph()->EmptyFixedArrayConstant(); | |
1616 int length = args_state_info.parameter_count() - 1; // Minus receiver. | |
1617 STATIC_ASSERT(Heap::kStrictArgumentsObjectSize == 4 * kPointerSize); | |
1618 a.Allocate(Heap::kStrictArgumentsObjectSize); | |
1619 a.Store(AccessBuilder::ForMap(), load_arguments_map); | |
1620 a.Store(AccessBuilder::ForJSObjectProperties(), properties); | |
1621 a.Store(AccessBuilder::ForJSObjectElements(), elements); | |
1622 a.Store(AccessBuilder::ForArgumentsLength(), jsgraph()->Constant(length)); | |
1623 RelaxControls(node); | |
1624 a.FinishAndChange(node); | |
1625 return Changed(node); | |
1626 } | 1682 } |
1627 | 1683 |
1628 return NoChange(); | 1684 return NoChange(); |
1629 } | 1685 } |
1630 | 1686 |
1631 | 1687 |
1632 Reduction JSTypedLowering::ReduceNewArray(Node* node, Node* length, | 1688 Reduction JSTypedLowering::ReduceNewArray(Node* node, Node* length, |
1633 int capacity, | 1689 int capacity, |
1634 Handle<AllocationSite> site) { | 1690 Handle<AllocationSite> site) { |
1635 DCHECK_EQ(IrOpcode::kJSCreateArray, node->opcode()); | 1691 DCHECK_EQ(IrOpcode::kJSCreateArray, node->opcode()); |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2641 // given {frame_state}. Serves as backing store for JSCreateArguments nodes. | 2697 // given {frame_state}. Serves as backing store for JSCreateArguments nodes. |
2642 Node* JSTypedLowering::AllocateArguments(Node* effect, Node* control, | 2698 Node* JSTypedLowering::AllocateArguments(Node* effect, Node* control, |
2643 Node* frame_state) { | 2699 Node* frame_state) { |
2644 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state); | 2700 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state); |
2645 int argument_count = state_info.parameter_count() - 1; // Minus receiver. | 2701 int argument_count = state_info.parameter_count() - 1; // Minus receiver. |
2646 if (argument_count == 0) return jsgraph()->EmptyFixedArrayConstant(); | 2702 if (argument_count == 0) return jsgraph()->EmptyFixedArrayConstant(); |
2647 | 2703 |
2648 // Prepare an iterator over argument values recorded in the frame state. | 2704 // Prepare an iterator over argument values recorded in the frame state. |
2649 Node* const parameters = frame_state->InputAt(kFrameStateParametersInput); | 2705 Node* const parameters = frame_state->InputAt(kFrameStateParametersInput); |
2650 StateValuesAccess parameters_access(parameters); | 2706 StateValuesAccess parameters_access(parameters); |
2651 auto paratemers_it = ++parameters_access.begin(); | 2707 auto parameters_it = ++parameters_access.begin(); |
2652 | 2708 |
2653 // Actually allocate the backing store. | 2709 // Actually allocate the backing store. |
2654 AllocationBuilder a(jsgraph(), effect, control); | 2710 AllocationBuilder a(jsgraph(), effect, control); |
2655 a.AllocateArray(argument_count, factory()->fixed_array_map()); | 2711 a.AllocateArray(argument_count, factory()->fixed_array_map()); |
2656 for (int i = 0; i < argument_count; ++i, ++paratemers_it) { | 2712 for (int i = 0; i < argument_count; ++i, ++parameters_it) { |
2657 a.Store(AccessBuilder::ForFixedArraySlot(i), (*paratemers_it).node); | 2713 a.Store(AccessBuilder::ForFixedArraySlot(i), (*parameters_it).node); |
2658 } | 2714 } |
2659 return a.Finish(); | 2715 return a.Finish(); |
2660 } | 2716 } |
| 2717 |
| 2718 |
| 2719 // Helper that allocates a FixedArray holding argument values recorded in the |
| 2720 // given {frame_state}. Serves as backing store for JSCreateArguments nodes. |
| 2721 Node* JSTypedLowering::AllocateRestArguments(Node* effect, Node* control, |
| 2722 Node* frame_state, |
| 2723 int start_index) { |
| 2724 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state); |
| 2725 int argument_count = state_info.parameter_count() - 1; // Minus receiver. |
| 2726 int num_elements = std::max(0, argument_count - start_index); |
| 2727 if (num_elements == 0) return jsgraph()->EmptyFixedArrayConstant(); |
| 2728 |
| 2729 // Prepare an iterator over argument values recorded in the frame state. |
| 2730 Node* const parameters = frame_state->InputAt(kFrameStateParametersInput); |
| 2731 StateValuesAccess parameters_access(parameters); |
| 2732 auto parameters_it = ++parameters_access.begin(); |
| 2733 |
| 2734 // Skip unused arguments. |
| 2735 for (int i = 0; i < start_index; i++) { |
| 2736 ++parameters_it; |
| 2737 } |
| 2738 |
| 2739 // Actually allocate the backing store. |
| 2740 AllocationBuilder a(jsgraph(), effect, control); |
| 2741 a.AllocateArray(num_elements, factory()->fixed_array_map()); |
| 2742 for (int i = 0; i < num_elements; ++i, ++parameters_it) { |
| 2743 a.Store(AccessBuilder::ForFixedArraySlot(i), (*parameters_it).node); |
| 2744 } |
| 2745 return a.Finish(); |
| 2746 } |
2661 | 2747 |
2662 | 2748 |
2663 // Helper that allocates a FixedArray serving as a parameter map for values | 2749 // Helper that allocates a FixedArray serving as a parameter map for values |
2664 // recorded in the given {frame_state}. Some elements map to slots within the | 2750 // recorded in the given {frame_state}. Some elements map to slots within the |
2665 // given {context}. Serves as backing store for JSCreateArguments nodes. | 2751 // given {context}. Serves as backing store for JSCreateArguments nodes. |
2666 Node* JSTypedLowering::AllocateAliasedArguments( | 2752 Node* JSTypedLowering::AllocateAliasedArguments( |
2667 Node* effect, Node* control, Node* frame_state, Node* context, | 2753 Node* effect, Node* control, Node* frame_state, Node* context, |
2668 Handle<SharedFunctionInfo> shared, bool* has_aliased_arguments) { | 2754 Handle<SharedFunctionInfo> shared, bool* has_aliased_arguments) { |
2669 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state); | 2755 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state); |
2670 int argument_count = state_info.parameter_count() - 1; // Minus receiver. | 2756 int argument_count = state_info.parameter_count() - 1; // Minus receiver. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2769 } | 2855 } |
2770 | 2856 |
2771 | 2857 |
2772 CompilationDependencies* JSTypedLowering::dependencies() const { | 2858 CompilationDependencies* JSTypedLowering::dependencies() const { |
2773 return dependencies_; | 2859 return dependencies_; |
2774 } | 2860 } |
2775 | 2861 |
2776 } // namespace compiler | 2862 } // namespace compiler |
2777 } // namespace internal | 2863 } // namespace internal |
2778 } // namespace v8 | 2864 } // namespace v8 |
OLD | NEW |