Reland "[ptr-compr][turbofan] Adding the final compressed access builders"
This is a reland of cb3caa1ea3
Original change's description:
> [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: Jaroslav Sevcik <jarin@chromium.org>
> Reviewed-by: Michael Stanton <mvstanton@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#61272}
Bug: v8:8977, v8:7703
Change-Id: I6bdaad7e6c628dfa6d5a41581fd0ee4ef9d36260
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
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1599168
Reviewed-by: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61287}
This commit is contained in:
parent
50cda32248
commit
f08d526e7b
@ -43,13 +43,12 @@ FieldAccess AccessBuilder::ForExternalUint8Value() {
|
||||
}
|
||||
|
||||
// static
|
||||
// TODO(v8:8977, v8:7703): Change MachineType::TaggedPointer to
|
||||
// MachineType::TypeCompressedTaggedPointer
|
||||
FieldAccess AccessBuilder::ForMap() {
|
||||
FieldAccess access = {kTaggedBase, HeapObject::kMapOffset,
|
||||
MaybeHandle<Name>(), MaybeHandle<Map>(),
|
||||
Type::OtherInternal(), MachineType::TaggedPointer(),
|
||||
kMapWriteBarrier};
|
||||
FieldAccess access = {
|
||||
kTaggedBase, HeapObject::kMapOffset,
|
||||
MaybeHandle<Name>(), MaybeHandle<Map>(),
|
||||
Type::OtherInternal(), MachineType::TypeCompressedTaggedPointer(),
|
||||
kMapWriteBarrier};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -84,24 +83,22 @@ FieldAccess AccessBuilder::ForBigIntBitfield() {
|
||||
}
|
||||
|
||||
// static
|
||||
// TODO(v8:8977, v8:7703): Change MachineType::AnyTagged to
|
||||
// MachineType::TypeCompressedTagged
|
||||
FieldAccess AccessBuilder::ForJSObjectPropertiesOrHash() {
|
||||
FieldAccess access = {kTaggedBase, JSObject::kPropertiesOrHashOffset,
|
||||
MaybeHandle<Name>(), MaybeHandle<Map>(),
|
||||
Type::Any(), MachineType::AnyTagged(),
|
||||
kPointerWriteBarrier, LoadSensitivity::kCritical};
|
||||
FieldAccess access = {
|
||||
kTaggedBase, JSObject::kPropertiesOrHashOffset,
|
||||
MaybeHandle<Name>(), MaybeHandle<Map>(),
|
||||
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,
|
||||
MaybeHandle<Name>(), MaybeHandle<Map>(),
|
||||
Type::Internal(), MachineType::TaggedPointer(),
|
||||
kPointerWriteBarrier, LoadSensitivity::kCritical};
|
||||
FieldAccess access = {
|
||||
kTaggedBase, JSObject::kElementsOffset,
|
||||
MaybeHandle<Name>(), MaybeHandle<Map>(),
|
||||
Type::Internal(), MachineType::TypeCompressedTaggedPointer(),
|
||||
kPointerWriteBarrier, LoadSensitivity::kCritical};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -670,13 +667,12 @@ FieldAccess AccessBuilder::ForStringLength() {
|
||||
}
|
||||
|
||||
// static
|
||||
// TODO(v8:8977, v8:7703): Change MachineType::TaggedPointer to
|
||||
// MachineType::TypeCompressedTaggedPointer
|
||||
FieldAccess AccessBuilder::ForConsStringFirst() {
|
||||
FieldAccess access = {kTaggedBase, ConsString::kFirstOffset,
|
||||
Handle<Name>(), MaybeHandle<Map>(),
|
||||
Type::String(), MachineType::TaggedPointer(),
|
||||
kPointerWriteBarrier};
|
||||
FieldAccess access = {
|
||||
kTaggedBase, ConsString::kFirstOffset,
|
||||
Handle<Name>(), MaybeHandle<Map>(),
|
||||
Type::String(), MachineType::TypeCompressedTaggedPointer(),
|
||||
kPointerWriteBarrier};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -691,13 +687,12 @@ FieldAccess AccessBuilder::ForConsStringSecond() {
|
||||
}
|
||||
|
||||
// static
|
||||
// TODO(v8:8977, v8:7703): Change MachineType::TaggedPointer to
|
||||
// MachineType::TypeCompressedTaggedPointer
|
||||
FieldAccess AccessBuilder::ForThinStringActual() {
|
||||
FieldAccess access = {kTaggedBase, ThinString::kActualOffset,
|
||||
Handle<Name>(), MaybeHandle<Map>(),
|
||||
Type::String(), MachineType::TaggedPointer(),
|
||||
kPointerWriteBarrier};
|
||||
FieldAccess access = {
|
||||
kTaggedBase, ThinString::kActualOffset,
|
||||
Handle<Name>(), MaybeHandle<Map>(),
|
||||
Type::String(), MachineType::TypeCompressedTaggedPointer(),
|
||||
kPointerWriteBarrier};
|
||||
return access;
|
||||
}
|
||||
|
||||
@ -712,13 +707,12 @@ FieldAccess AccessBuilder::ForSlicedStringOffset() {
|
||||
}
|
||||
|
||||
// static
|
||||
// TODO(v8:8977, v8:7703): Change MachineType::TaggedPointer to
|
||||
// MachineType::TypeCompressedTaggedPointer
|
||||
FieldAccess AccessBuilder::ForSlicedStringParent() {
|
||||
FieldAccess access = {kTaggedBase, SlicedString::kParentOffset,
|
||||
Handle<Name>(), MaybeHandle<Map>(),
|
||||
Type::String(), MachineType::TaggedPointer(),
|
||||
kPointerWriteBarrier};
|
||||
FieldAccess access = {
|
||||
kTaggedBase, SlicedString::kParentOffset,
|
||||
Handle<Name>(), MaybeHandle<Map>(),
|
||||
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_ =
|
||||
graph()->NewNode(simplified()->LoadElement(access), object, index,
|
||||
current_effect_, current_control_);
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user