Commit 066d0233 authored by Nico Hartmann's avatar Nico Hartmann Committed by V8 LUCI CQ

Reland "[turbofan] Support additional operators in SLVerifier"

This is a reland of commit dec4bb06

Original change's description:
> [turbofan] Support additional operators in SLVerifier
>
> This CL extends SimplifiedLoweringVerifier by a few additional operators.
>
> It fixes the missing type on a LoadElement node generated during
> js-typed-lowering, that was detected by the verifier.
>
> Bug: v8:12619
> Change-Id: I14e3ece15f6a90e6906c140696dcd2e6b74a2527
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3557510
> Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
> Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#80014}

Bug: v8:12619
Change-Id: If3cb6efe2005c41118f37b39b0209195b3e63a38
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3702330Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Auto-Submit: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81125}
parent 323d3bff
...@@ -1092,6 +1092,16 @@ ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type, ...@@ -1092,6 +1092,16 @@ ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type,
UNREACHABLE(); UNREACHABLE();
} }
// static
ElementAccess AccessBuilder::ForJSForInCacheArrayElement(ForInMode mode) {
ElementAccess access = {
kTaggedBase, FixedArray::kHeaderSize,
(mode == ForInMode::kGeneric ? Type::String()
: Type::InternalizedString()),
MachineType::AnyTagged(), kFullWriteBarrier};
return access;
}
// static // static
FieldAccess AccessBuilder::ForHashTableBaseNumberOfElements() { FieldAccess AccessBuilder::ForHashTableBaseNumberOfElements() {
FieldAccess access = { FieldAccess access = {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define V8_COMPILER_ACCESS_BUILDER_H_ #define V8_COMPILER_ACCESS_BUILDER_H_
#include "src/base/compiler-specific.h" #include "src/base/compiler-specific.h"
#include "src/compiler/js-operator.h"
#include "src/compiler/simplified-operator.h" #include "src/compiler/simplified-operator.h"
#include "src/compiler/write-barrier-kind.h" #include "src/compiler/write-barrier-kind.h"
#include "src/objects/elements-kind.h" #include "src/objects/elements-kind.h"
...@@ -320,6 +321,9 @@ class V8_EXPORT_PRIVATE AccessBuilder final ...@@ -320,6 +321,9 @@ class V8_EXPORT_PRIVATE AccessBuilder final
static ElementAccess ForTypedArrayElement(ExternalArrayType type, static ElementAccess ForTypedArrayElement(ExternalArrayType type,
bool is_external); bool is_external);
// Provides access to the for-in cache array.
static ElementAccess ForJSForInCacheArrayElement(ForInMode mode);
// Provides access to HashTable fields. // Provides access to HashTable fields.
static FieldAccess ForHashTableBaseNumberOfElements(); static FieldAccess ForHashTableBaseNumberOfElements();
static FieldAccess ForHashTableBaseNumberOfDeletedElement(); static FieldAccess ForHashTableBaseNumberOfDeletedElement();
......
...@@ -1873,16 +1873,17 @@ Reduction JSTypedLowering::ReduceJSForInNext(Node* node) { ...@@ -1873,16 +1873,17 @@ Reduction JSTypedLowering::ReduceJSForInNext(Node* node) {
node->ReplaceInput(2, effect); node->ReplaceInput(2, effect);
node->ReplaceInput(3, control); node->ReplaceInput(3, control);
node->TrimInputCount(4); node->TrimInputCount(4);
NodeProperties::ChangeOp( ElementAccess access =
node, AccessBuilder::ForJSForInCacheArrayElement(n.Parameters().mode());
simplified()->LoadElement(AccessBuilder::ForFixedArrayElement())); NodeProperties::ChangeOp(node, simplified()->LoadElement(access));
NodeProperties::SetType(node, Type::InternalizedString()); NodeProperties::SetType(node, access.type);
break; break;
} }
case ForInMode::kGeneric: { case ForInMode::kGeneric: {
// Load the next {key} from the {cache_array}. // Load the next {key} from the {cache_array}.
Node* key = effect = graph()->NewNode( Node* key = effect = graph()->NewNode(
simplified()->LoadElement(AccessBuilder::ForFixedArrayElement()), simplified()->LoadElement(AccessBuilder::ForJSForInCacheArrayElement(
n.Parameters().mode())),
cache_array, index, effect, control); cache_array, index, effect, control);
// Check if the expected map still matches that of the {receiver}. // Check if the expected map still matches that of the {receiver}.
......
...@@ -1317,10 +1317,11 @@ class RepresentationSelector { ...@@ -1317,10 +1317,11 @@ class RepresentationSelector {
return MachineType(rep, MachineSemantic::kInt64); return MachineType(rep, MachineSemantic::kInt64);
} }
MachineType machine_type(rep, DeoptValueSemanticOf(type)); MachineType machine_type(rep, DeoptValueSemanticOf(type));
DCHECK(machine_type.representation() != MachineRepresentation::kWord32 || DCHECK_IMPLIES(
machine_type.representation() == MachineRepresentation::kWord32,
machine_type.semantic() == MachineSemantic::kInt32 || machine_type.semantic() == MachineSemantic::kInt32 ||
machine_type.semantic() == MachineSemantic::kUint32); machine_type.semantic() == MachineSemantic::kUint32);
DCHECK(machine_type.representation() != MachineRepresentation::kBit || DCHECK_IMPLIES(machine_type.representation() == MachineRepresentation::kBit,
type.Is(Type::Boolean())); type.Is(Type::Boolean()));
return machine_type; return machine_type;
} }
......
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