[maglev] Use NaN for StoreDataView with no args.

StoreDataView with no args should store NaN, not zero.

Bug: v8:7700
Change-Id: I9688465fea2ac1a88f0bff2a7b7d1c419dc7e43e
Fixed: chromium:1403743
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4127165
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85060}
This commit is contained in:
Leszek Swirski 2023-01-02 15:21:19 +01:00 committed by V8 LUCI CQ
parent 3d921a0afb
commit d43b93a7ac
4 changed files with 10 additions and 4 deletions

View File

@ -3106,7 +3106,9 @@ ValueNode* MaglevGraphBuilder::TryReduceDataViewPrototypeSetFloat64(
compiler::JSFunctionRef target, CallArguments& args) {
return TryBuildStoreDataView<StoreDoubleDataViewElement>(
args, ExternalArrayType::kExternalFloat64Array, [&](ValueNode* value) {
return value ? GetFloat64(value) : GetFloat64Constant(0);
return value ? GetFloat64(value)
: GetFloat64Constant(
std::numeric_limits<double>::quiet_NaN());
});
}

View File

@ -628,7 +628,7 @@ class MaglevGraphBuilder {
}
Float64Constant* GetFloat64Constant(double constant) {
if (constant != constant) {
if (std::isnan(constant)) {
if (graph_->nan() == nullptr) {
graph_->set_nan(CreateNewNode<Float64Constant>(0, constant));
}

View File

@ -90,7 +90,9 @@ class GraphProcessor {
node_processor_.Process(constant, GetCurrentState());
USE(index);
}
if (graph_->nan()) {
node_processor_.Process(graph_->nan(), GetCurrentState());
}
for (const auto& [address, constant] : graph->external_references()) {
node_processor_.Process(constant, GetCurrentState());
USE(address);

View File

@ -333,7 +333,9 @@ void StraightForwardRegisterAllocator::AllocateRegisters() {
constant->SetConstantLocation();
USE(value);
}
if (graph_->nan()) {
graph_->nan()->SetConstantLocation();
}
for (const auto& [address, constant] : graph_->external_references()) {
constant->SetConstantLocation();
USE(address);