Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 1417213004: [turbofan] Use the ArgumentsAdaptorTrampoline in case of argument count mismatch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/code-factory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler/access-builder.h" 6 #include "src/compiler/access-builder.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/js-typed-lowering.h" 8 #include "src/compiler/js-typed-lowering.h"
9 #include "src/compiler/linkage.h" 9 #include "src/compiler/linkage.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); 1582 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
1583 Node* effect = NodeProperties::GetEffectInput(node); 1583 Node* effect = NodeProperties::GetEffectInput(node);
1584 Node* control = NodeProperties::GetControlInput(node); 1584 Node* control = NodeProperties::GetControlInput(node);
1585 1585
1586 // Check if {target} is a known JSFunction. 1586 // Check if {target} is a known JSFunction.
1587 if (target_type->IsConstant() && 1587 if (target_type->IsConstant() &&
1588 target_type->AsConstant()->Value()->IsJSFunction()) { 1588 target_type->AsConstant()->Value()->IsJSFunction()) {
1589 Handle<JSFunction> function = 1589 Handle<JSFunction> function =
1590 Handle<JSFunction>::cast(target_type->AsConstant()->Value()); 1590 Handle<JSFunction>::cast(target_type->AsConstant()->Value());
1591 Handle<SharedFunctionInfo> shared(function->shared(), isolate()); 1591 Handle<SharedFunctionInfo> shared(function->shared(), isolate());
1592
1593 // Grab the context from the {function}.
1594 Node* context = jsgraph()->Constant(handle(function->context(), isolate()));
1595 NodeProperties::ReplaceContextInput(node, context);
1596
1597 // Check if we need to convert the {receiver}.
1598 if (is_sloppy(shared->language_mode()) && !shared->native() &&
1599 !receiver_type->Is(Type::Receiver())) {
1600 receiver = effect =
1601 graph()->NewNode(javascript()->ConvertReceiver(convert_mode),
1602 receiver, context, frame_state, effect, control);
1603 NodeProperties::ReplaceEffectInput(node, effect);
1604 NodeProperties::ReplaceValueInput(node, receiver, 1);
1605 }
1606
1607 // Remove the eager bailout frame state.
1608 NodeProperties::RemoveFrameStateInput(node, 1);
1609
1610 // Compute flags for the call.
1611 CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState;
1612 if (p.AllowTailCalls()) flags |= CallDescriptor::kSupportsTailCalls;
1613
1592 if (shared->internal_formal_parameter_count() == arity) { 1614 if (shared->internal_formal_parameter_count() == arity) {
1593 // Grab the context from the {function}.
1594 Node* context =
1595 jsgraph()->Constant(handle(function->context(), isolate()));
1596 NodeProperties::ReplaceContextInput(node, context);
1597
1598 // Check if we need to convert the {receiver}.
1599 if (is_sloppy(shared->language_mode()) && !shared->native() &&
1600 !receiver_type->Is(Type::Receiver())) {
1601 receiver = effect =
1602 graph()->NewNode(javascript()->ConvertReceiver(convert_mode),
1603 receiver, context, frame_state, effect, control);
1604 NodeProperties::ReplaceEffectInput(node, effect);
1605 NodeProperties::ReplaceValueInput(node, receiver, 1);
1606 }
1607
1608 // Remove the eager bailout frame state.
1609 NodeProperties::RemoveFrameStateInput(node, 1);
1610
1611 // Patch {node} to a direct call. 1615 // Patch {node} to a direct call.
1612 CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState;
1613 if (p.AllowTailCalls()) flags |= CallDescriptor::kSupportsTailCalls;
1614 NodeProperties::ChangeOp(node, 1616 NodeProperties::ChangeOp(node,
1615 common()->Call(Linkage::GetJSCallDescriptor( 1617 common()->Call(Linkage::GetJSCallDescriptor(
1616 graph()->zone(), false, 1 + arity, flags))); 1618 graph()->zone(), false, 1 + arity, flags)));
1617 return Changed(node); 1619 } else {
1620 Callable callable = CodeFactory::ArgumentAdaptor(isolate());
1621 node->InsertInput(graph()->zone(), 0,
1622 jsgraph()->HeapConstant(callable.code()));
1623 node->InsertInput(graph()->zone(), 2, jsgraph()->Int32Constant(arity));
1624 node->InsertInput(
1625 graph()->zone(), 3,
1626 jsgraph()->Int32Constant(shared->internal_formal_parameter_count()));
1627 NodeProperties::ChangeOp(
1628 node, common()->Call(Linkage::GetStubCallDescriptor(
1629 isolate(), graph()->zone(), callable.descriptor(),
1630 1 + arity, flags)));
1618 } 1631 }
1632 return Changed(node);
1619 } 1633 }
1620 1634
1621 return NoChange(); 1635 return NoChange();
1622 } 1636 }
1623 1637
1624 1638
1625 Reduction JSTypedLowering::ReduceJSForInDone(Node* node) { 1639 Reduction JSTypedLowering::ReduceJSForInDone(Node* node) {
1626 DCHECK_EQ(IrOpcode::kJSForInDone, node->opcode()); 1640 DCHECK_EQ(IrOpcode::kJSForInDone, node->opcode());
1627 node->TrimInputCount(2); 1641 node->TrimInputCount(2);
1628 NodeProperties::ChangeOp(node, machine()->Word32Equal()); 1642 NodeProperties::ChangeOp(node, machine()->Word32Equal());
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 } 2131 }
2118 2132
2119 2133
2120 MachineOperatorBuilder* JSTypedLowering::machine() const { 2134 MachineOperatorBuilder* JSTypedLowering::machine() const {
2121 return jsgraph()->machine(); 2135 return jsgraph()->machine();
2122 } 2136 }
2123 2137
2124 } // namespace compiler 2138 } // namespace compiler
2125 } // namespace internal 2139 } // namespace internal
2126 } // namespace v8 2140 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698