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

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

Issue 1348773002: [turbofan] Call ArgumentsAccessStub to materialize arguments. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: One more variant. Created 5 years, 3 months 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/compiler/js-typed-lowering.h ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | 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 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 graph()->NewNode(common()->Merge(2), check_true, check_false); 1090 graph()->NewNode(common()->Merge(2), check_true, check_false);
1091 Node* new_effect = 1091 Node* new_effect =
1092 graph()->NewNode(common()->EffectPhi(2), fast, slow, new_control); 1092 graph()->NewNode(common()->EffectPhi(2), fast, slow, new_control);
1093 Node* new_value = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), fast, 1093 Node* new_value = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), fast,
1094 slow, new_control); 1094 slow, new_control);
1095 ReplaceWithValue(node, new_value, new_effect, new_control); 1095 ReplaceWithValue(node, new_value, new_effect, new_control);
1096 return Changed(new_value); 1096 return Changed(new_value);
1097 } 1097 }
1098 1098
1099 1099
1100 Reduction JSTypedLowering::ReduceJSCreateArguments(Node* node) {
1101 DCHECK_EQ(IrOpcode::kJSCreateArguments, node->opcode());
1102 CreateArgumentsParameters const& p = CreateArgumentsParametersOf(node->op());
1103 Node* const frame_state = NodeProperties::GetFrameStateInput(node, 0);
1104 Node* const outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
1105 FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state);
1106
1107 // Use the ArgumentsAccessStub for materializing both mapped and unmapped
1108 // arguments object, but only for non-inlined (i.e. outermost) frames.
1109 if (p.type() != CreateArgumentsParameters::kRestArray &&
1110 outer_state->opcode() != IrOpcode::kFrameState) {
1111 Isolate* isolate = jsgraph()->isolate();
1112 Handle<SharedFunctionInfo> s = state_info.shared_info().ToHandleChecked();
1113 ArgumentsAccessStub::Type type =
1114 p.type() == CreateArgumentsParameters::kUnmappedArguments
1115 ? ArgumentsAccessStub::NEW_STRICT
1116 : s->has_duplicate_parameters()
1117 ? ArgumentsAccessStub::NEW_SLOPPY_SLOW
1118 : ArgumentsAccessStub::NEW_SLOPPY_FAST;
mvstanton 2015/09/17 13:29:44 Oh wow, I'm not a fan of this multiple ternary op
1119 Callable callable = CodeFactory::ArgumentsAccess(isolate, type);
1120 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
1121 isolate, graph()->zone(), callable.descriptor(), 0,
1122 CallDescriptor::kNeedsFrameState);
1123 const Operator* new_op = common()->Call(desc);
1124 int parameter_count = state_info.parameter_count() - 1;
1125 int parameter_offset = parameter_count * kPointerSize;
1126 int offset = StandardFrameConstants::kCallerSPOffset + parameter_offset;
1127 Node* stub_code = jsgraph()->HeapConstant(callable.code());
1128 Node* parameter_pointer = graph()->NewNode(
1129 machine()->IntAdd(), graph()->NewNode(machine()->LoadFramePointer()),
1130 jsgraph()->Constant(offset));
1131 node->InsertInput(graph()->zone(), 0, stub_code);
1132 node->InsertInput(graph()->zone(), 2, jsgraph()->Constant(parameter_count));
1133 node->InsertInput(graph()->zone(), 3, parameter_pointer);
1134 node->set_op(new_op);
1135 return Changed(node);
1136 }
1137
1138 return NoChange();
1139 }
1140
1141
1100 Reduction JSTypedLowering::ReduceJSCreateClosure(Node* node) { 1142 Reduction JSTypedLowering::ReduceJSCreateClosure(Node* node) {
1101 DCHECK_EQ(IrOpcode::kJSCreateClosure, node->opcode()); 1143 DCHECK_EQ(IrOpcode::kJSCreateClosure, node->opcode());
1102 CreateClosureParameters const& p = CreateClosureParametersOf(node->op()); 1144 CreateClosureParameters const& p = CreateClosureParametersOf(node->op());
1103 Handle<SharedFunctionInfo> shared = p.shared_info(); 1145 Handle<SharedFunctionInfo> shared = p.shared_info();
1104 1146
1105 // Use the FastNewClosureStub that allocates in new space only for nested 1147 // Use the FastNewClosureStub that allocates in new space only for nested
1106 // functions that don't need literals cloning. 1148 // functions that don't need literals cloning.
1107 if (p.pretenure() == NOT_TENURED && shared->num_literals() == 0) { 1149 if (p.pretenure() == NOT_TENURED && shared->num_literals() == 0) {
1108 Isolate* isolate = jsgraph()->isolate(); 1150 Isolate* isolate = jsgraph()->isolate();
1109 Callable callable = CodeFactory::FastNewClosure( 1151 Callable callable = CodeFactory::FastNewClosure(
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 case IrOpcode::kJSStoreProperty: 1686 case IrOpcode::kJSStoreProperty:
1645 return ReduceJSStoreProperty(node); 1687 return ReduceJSStoreProperty(node);
1646 case IrOpcode::kJSLoadContext: 1688 case IrOpcode::kJSLoadContext:
1647 return ReduceJSLoadContext(node); 1689 return ReduceJSLoadContext(node);
1648 case IrOpcode::kJSStoreContext: 1690 case IrOpcode::kJSStoreContext:
1649 return ReduceJSStoreContext(node); 1691 return ReduceJSStoreContext(node);
1650 case IrOpcode::kJSLoadDynamicGlobal: 1692 case IrOpcode::kJSLoadDynamicGlobal:
1651 return ReduceJSLoadDynamicGlobal(node); 1693 return ReduceJSLoadDynamicGlobal(node);
1652 case IrOpcode::kJSLoadDynamicContext: 1694 case IrOpcode::kJSLoadDynamicContext:
1653 return ReduceJSLoadDynamicContext(node); 1695 return ReduceJSLoadDynamicContext(node);
1696 case IrOpcode::kJSCreateArguments:
1697 return ReduceJSCreateArguments(node);
1654 case IrOpcode::kJSCreateClosure: 1698 case IrOpcode::kJSCreateClosure:
1655 return ReduceJSCreateClosure(node); 1699 return ReduceJSCreateClosure(node);
1656 case IrOpcode::kJSCreateLiteralArray: 1700 case IrOpcode::kJSCreateLiteralArray:
1657 return ReduceJSCreateLiteralArray(node); 1701 return ReduceJSCreateLiteralArray(node);
1658 case IrOpcode::kJSCreateLiteralObject: 1702 case IrOpcode::kJSCreateLiteralObject:
1659 return ReduceJSCreateLiteralObject(node); 1703 return ReduceJSCreateLiteralObject(node);
1660 case IrOpcode::kJSCreateWithContext: 1704 case IrOpcode::kJSCreateWithContext:
1661 return ReduceJSCreateWithContext(node); 1705 return ReduceJSCreateWithContext(node);
1662 case IrOpcode::kJSCreateBlockContext: 1706 case IrOpcode::kJSCreateBlockContext:
1663 return ReduceJSCreateBlockContext(node); 1707 return ReduceJSCreateBlockContext(node);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 } 1748 }
1705 1749
1706 1750
1707 MachineOperatorBuilder* JSTypedLowering::machine() const { 1751 MachineOperatorBuilder* JSTypedLowering::machine() const {
1708 return jsgraph()->machine(); 1752 return jsgraph()->machine();
1709 } 1753 }
1710 1754
1711 } // namespace compiler 1755 } // namespace compiler
1712 } // namespace internal 1756 } // namespace internal
1713 } // namespace v8 1757 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698