Commit f5eae65a authored by Victor Gomes's avatar Victor Gomes Committed by Commit Bot

[cleanup] Remove IrOpcode::kArgumentsFrame

After removing the arguments adaptor frame, this should not be needed anymore.

Removes ArgumentFrame from the following nodes:
- ArgumentsLength
- RestLength
- NewArgumentsElements

Also removes 'formal parameter count' as input of ArgumentsLength.

Adapt the escape analysis to use the frame pointer directly instead of the ArgumentsFrame node.

Change-Id: I0ead48a6ee05a10d05d6cfa2e46906ad69930986
Bug: v8:11306
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2639765
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72264}
parent 41c3140b
......@@ -148,7 +148,6 @@ class EffectControlLinearizer {
Node* LowerObjectIsInteger(Node* node);
Node* LowerNumberIsSafeInteger(Node* node);
Node* LowerObjectIsSafeInteger(Node* node);
Node* LowerArgumentsFrame(Node* node);
Node* LowerArgumentsLength(Node* node);
Node* LowerRestLength(Node* node);
Node* LowerNewDoubleElements(Node* node);
......@@ -1125,9 +1124,6 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kObjectIsUndetectable:
result = LowerObjectIsUndetectable(node);
break;
case IrOpcode::kArgumentsFrame:
result = LowerArgumentsFrame(node);
break;
case IrOpcode::kArgumentsLength:
result = LowerArgumentsLength(node);
break;
......@@ -3703,10 +3699,6 @@ Node* EffectControlLinearizer::LowerRestLength(Node* node) {
return done.PhiAt(0);
}
Node* EffectControlLinearizer::LowerArgumentsFrame(Node* node) {
return __ LoadFramePointer();
}
Node* EffectControlLinearizer::LowerNewDoubleElements(Node* node) {
AllocationType const allocation = AllocationTypeOf(node->op());
Node* length = node->InputAt(0);
......@@ -3806,8 +3798,8 @@ Node* EffectControlLinearizer::LowerNewArgumentsElements(Node* node) {
CreateArgumentsType type = parameters.arguments_type();
Operator::Properties const properties = node->op()->properties();
CallDescriptor::Flags const flags = CallDescriptor::kNoFlags;
Node* frame = NodeProperties::GetValueInput(node, 0);
Node* arguments_count = NodeProperties::GetValueInput(node, 1);
Node* frame = __ LoadFramePointer();
Node* arguments_count = NodeProperties::GetValueInput(node, 0);
Builtins::Name builtin_name;
switch (type) {
case CreateArgumentsType::kMappedArguments:
......
......@@ -229,9 +229,7 @@ void EscapeAnalysisReducer::Finalize() {
? params.formal_parameter_count()
: 0;
Node* arguments_frame = NodeProperties::GetValueInput(node, 0);
if (arguments_frame->opcode() != IrOpcode::kArgumentsFrame) continue;
Node* arguments_length = NodeProperties::GetValueInput(node, 1);
Node* arguments_length = NodeProperties::GetValueInput(node, 0);
if (arguments_length->opcode() != IrOpcode::kArgumentsLength) continue;
Node* arguments_length_state = nullptr;
......@@ -331,7 +329,10 @@ void EscapeAnalysisReducer::Finalize() {
}
NodeProperties::SetType(offset,
TypeCache::Get()->kArgumentsLengthType);
NodeProperties::ReplaceValueInput(load, arguments_frame, 0);
Node* frame = jsgraph()->graph()->NewNode(
jsgraph()->machine()->LoadFramePointer());
NodeProperties::SetType(frame, Type::ExternalPointer());
NodeProperties::ReplaceValueInput(load, frame, 0);
NodeProperties::ReplaceValueInput(load, offset, 1);
NodeProperties::ChangeOp(
load, jsgraph()->simplified()->LoadStackArgument());
......@@ -340,7 +341,7 @@ void EscapeAnalysisReducer::Finalize() {
case IrOpcode::kLoadField: {
DCHECK_EQ(FieldAccessOf(load->op()).offset,
FixedArray::kLengthOffset);
Node* length = NodeProperties::GetValueInput(node, 1);
Node* length = NodeProperties::GetValueInput(node, 0);
ReplaceWithValue(load, length);
break;
}
......
......@@ -164,17 +164,13 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
Node* const callee = NodeProperties::GetValueInput(node, 0);
Node* const context = NodeProperties::GetContextInput(node);
Node* effect = NodeProperties::GetEffectInput(node);
Node* const arguments_frame =
graph()->NewNode(simplified()->ArgumentsFrame());
Node* const arguments_length =
graph()->NewNode(simplified()->ArgumentsLength(
shared.internal_formal_parameter_count()),
arguments_frame);
graph()->NewNode(simplified()->ArgumentsLength());
// Allocate the elements backing store.
bool has_aliased_arguments = false;
Node* const elements = effect = AllocateAliasedArguments(
effect, control, context, arguments_frame, arguments_length, shared,
&has_aliased_arguments);
Node* const elements = effect =
AllocateAliasedArguments(effect, control, context, arguments_length,
shared, &has_aliased_arguments);
// Load the arguments object map.
Node* const arguments_map = jsgraph()->Constant(
has_aliased_arguments
......@@ -196,18 +192,14 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
}
case CreateArgumentsType::kUnmappedArguments: {
Node* effect = NodeProperties::GetEffectInput(node);
Node* const arguments_frame =
graph()->NewNode(simplified()->ArgumentsFrame());
Node* const arguments_length =
graph()->NewNode(simplified()->ArgumentsLength(
shared.internal_formal_parameter_count()),
arguments_frame);
graph()->NewNode(simplified()->ArgumentsLength());
// Allocate the elements backing store.
Node* const elements = effect =
graph()->NewNode(simplified()->NewArgumentsElements(
CreateArgumentsType::kUnmappedArguments,
shared.internal_formal_parameter_count()),
arguments_frame, arguments_length, effect);
arguments_length, effect);
// Load the arguments object map.
Node* const arguments_map =
jsgraph()->Constant(native_context().strict_arguments_map());
......@@ -226,21 +218,16 @@ Reduction JSCreateLowering::ReduceJSCreateArguments(Node* node) {
}
case CreateArgumentsType::kRestParameter: {
Node* effect = NodeProperties::GetEffectInput(node);
Node* const arguments_frame =
graph()->NewNode(simplified()->ArgumentsFrame());
Node* const arguments_length =
graph()->NewNode(simplified()->ArgumentsLength(
shared.internal_formal_parameter_count()),
arguments_frame);
graph()->NewNode(simplified()->ArgumentsLength());
Node* const rest_length = graph()->NewNode(
simplified()->RestLength(shared.internal_formal_parameter_count()),
arguments_frame);
simplified()->RestLength(shared.internal_formal_parameter_count()));
// Allocate the elements backing store.
Node* const elements = effect =
graph()->NewNode(simplified()->NewArgumentsElements(
CreateArgumentsType::kRestParameter,
shared.internal_formal_parameter_count()),
arguments_frame, arguments_length, effect);
arguments_length, effect);
// Load the JSArray object map.
Node* const jsarray_map = jsgraph()->Constant(
native_context().js_array_packed_elements_map());
......@@ -1537,9 +1524,8 @@ Node* JSCreateLowering::AllocateAliasedArguments(
// values can only be determined dynamically at run-time and are provided.
// Serves as backing store for JSCreateArguments nodes.
Node* JSCreateLowering::AllocateAliasedArguments(
Node* effect, Node* control, Node* context, Node* arguments_frame,
Node* arguments_length, const SharedFunctionInfoRef& shared,
bool* has_aliased_arguments) {
Node* effect, Node* control, Node* context, Node* arguments_length,
const SharedFunctionInfoRef& shared, bool* has_aliased_arguments) {
// If there is no aliasing, the arguments object elements are not
// special in any way, we can just return an unmapped backing store.
int parameter_count = shared.internal_formal_parameter_count();
......@@ -1547,7 +1533,7 @@ Node* JSCreateLowering::AllocateAliasedArguments(
return graph()->NewNode(
simplified()->NewArgumentsElements(
CreateArgumentsType::kUnmappedArguments, parameter_count),
arguments_frame, arguments_length, effect);
arguments_length, effect);
}
// From here on we are going to allocate a mapped (aka. aliased) elements
......@@ -1563,7 +1549,7 @@ Node* JSCreateLowering::AllocateAliasedArguments(
Node* arguments = effect =
graph()->NewNode(simplified()->NewArgumentsElements(
CreateArgumentsType::kMappedArguments, mapped_count),
arguments_frame, arguments_length, effect);
arguments_length, effect);
// Actually allocate the backing store.
AllocationBuilder a(jsgraph(), effect, control);
......
......@@ -91,7 +91,7 @@ class V8_EXPORT_PRIVATE JSCreateLowering final
const SharedFunctionInfoRef& shared,
bool* has_aliased_arguments);
Node* AllocateAliasedArguments(Node* effect, Node* control, Node* context,
Node* arguments_frame, Node* arguments_length,
Node* arguments_length,
const SharedFunctionInfoRef& shared,
bool* has_aliased_arguments);
Node* AllocateElements(Node* effect, Node* control,
......
......@@ -393,7 +393,6 @@
#define SIMPLIFIED_OTHER_OP_LIST(V) \
V(Allocate) \
V(AllocateRaw) \
V(ArgumentsFrame) \
V(ArgumentsLength) \
V(AssertType) \
V(BooleanNot) \
......
......@@ -3075,6 +3075,10 @@ class RepresentationSelector {
SetOutput<T>(node, MachineRepresentation::kTaggedPointer);
return;
}
case IrOpcode::kLoadFramePointer: {
SetOutput<T>(node, MachineType::PointerRepresentation());
return;
}
case IrOpcode::kLoadMessage: {
if (truncation.IsUnused()) return VisitUnused<T>(node);
VisitUnop<T>(node, UseInfo::Word(), MachineRepresentation::kTagged);
......@@ -3531,14 +3535,9 @@ class RepresentationSelector {
VisitObjectIs<T>(node, Type::Undetectable(), lowering);
return;
}
case IrOpcode::kArgumentsFrame: {
SetOutput<T>(node, MachineType::PointerRepresentation());
return;
}
case IrOpcode::kArgumentsLength:
case IrOpcode::kRestLength: {
VisitUnop<T>(node, UseInfo::Word(),
MachineRepresentation::kTaggedSigned);
SetOutput<T>(node, MachineRepresentation::kTaggedSigned);
return;
}
case IrOpcode::kNewDoubleElements:
......@@ -3548,8 +3547,8 @@ class RepresentationSelector {
return;
}
case IrOpcode::kNewArgumentsElements: {
VisitBinop<T>(node, UseInfo::Word(), UseInfo::TaggedSigned(),
MachineRepresentation::kTaggedPointer);
VisitUnop<T>(node, UseInfo::TaggedSigned(),
MachineRepresentation::kTaggedPointer);
return;
}
case IrOpcode::kCheckFloat64Hole: {
......
......@@ -972,13 +972,6 @@ struct SimplifiedOperatorGlobalCache final {
FindOrderedHashMapEntryForInt32KeyOperator
kFindOrderedHashMapEntryForInt32Key;
struct ArgumentsFrameOperator final : public Operator {
ArgumentsFrameOperator()
: Operator(IrOpcode::kArgumentsFrame, Operator::kPure, "ArgumentsFrame",
0, 0, 0, 1, 0, 0) {}
};
ArgumentsFrameOperator kArgumentsFrame;
template <CheckForMinusZeroMode kMode>
struct ChangeFloat64ToTaggedOperator final
: public Operator1<CheckForMinusZeroMode> {
......@@ -1225,7 +1218,6 @@ SimplifiedOperatorBuilder::SimplifiedOperatorBuilder(Zone* zone)
PURE_OP_LIST(GET_FROM_CACHE)
EFFECT_DEPENDENT_OP_LIST(GET_FROM_CACHE)
CHECKED_OP_LIST(GET_FROM_CACHE)
GET_FROM_CACHE(ArgumentsFrame)
GET_FROM_CACHE(FindOrderedHashMapEntry)
GET_FROM_CACHE(FindOrderedHashMapEntryForInt32Key)
GET_FROM_CACHE(LoadFieldByIndex)
......@@ -1637,14 +1629,12 @@ const Operator* SimplifiedOperatorBuilder::TransitionElementsKind(
transition); // parameter
}
const Operator* SimplifiedOperatorBuilder::ArgumentsLength(
int formal_parameter_count) {
return zone()->New<Operator1<int>>( // --
IrOpcode::kArgumentsLength, // opcode
Operator::kPure, // flags
"ArgumentsLength", // name
1, 0, 0, 1, 0, 0, // counts
formal_parameter_count); // parameter
const Operator* SimplifiedOperatorBuilder::ArgumentsLength() {
return zone()->New<Operator>( // --
IrOpcode::kArgumentsLength, // opcode
Operator::kPure, // flags
"ArgumentsLength", // name
0, 0, 0, 1, 0, 0); // counts
}
const Operator* SimplifiedOperatorBuilder::RestLength(
......@@ -1653,7 +1643,7 @@ const Operator* SimplifiedOperatorBuilder::RestLength(
IrOpcode::kRestLength, // opcode
Operator::kPure, // flags
"RestLength", // name
1, 0, 0, 1, 0, 0, // counts
0, 0, 0, 1, 0, 0, // counts
formal_parameter_count); // parameter
}
......@@ -1775,7 +1765,7 @@ const Operator* SimplifiedOperatorBuilder::NewArgumentsElements(
IrOpcode::kNewArgumentsElements, // opcode
Operator::kEliminatable, // flags
"NewArgumentsElements", // name
2, 1, 0, 1, 1, 0, // counts
1, 1, 0, 1, 1, 0, // counts
NewArgumentsElementsParameters(type,
formal_parameter_count)); // parameter
}
......
......@@ -972,14 +972,13 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
const Operator* NumberIsSafeInteger();
const Operator* ObjectIsInteger();
const Operator* ArgumentsFrame();
const Operator* ArgumentsLength(int formal_parameter_count);
const Operator* ArgumentsLength();
const Operator* RestLength(int formal_parameter_count);
const Operator* NewDoubleElements(AllocationType);
const Operator* NewSmiOrObjectElements(AllocationType);
// new-arguments-elements frame, arguments count
// new-arguments-elements arguments-length
const Operator* NewArgumentsElements(CreateArgumentsType type,
int formal_parameter_count);
......
......@@ -2323,10 +2323,6 @@ Type Typer::Visitor::TypeRestLength(Node* node) {
return TypeCache::Get()->kArgumentsLengthType;
}
Type Typer::Visitor::TypeArgumentsFrame(Node* node) {
return Type::ExternalPointer();
}
Type Typer::Visitor::TypeNewDoubleElements(Node* node) {
return Type::OtherInternal();
}
......
......@@ -1228,12 +1228,8 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
break;
case IrOpcode::kArgumentsLength:
case IrOpcode::kRestLength:
CheckValueInputIs(node, 0, Type::ExternalPointer());
CheckTypeIs(node, TypeCache::Get()->kArgumentsLengthType);
break;
case IrOpcode::kArgumentsFrame:
CheckTypeIs(node, Type::ExternalPointer());
break;
case IrOpcode::kNewDoubleElements:
case IrOpcode::kNewSmiOrObjectElements:
CheckValueInputIs(node, 0,
......@@ -1241,8 +1237,7 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
CheckTypeIs(node, Type::OtherInternal());
break;
case IrOpcode::kNewArgumentsElements:
CheckValueInputIs(node, 0, Type::ExternalPointer());
CheckValueInputIs(node, 1,
CheckValueInputIs(node, 0,
Type::Range(0.0, FixedArray::kMaxLength, zone));
CheckTypeIs(node, Type::OtherInternal());
break;
......
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