Commit 8f68f32f authored by Michael Achenbach's avatar Michael Achenbach Committed by V8 LUCI CQ

Reland "[compiler] Slightly generalize type assertions"

This reverts commit 6eee152b.

Reason for revert: Revert causes more problems and build failures:
https://ci.chromium.org/p/v8/builders/ci/V8%20Linux64%20-%20debug%20builder/52914

Original change's description:
> Revert "[compiler] Slightly generalize type assertions"
>
> This reverts commit ccbfa918.
>
> Reason for revert: Speculative revert for:
> https://ci.chromium.org/p/v8/builders/ci/V8%20NumFuzz%20-%20debug/14050
>
> Original change's description:
> > [compiler] Slightly generalize type assertions
> >
> > ... to also apply to common integer bitset types.
> >
> > Bug: v8:11724
> > Change-Id: I41077488688e924e4235911d3a90e15044c229bd
> > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2865747
> > Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
> > Commit-Queue: Georg Neis <neis@chromium.org>
> > Auto-Submit: Georg Neis <neis@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#74330}
>
> Bug: v8:11724
> Change-Id: I52268d5d553ba271e0a383b6af89b971892a67da
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2868605
> Auto-Submit: Michael Achenbach <machenbach@chromium.org>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Cr-Commit-Position: refs/heads/master@{#74337}

Change-Id: I60eb5930c4c532fe52865b8e198bae8d08dec23b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:11724
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2868606
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74338}
parent 6eee152b
......@@ -27,9 +27,7 @@ Reduction AddTypeAssertionsReducer::Reduce(Node* node) {
visited_.Set(node, true);
Type type = NodeProperties::GetType(node);
if (!type.IsRange()) {
return NoChange();
}
if (!type.CanBeAsserted()) return NoChange();
Node* assertion = graph()->NewNode(simplified()->AssertType(type), node);
NodeProperties::SetType(assertion, type);
......
......@@ -5867,11 +5867,10 @@ Node* EffectControlLinearizer::CallBuiltin(Builtins::Name builtin,
Node* EffectControlLinearizer::LowerAssertType(Node* node) {
DCHECK_EQ(node->opcode(), IrOpcode::kAssertType);
Type type = OpParameter<Type>(node->op());
DCHECK(type.IsRange());
auto range = type.AsRange();
CHECK(type.CanBeAsserted());
Node* const input = node->InputAt(0);
Node* const min = __ NumberConstant(range->Min());
Node* const max = __ NumberConstant(range->Max());
Node* const min = __ NumberConstant(type.Min());
Node* const max = __ NumberConstant(type.Max());
CallBuiltin(Builtins::kCheckNumberInRange, node->op()->properties(), input,
min, max, __ SmiConstant(node->id()));
return input;
......
......@@ -413,6 +413,10 @@ class V8_EXPORT_PRIVATE Type {
(Is(Type::PlainNumber()) && Min() == Max());
}
bool CanBeAsserted() const {
return IsRange() || (Is(Type::Integral32()) && !IsNone());
}
const HeapConstantType* AsHeapConstant() const;
const OtherNumberConstantType* AsOtherNumberConstant() const;
const RangeType* AsRange() const;
......
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