Commit 29208428 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[turbofan] Assume deoptimization support in create lowering.

This simplfies the code for lowering of {JSCreateArguments} nodes under
the assumption that deoptimization support is always enabled, and that
arguments objects are only materialized for JavaScript frames and not
for internal stub frames.

R=tebbi@chromium.org

Change-Id: I5f86ae0f0442a03b516904d737c5a0eac293b5b9
Reviewed-on: https://chromium-review.googlesource.com/640381Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47685}
parent 7770b1d1
......@@ -206,12 +206,6 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewRestParameter(Node* context,
return result.value();
}
TF_BUILTIN(FastNewRestParameter, ArgumentsBuiltinsAssembler) {
Node* function = Parameter(Descriptor::kFunction);
Node* context = Parameter(Descriptor::kContext);
Return(EmitFastNewRestParameter(context, function));
}
Node* ArgumentsBuiltinsAssembler::EmitFastNewStrictArguments(Node* context,
Node* function) {
VARIABLE(result, MachineRepresentation::kTagged);
......@@ -262,12 +256,6 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewStrictArguments(Node* context,
return result.value();
}
TF_BUILTIN(FastNewStrictArguments, ArgumentsBuiltinsAssembler) {
Node* function = Parameter(FastNewArgumentsDescriptor::kFunction);
Node* context = Parameter(FastNewArgumentsDescriptor::kContext);
Return(EmitFastNewStrictArguments(context, function));
}
Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
Node* function) {
Node* frame_ptr;
......
......@@ -73,9 +73,7 @@ namespace internal {
TFC(FastNewClosure, FastNewClosure, 1) \
TFC(FastNewFunctionContextEval, FastNewFunctionContext, 1) \
TFC(FastNewFunctionContextFunction, FastNewFunctionContext, 1) \
TFC(FastNewStrictArguments, FastNewArguments, 1) \
TFC(FastNewSloppyArguments, FastNewArguments, 1) \
TFC(FastNewRestParameter, FastNewArguments, 1) \
TFC(FastCloneRegExp, FastCloneRegExp, 1) \
TFC(FastCloneShallowArrayTrack, FastCloneShallowArray, 1) \
TFC(FastCloneShallowArrayDontTrack, FastCloneShallowArray, 1) \
......
......@@ -301,21 +301,19 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
Node* const outer_state = frame_state->InputAt(kFrameStateOuterStateInput);
Node* const control = graph()->start();
FrameStateInfo state_info = OpParameter<FrameStateInfo>(frame_state);
Handle<SharedFunctionInfo> shared =
state_info.shared_info().ToHandleChecked();
// Use the ArgumentsAccessStub for materializing both mapped and unmapped
// arguments object, but only for non-inlined (i.e. outermost) frames.
if (outer_state->opcode() != IrOpcode::kFrameState) {
switch (type) {
case CreateArgumentsType::kMappedArguments: {
// TODO(bmeurer): Make deoptimization mandatory for the various
// arguments objects, so that we always have a shared_info here.
Handle<SharedFunctionInfo> shared_info;
if (state_info.shared_info().ToHandle(&shared_info)) {
// TODO(mstarzinger): Duplicate parameters are not handled yet.
if (shared_info->has_duplicate_parameters()) return NoChange();
if (shared->has_duplicate_parameters()) return NoChange();
// If there is no aliasing, the arguments object elements are not
// special in any way, we can just return an unmapped backing store.
if (shared_info->internal_formal_parameter_count() == 0) {
if (shared->internal_formal_parameter_count() == 0) {
Node* const callee = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
Node* const arguments_frame =
......@@ -356,17 +354,13 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
}
return Changed(node);
}
return NoChange();
}
case CreateArgumentsType::kUnmappedArguments: {
Handle<SharedFunctionInfo> shared_info;
if (state_info.shared_info().ToHandle(&shared_info)) {
Node* effect = NodeProperties::GetEffectInput(node);
Node* const arguments_frame =
graph()->NewNode(simplified()->ArgumentsFrame());
Node* const arguments_length = graph()->NewNode(
simplified()->ArgumentsLength(
shared_info->internal_formal_parameter_count(), false),
shared->internal_formal_parameter_count(), false),
arguments_frame);
// Allocate the elements backing store.
Node* const elements = effect =
......@@ -386,28 +380,13 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
a.Store(AccessBuilder::ForArgumentsLength(), arguments_length);
RelaxControls(node);
a.FinishAndChange(node);
} else {
Callable callable = Builtins::CallableFor(
isolate(), Builtins::kFastNewStrictArguments);
Operator::Properties properties = node->op()->properties();
CallDescriptor* desc = Linkage::GetStubCallDescriptor(
isolate(), graph()->zone(), callable.descriptor(), 0,
CallDescriptor::kNeedsFrameState, properties);
const Operator* new_op = common()->Call(desc);
Node* stub_code = jsgraph()->HeapConstant(callable.code());
node->InsertInput(graph()->zone(), 0, stub_code);
NodeProperties::ChangeOp(node, new_op);
}
return Changed(node);
}
case CreateArgumentsType::kRestParameter: {
Handle<SharedFunctionInfo> shared_info;
if (state_info.shared_info().ToHandle(&shared_info)) {
Node* effect = NodeProperties::GetEffectInput(node);
Node* const arguments_frame =
graph()->NewNode(simplified()->ArgumentsFrame());
int formal_parameter_count =
shared_info->internal_formal_parameter_count();
int formal_parameter_count = shared->internal_formal_parameter_count();
Node* const rest_length = graph()->NewNode(
simplified()->ArgumentsLength(formal_parameter_count, true),
arguments_frame);
......@@ -428,22 +407,9 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
a.Store(AccessBuilder::ForMap(), jsarray_map);
a.Store(AccessBuilder::ForJSObjectPropertiesOrHash(), properties);
a.Store(AccessBuilder::ForJSObjectElements(), elements);
a.Store(AccessBuilder::ForJSArrayLength(PACKED_ELEMENTS),
rest_length);
a.Store(AccessBuilder::ForJSArrayLength(PACKED_ELEMENTS), rest_length);
RelaxControls(node);
a.FinishAndChange(node);
} else {
Callable callable =
Builtins::CallableFor(isolate(), Builtins::kFastNewRestParameter);
Operator::Properties properties = node->op()->properties();
CallDescriptor* desc = Linkage::GetStubCallDescriptor(
isolate(), graph()->zone(), callable.descriptor(), 0,
CallDescriptor::kNeedsFrameState, properties);
const Operator* new_op = common()->Call(desc);
Node* stub_code = jsgraph()->HeapConstant(callable.code());
node->InsertInput(graph()->zone(), 0, stub_code);
NodeProperties::ChangeOp(node, new_op);
}
return Changed(node);
}
}
......@@ -452,8 +418,6 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
// Use inline allocation for all mapped arguments objects within inlined
// (i.e. non-outermost) frames, independent of the object size.
if (type == CreateArgumentsType::kMappedArguments) {
Handle<SharedFunctionInfo> shared;
if (!state_info.shared_info().ToHandle(&shared)) return NoChange();
Node* const callee = NodeProperties::GetValueInput(node, 0);
Node* const context = NodeProperties::GetContextInput(node);
Node* effect = NodeProperties::GetEffectInput(node);
......@@ -517,8 +481,6 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
a.FinishAndChange(node);
return Changed(node);
} else if (type == CreateArgumentsType::kRestParameter) {
Handle<SharedFunctionInfo> shared;
if (!state_info.shared_info().ToHandle(&shared)) return NoChange();
int start_index = shared->internal_formal_parameter_count();
// Use inline allocation for all unmapped arguments objects within inlined
// (i.e. non-outermost) frames, independent of the object size.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment