Chromium Code Reviews| Index: src/compiler/js-typed-lowering.cc |
| diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc |
| index c5d03d117b8abf57c1e5d2bea8c7127ef06e4742..a1e839a5811bdd645158ae4b2f31fb56078f778a 100644 |
| --- a/src/compiler/js-typed-lowering.cc |
| +++ b/src/compiler/js-typed-lowering.cc |
| @@ -1097,6 +1097,48 @@ Reduction JSTypedLowering::ReduceJSLoadDynamicContext(Node* node) { |
| } |
| +Reduction JSTypedLowering::ReduceJSCreateArguments(Node* node) { |
| + DCHECK_EQ(IrOpcode::kJSCreateArguments, node->opcode()); |
| + CreateArgumentsParameters const& p = CreateArgumentsParametersOf(node->op()); |
| + Node* const frame_state = NodeProperties::GetFrameStateInput(node, 0); |
| + Node* const outer_state = frame_state->InputAt(kFrameStateOuterStateInput); |
| + FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state); |
| + |
| + // Use the ArgumentsAccessStub for materializing both mapped and unmapped |
| + // arguments object, but only for non-inlined (i.e. outermost) frames. |
| + if (p.type() != CreateArgumentsParameters::kRestArray && |
| + outer_state->opcode() != IrOpcode::kFrameState) { |
| + Isolate* isolate = jsgraph()->isolate(); |
| + Handle<SharedFunctionInfo> s = state_info.shared_info().ToHandleChecked(); |
| + ArgumentsAccessStub::Type type = |
| + p.type() == CreateArgumentsParameters::kUnmappedArguments |
| + ? ArgumentsAccessStub::NEW_STRICT |
| + : s->has_duplicate_parameters() |
| + ? ArgumentsAccessStub::NEW_SLOPPY_SLOW |
| + : ArgumentsAccessStub::NEW_SLOPPY_FAST; |
|
mvstanton
2015/09/17 13:29:44
Oh wow, I'm not a fan of this multiple ternary op
|
| + Callable callable = CodeFactory::ArgumentsAccess(isolate, type); |
| + CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| + isolate, graph()->zone(), callable.descriptor(), 0, |
| + CallDescriptor::kNeedsFrameState); |
| + const Operator* new_op = common()->Call(desc); |
| + int parameter_count = state_info.parameter_count() - 1; |
| + int parameter_offset = parameter_count * kPointerSize; |
| + int offset = StandardFrameConstants::kCallerSPOffset + parameter_offset; |
| + Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| + Node* parameter_pointer = graph()->NewNode( |
| + machine()->IntAdd(), graph()->NewNode(machine()->LoadFramePointer()), |
| + jsgraph()->Constant(offset)); |
| + node->InsertInput(graph()->zone(), 0, stub_code); |
| + node->InsertInput(graph()->zone(), 2, jsgraph()->Constant(parameter_count)); |
| + node->InsertInput(graph()->zone(), 3, parameter_pointer); |
| + node->set_op(new_op); |
| + return Changed(node); |
| + } |
| + |
| + return NoChange(); |
| +} |
| + |
| + |
| Reduction JSTypedLowering::ReduceJSCreateClosure(Node* node) { |
| DCHECK_EQ(IrOpcode::kJSCreateClosure, node->opcode()); |
| CreateClosureParameters const& p = CreateClosureParametersOf(node->op()); |
| @@ -1651,6 +1693,8 @@ Reduction JSTypedLowering::Reduce(Node* node) { |
| return ReduceJSLoadDynamicGlobal(node); |
| case IrOpcode::kJSLoadDynamicContext: |
| return ReduceJSLoadDynamicContext(node); |
| + case IrOpcode::kJSCreateArguments: |
| + return ReduceJSCreateArguments(node); |
| case IrOpcode::kJSCreateClosure: |
| return ReduceJSCreateClosure(node); |
| case IrOpcode::kJSCreateLiteralArray: |