Commit f0d94ede authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[turbofan] Introduce LoadMessage/StoreMessage simplified operators

These allow to write a tagged uncompressed pointer even if pointer
compression is enabled. This is the least intrusive option; once
TurboFan supports pointer compression better, this CL likely
needs to be revised.

Bug: v8:8183
Change-Id: I56451c364b8620f687d8b9deb9553099ba95b928
Reviewed-on: https://chromium-review.googlesource.com/c/1445978
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59247}
parent 83c1a36a
......@@ -22,10 +22,9 @@ namespace internal {
namespace compiler {
// static
FieldAccess AccessBuilder::ForExternalTaggedValue() {
FieldAccess access = {kUntaggedBase, 0,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::Any(), MachineType::AnyTagged(),
FieldAccess AccessBuilder::ForExternalIntPtr() {
FieldAccess access = {kUntaggedBase, 0, MaybeHandle<Name>(),
MaybeHandle<Map>(), Type::Any(), MachineType::IntPtr(),
kNoWriteBarrier};
return access;
}
......
......@@ -24,8 +24,8 @@ class V8_EXPORT_PRIVATE AccessBuilder final
// ===========================================================================
// Access to external values (based on external references).
// Provides access to a tagged field identified by an external reference.
static FieldAccess ForExternalTaggedValue();
// Provides access to an intptr field identified by an external reference.
static FieldAccess ForExternalIntPtr();
// Provides access to an uint8 field identified by an external reference.
static FieldAccess ForExternalUint8Value();
......
......@@ -963,6 +963,12 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kTransitionElementsKind:
LowerTransitionElementsKind(node);
break;
case IrOpcode::kLoadMessage:
result = LowerLoadMessage(node);
break;
case IrOpcode::kStoreMessage:
LowerStoreMessage(node);
break;
case IrOpcode::kLoadFieldByIndex:
result = LowerLoadFieldByIndex(node);
break;
......@@ -4103,6 +4109,20 @@ void EffectControlLinearizer::LowerTransitionElementsKind(Node* node) {
__ Bind(&done);
}
Node* EffectControlLinearizer::LowerLoadMessage(Node* node) {
Node* offset = node->InputAt(0);
Node* object_pattern =
__ LoadField(AccessBuilder::ForExternalIntPtr(), offset);
return __ BitcastWordToTagged(object_pattern);
}
void EffectControlLinearizer::LowerStoreMessage(Node* node) {
Node* offset = node->InputAt(0);
Node* object = node->InputAt(1);
Node* object_pattern = __ BitcastTaggedToWord(object);
__ StoreField(AccessBuilder::ForExternalIntPtr(), offset, object_pattern);
}
Node* EffectControlLinearizer::LowerLoadFieldByIndex(Node* node) {
Node* object = node->InputAt(0);
Node* index = node->InputAt(1);
......
......@@ -163,8 +163,10 @@ class V8_EXPORT_PRIVATE EffectControlLinearizer {
Node* LowerMaybeGrowFastElements(Node* node, Node* frame_state);
void LowerTransitionElementsKind(Node* node);
Node* LowerLoadFieldByIndex(Node* node);
Node* LowerLoadMessage(Node* node);
Node* LowerLoadTypedElement(Node* node);
Node* LowerLoadDataViewElement(Node* node);
void LowerStoreMessage(Node* node);
void LowerStoreTypedElement(Node* node);
void LowerStoreDataViewElement(Node* node);
void LowerStoreSignedSmallElement(Node* node);
......
......@@ -1986,8 +1986,7 @@ Reduction JSTypedLowering::ReduceJSLoadMessage(Node* node) {
ExternalReference const ref =
ExternalReference::address_of_pending_message_obj(isolate());
node->ReplaceInput(0, jsgraph()->ExternalConstant(ref));
NodeProperties::ChangeOp(
node, simplified()->LoadField(AccessBuilder::ForExternalTaggedValue()));
NodeProperties::ChangeOp(node, simplified()->LoadMessage());
return Changed(node);
}
......@@ -1998,8 +1997,7 @@ Reduction JSTypedLowering::ReduceJSStoreMessage(Node* node) {
Node* value = NodeProperties::GetValueInput(node, 0);
node->ReplaceInput(0, jsgraph()->ExternalConstant(ref));
node->ReplaceInput(1, value);
NodeProperties::ChangeOp(
node, simplified()->StoreField(AccessBuilder::ForExternalTaggedValue()));
NodeProperties::ChangeOp(node, simplified()->StoreMessage());
return Changed(node);
}
......
......@@ -402,10 +402,12 @@
V(LoadFieldByIndex) \
V(LoadField) \
V(LoadElement) \
V(LoadMessage) \
V(LoadTypedElement) \
V(LoadDataViewElement) \
V(StoreField) \
V(StoreElement) \
V(StoreMessage) \
V(StoreTypedElement) \
V(StoreDataViewElement) \
V(StoreSignedSmallElement) \
......
......@@ -2727,6 +2727,18 @@ class RepresentationSelector {
SetOutput(node, MachineRepresentation::kTaggedPointer);
return;
}
case IrOpcode::kLoadMessage: {
if (truncation.IsUnused()) return VisitUnused(node);
VisitUnop(node, UseInfo::Word(), MachineRepresentation::kTagged);
return;
}
case IrOpcode::kStoreMessage: {
ProcessInput(node, 0, UseInfo::Word());
ProcessInput(node, 1, UseInfo::AnyTagged());
ProcessRemainingInputs(node, 2);
SetOutput(node, MachineRepresentation::kNone);
return;
}
case IrOpcode::kLoadFieldByIndex: {
if (truncation.IsUnused()) return VisitUnused(node);
VisitBinop(node, UseInfo::AnyTagged(), UseInfo::TruncatingWord32(),
......
......@@ -1647,6 +1647,20 @@ SPECULATIVE_NUMBER_BINOP_LIST(SPECULATIVE_NUMBER_BINOP)
ACCESS_OP_LIST(ACCESS)
#undef ACCESS
const Operator* SimplifiedOperatorBuilder::LoadMessage() {
return new (zone())
Operator(IrOpcode::kLoadMessage,
Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite,
"LoadMessage", 1, 1, 1, 1, 1, 0);
}
const Operator* SimplifiedOperatorBuilder::StoreMessage() {
return new (zone())
Operator(IrOpcode::kStoreMessage,
Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoRead,
"StoreMessage", 2, 1, 1, 0, 1, 0);
}
const Operator* SimplifiedOperatorBuilder::TransitionAndStoreElement(
Handle<Map> double_map, Handle<Map> fast_map) {
TransitionAndStoreElementParameters parameters(double_map, fast_map);
......
......@@ -775,6 +775,9 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final
const Operator* LoadField(FieldAccess const&);
const Operator* StoreField(FieldAccess const&);
const Operator* LoadMessage();
const Operator* StoreMessage();
// load-element [base + index]
const Operator* LoadElement(ElementAccess const&);
......
......@@ -2131,6 +2131,8 @@ Type Typer::Visitor::TypeLoadField(Node* node) {
return FieldAccessOf(node->op()).type;
}
Type Typer::Visitor::TypeLoadMessage(Node* node) { return Type::Any(); }
Type Typer::Visitor::TypeLoadElement(Node* node) {
return ElementAccessOf(node->op()).type;
}
......@@ -2158,6 +2160,7 @@ Type Typer::Visitor::TypeLoadDataViewElement(Node* node) {
}
Type Typer::Visitor::TypeStoreField(Node* node) { UNREACHABLE(); }
Type Typer::Visitor::TypeStoreMessage(Node* node) { UNREACHABLE(); }
Type Typer::Visitor::TypeStoreElement(Node* node) { UNREACHABLE(); }
......
......@@ -1541,6 +1541,7 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
CheckTypeIs(node, Type::NonInternal());
break;
case IrOpcode::kLoadField:
case IrOpcode::kLoadMessage:
// Object -> fieldtype
// TODO(rossberg): activate once machine ops are typed.
// CheckValueInputIs(node, 0, Type::Object());
......@@ -1557,6 +1558,7 @@ void Verifier::Visitor::Check(Node* node, const AllNodes& all) {
case IrOpcode::kLoadDataViewElement:
break;
case IrOpcode::kStoreField:
case IrOpcode::kStoreMessage:
// (Object, fieldtype) -> _|_
// 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