Commit cb3caa1e authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[ptr-compr][turbofan] Adding the final compressed access builders

This CL is the final one for the access-builder.cc's changes. There are
still Tagged loads and stores (e.g in wasm) which will be tackled on
following CLs.

Cq-Include-Trybots: luci.v8.try:v8_linux64_pointer_compression_rel_ng
Cq-Include-Trybots: luci.v8.try:v8_linux64_arm64_pointer_compression_rel_ng
Bug: v8:8977, v8:7703
Change-Id: I2667eaacbada0846fe5f128bb17a1a305862c64d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1590077
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61272}
parent 758700a7
......@@ -43,12 +43,11 @@ FieldAccess AccessBuilder::ForExternalUint8Value() {
}
// static
// TODO(v8:8977, v8:7703): Change MachineType::TaggedPointer to
// MachineType::TypeCompressedTaggedPointer
FieldAccess AccessBuilder::ForMap() {
FieldAccess access = {kTaggedBase, HeapObject::kMapOffset,
FieldAccess access = {
kTaggedBase, HeapObject::kMapOffset,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::OtherInternal(), MachineType::TaggedPointer(),
Type::OtherInternal(), MachineType::TypeCompressedTaggedPointer(),
kMapWriteBarrier};
return access;
}
......@@ -84,23 +83,21 @@ FieldAccess AccessBuilder::ForBigIntBitfield() {
}
// static
// TODO(v8:8977, v8:7703): Change MachineType::AnyTagged to
// MachineType::TypeCompressedTagged
FieldAccess AccessBuilder::ForJSObjectPropertiesOrHash() {
FieldAccess access = {kTaggedBase, JSObject::kPropertiesOrHashOffset,
FieldAccess access = {
kTaggedBase, JSObject::kPropertiesOrHashOffset,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::Any(), MachineType::AnyTagged(),
Type::Any(), MachineType::TypeCompressedTagged(),
kPointerWriteBarrier, LoadSensitivity::kCritical};
return access;
}
// static
// TODO(v8:8977, v8:7703): Change MachineType::TaggedPointer to
// MachineType::TypeCompressedTaggedPointer
FieldAccess AccessBuilder::ForJSObjectElements() {
FieldAccess access = {kTaggedBase, JSObject::kElementsOffset,
FieldAccess access = {
kTaggedBase, JSObject::kElementsOffset,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::Internal(), MachineType::TaggedPointer(),
Type::Internal(), MachineType::TypeCompressedTaggedPointer(),
kPointerWriteBarrier, LoadSensitivity::kCritical};
return access;
}
......@@ -670,12 +667,11 @@ FieldAccess AccessBuilder::ForStringLength() {
}
// static
// TODO(v8:8977, v8:7703): Change MachineType::TaggedPointer to
// MachineType::TypeCompressedTaggedPointer
FieldAccess AccessBuilder::ForConsStringFirst() {
FieldAccess access = {kTaggedBase, ConsString::kFirstOffset,
FieldAccess access = {
kTaggedBase, ConsString::kFirstOffset,
Handle<Name>(), MaybeHandle<Map>(),
Type::String(), MachineType::TaggedPointer(),
Type::String(), MachineType::TypeCompressedTaggedPointer(),
kPointerWriteBarrier};
return access;
}
......@@ -691,12 +687,11 @@ FieldAccess AccessBuilder::ForConsStringSecond() {
}
// static
// TODO(v8:8977, v8:7703): Change MachineType::TaggedPointer to
// MachineType::TypeCompressedTaggedPointer
FieldAccess AccessBuilder::ForThinStringActual() {
FieldAccess access = {kTaggedBase, ThinString::kActualOffset,
FieldAccess access = {
kTaggedBase, ThinString::kActualOffset,
Handle<Name>(), MaybeHandle<Map>(),
Type::String(), MachineType::TaggedPointer(),
Type::String(), MachineType::TypeCompressedTaggedPointer(),
kPointerWriteBarrier};
return access;
}
......@@ -712,12 +707,11 @@ FieldAccess AccessBuilder::ForSlicedStringOffset() {
}
// static
// TODO(v8:8977, v8:7703): Change MachineType::TaggedPointer to
// MachineType::TypeCompressedTaggedPointer
FieldAccess AccessBuilder::ForSlicedStringParent() {
FieldAccess access = {kTaggedBase, SlicedString::kParentOffset,
FieldAccess access = {
kTaggedBase, SlicedString::kParentOffset,
Handle<Name>(), MaybeHandle<Map>(),
Type::String(), MachineType::TaggedPointer(),
Type::String(), MachineType::TypeCompressedTaggedPointer(),
kPointerWriteBarrier};
return access;
}
......@@ -785,13 +779,11 @@ FieldAccess AccessBuilder::ForJSGlobalObjectNativeContext() {
}
// static
// TODO(v8:8977, v8:7703): Change MachineType::TaggedPointer to
// MachineType::TypeCompressedTaggedPointer
FieldAccess AccessBuilder::ForJSGlobalProxyNativeContext() {
FieldAccess access = {
kTaggedBase, JSGlobalProxy::kNativeContextOffset,
Handle<Name>(), MaybeHandle<Map>(),
Type::Internal(), MachineType::TaggedPointer(),
Type::Internal(), MachineType::TypeCompressedTaggedPointer(),
kPointerWriteBarrier};
return access;
}
......@@ -921,11 +913,10 @@ FieldAccess AccessBuilder::ForContextSlot(size_t index) {
}
// static
// TODO(v8:8977, v8:7703): Change MachineType::AnyTagged to
// MachineType::TypeCompressedTagged
ElementAccess AccessBuilder::ForFixedArrayElement() {
ElementAccess access = {kTaggedBase, FixedArray::kHeaderSize, Type::Any(),
MachineType::AnyTagged(), kFullWriteBarrier};
MachineType::TypeCompressedTagged(),
kFullWriteBarrier};
return access;
}
......
......@@ -112,20 +112,26 @@ Node* GraphAssembler::Allocate(AllocationType allocation, Node* size) {
}
Node* GraphAssembler::LoadField(FieldAccess const& access, Node* object) {
return current_effect_ =
graph()->NewNode(simplified()->LoadField(access), object,
current_effect_, current_control_);
Node* value = current_effect_ =
graph()->NewNode(simplified()->LoadField(access), object, current_effect_,
current_control_);
return InsertDecompressionIfNeeded(access.machine_type.representation(),
value);
}
Node* GraphAssembler::LoadElement(ElementAccess const& access, Node* object,
Node* index) {
return current_effect_ =
Node* value = current_effect_ =
graph()->NewNode(simplified()->LoadElement(access), object, index,
current_effect_, current_control_);
return InsertDecompressionIfNeeded(access.machine_type.representation(),
value);
}
Node* GraphAssembler::StoreField(FieldAccess const& access, Node* object,
Node* value) {
value =
InsertCompressionIfNeeded(access.machine_type.representation(), value);
return current_effect_ =
graph()->NewNode(simplified()->StoreField(access), object, value,
current_effect_, current_control_);
......@@ -133,6 +139,8 @@ Node* GraphAssembler::StoreField(FieldAccess const& access, Node* object,
Node* GraphAssembler::StoreElement(ElementAccess const& access, Node* object,
Node* index, Node* value) {
value =
InsertCompressionIfNeeded(access.machine_type.representation(), value);
return current_effect_ =
graph()->NewNode(simplified()->StoreElement(access), object, index,
value, current_effect_, current_control_);
......@@ -274,6 +282,50 @@ Node* GraphAssembler::ExtractCurrentEffect() {
return result;
}
Node* GraphAssembler::InsertDecompressionIfNeeded(MachineRepresentation rep,
Node* value) {
if (COMPRESS_POINTERS_BOOL) {
switch (rep) {
case MachineRepresentation::kCompressedPointer:
value = graph()->NewNode(
machine()->ChangeCompressedPointerToTaggedPointer(), value);
break;
case MachineRepresentation::kCompressedSigned:
value = graph()->NewNode(
machine()->ChangeCompressedSignedToTaggedSigned(), value);
break;
case MachineRepresentation::kCompressed:
value = graph()->NewNode(machine()->ChangeCompressedToTagged(), value);
break;
default:
break;
}
}
return value;
}
Node* GraphAssembler::InsertCompressionIfNeeded(MachineRepresentation rep,
Node* value) {
if (COMPRESS_POINTERS_BOOL) {
switch (rep) {
case MachineRepresentation::kCompressedPointer:
value = graph()->NewNode(
machine()->ChangeTaggedPointerToCompressedPointer(), value);
break;
case MachineRepresentation::kCompressedSigned:
value = graph()->NewNode(
machine()->ChangeTaggedSignedToCompressedSigned(), value);
break;
case MachineRepresentation::kCompressed:
value = graph()->NewNode(machine()->ChangeTaggedToCompressed(), value);
break;
default:
break;
}
}
return value;
}
void GraphAssembler::Reset(Node* effect, Node* control) {
current_effect_ = effect;
current_control_ = control;
......
......@@ -284,6 +284,12 @@ class GraphAssembler {
Node* ExtractCurrentEffect();
private:
// Adds a decompression node if pointer compression is enabled and the
// representation loaded is a compressed one. To be used after loads.
Node* InsertDecompressionIfNeeded(MachineRepresentation rep, Node* value);
// Adds a compression node if pointer compression is enabled and the
// representation to be stored is a compressed one. To be used before stores.
Node* InsertCompressionIfNeeded(MachineRepresentation rep, Node* value);
template <typename... Vars>
void MergeState(GraphAssemblerLabel<sizeof...(Vars)>* label, Vars... vars);
......
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