Commit 54301b00 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[turbofan] Reintroduce LoadStackArgument simplified operator

We are going to change again Tagged to not mean 'Full Tagged'. Then,
we have to reintroduce this operator, which was removed in
https://chromium-review.googlesource.com/c/v8/v8/+/1594439.

Bug: v8:7703
Change-Id: I8df65b76eed67613297b04d67c791cb6580bb49e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1817613
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63952}
parent 7caea488
......@@ -924,7 +924,7 @@ ElementAccess AccessBuilder::ForStackArgument() {
ElementAccess access = {
kUntaggedBase,
CommonFrameConstants::kFixedFrameSizeAboveFp - kSystemPointerSize,
Type::NonInternal(), MachineType::AnyTagged(),
Type::NonInternal(), MachineType::Pointer(),
WriteBarrierKind::kNoWriteBarrier};
return access;
}
......
......@@ -190,6 +190,7 @@ class EffectControlLinearizer {
Node* LowerLoadMessage(Node* node);
Node* LowerLoadTypedElement(Node* node);
Node* LowerLoadDataViewElement(Node* node);
Node* LowerLoadStackArgument(Node* node);
void LowerStoreMessage(Node* node);
void LowerStoreTypedElement(Node* node);
void LowerStoreDataViewElement(Node* node);
......@@ -1262,6 +1263,9 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kLoadDataViewElement:
result = LowerLoadDataViewElement(node);
break;
case IrOpcode::kLoadStackArgument:
result = LowerLoadStackArgument(node);
break;
case IrOpcode::kStoreTypedElement:
LowerStoreTypedElement(node);
break;
......@@ -5075,6 +5079,16 @@ Node* EffectControlLinearizer::LowerLoadTypedElement(Node* node) {
data_ptr, index);
}
Node* EffectControlLinearizer::LowerLoadStackArgument(Node* node) {
Node* base = node->InputAt(0);
Node* index = node->InputAt(1);
Node* argument =
__ LoadElement(AccessBuilder::ForStackArgument(), base, index);
return __ BitcastWordToTagged(argument);
}
void EffectControlLinearizer::LowerStoreTypedElement(Node* node) {
ExternalArrayType array_type = ExternalArrayTypeOf(node->op());
Node* buffer = node->InputAt(0);
......
......@@ -326,9 +326,8 @@ void EscapeAnalysisReducer::Finalize() {
TypeCache::Get()->kArgumentsLengthType);
NodeProperties::ReplaceValueInput(load, arguments_frame, 0);
NodeProperties::ReplaceValueInput(load, offset, 1);
NodeProperties::ChangeOp(load,
jsgraph()->simplified()->LoadElement(
AccessBuilder::ForStackArgument()));
NodeProperties::ChangeOp(
load, jsgraph()->simplified()->LoadStackArgument());
break;
}
case IrOpcode::kLoadField: {
......
......@@ -429,6 +429,7 @@
V(LoadTypedElement) \
V(LoadFromObject) \
V(LoadDataViewElement) \
V(LoadStackArgument) \
V(StoreField) \
V(StoreElement) \
V(StoreMessage) \
......
......@@ -2957,6 +2957,11 @@ class RepresentationSelector {
access.machine_type.representation());
return;
}
case IrOpcode::kLoadStackArgument: {
if (truncation.IsUnused()) return VisitUnused(node);
VisitBinop(node, UseInfo::Word(), MachineRepresentation::kTagged);
return;
}
case IrOpcode::kStoreElement: {
ElementAccess access = ElementAccessOf(node->op());
Node* value_node = node->InputAt(2);
......
......@@ -1149,6 +1149,17 @@ struct SimplifiedOperatorGlobalCache final {
};
LoadFieldByIndexOperator kLoadFieldByIndex;
struct LoadStackArgumentOperator final : public Operator {
LoadStackArgumentOperator()
: Operator( // --
IrOpcode::kLoadStackArgument, // opcode
Operator::kNoDeopt | Operator::kNoThrow |
Operator::kNoWrite, // flags
"LoadStackArgument", // name
2, 1, 1, 1, 1, 0) {} // counts
};
LoadStackArgumentOperator kLoadStackArgument;
#define SPECULATIVE_NUMBER_BINOP(Name) \
template <NumberOperationHint kHint> \
struct Name##Operator final : public Operator1<NumberOperationHint> { \
......@@ -1768,6 +1779,10 @@ const Operator* SimplifiedOperatorBuilder::StoreMessage() {
"StoreMessage", 2, 1, 1, 0, 1, 0);
}
const Operator* SimplifiedOperatorBuilder::LoadStackArgument() {
return &cache_.kLoadStackArgument;
}
const Operator* SimplifiedOperatorBuilder::TransitionAndStoreElement(
Handle<Map> double_map, Handle<Map> fast_map) {
TransitionAndStoreElementParameters parameters(double_map, fast_map);
......
......@@ -886,6 +886,9 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
// load-element [base + index]
const Operator* LoadElement(ElementAccess const&);
// load-stack-argument [base + index]
const Operator* LoadStackArgument();
// store-element [base + index], value
const Operator* StoreElement(ElementAccess const&);
......
......@@ -2198,6 +2198,10 @@ Type Typer::Visitor::TypeLoadElement(Node* node) {
return ElementAccessOf(node->op()).type;
}
Type Typer::Visitor::TypeLoadStackArgument(Node* node) {
return Type::NonInternal();
}
Type Typer::Visitor::TypeLoadFromObject(Node* node) { UNREACHABLE(); }
Type Typer::Visitor::TypeLoadTypedElement(Node* node) {
......
......@@ -1601,6 +1601,7 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
// CheckTypeIs(node, FieldAccessOf(node->op()).type));
break;
case IrOpcode::kLoadElement:
case IrOpcode::kLoadStackArgument:
// Object -> elementtype
// TODO(rossberg): activate once machine ops are typed.
// CheckValueInputIs(node, 0, Type::Object());
......
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