[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: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63952}
This commit is contained in:
Santiago Aboy Solanes 2019-09-24 16:58:36 +01:00 committed by Commit Bot
parent 7caea48816
commit 54301b0090
9 changed files with 46 additions and 4 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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: {

View File

@ -429,6 +429,7 @@
V(LoadTypedElement) \
V(LoadFromObject) \
V(LoadDataViewElement) \
V(LoadStackArgument) \
V(StoreField) \
V(StoreElement) \
V(StoreMessage) \

View File

@ -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);

View File

@ -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);

View File

@ -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&);

View File

@ -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) {

View File

@ -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());