Commit bdf42929 authored by Shu-yu Guo's avatar Shu-yu Guo Committed by Commit Bot

Revert "[strings] Fix hash for exactly 512MB long strings"

This reverts commit 556f44c4.

Reason for revert: Test fatally OOMs on ARM. https://ci.chromium.org/p/v8/builders/ci/V8%20Arm/12336

Original change's description:
> [strings] Fix hash for exactly 512MB long strings
> 
> Bug: chromium:1016237
> Change-Id: Idda1e44b5d578d1213aa54927ca68289bcdce8ac
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1878487
> Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
> Reviewed-by: Igor Sheludko <ishell@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#64552}

TBR=jkummerow@chromium.org,ishell@chromium.org

Change-Id: Ia942469346b0f11fcf853d21717fd127815f7fba
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1016237
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1879669Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64553}
parent 556f44c4
......@@ -33,18 +33,9 @@ uint32_t StringHasher::GetHashCore(uint32_t running_hash) {
uint32_t StringHasher::GetTrivialHash(int length) {
DCHECK_GT(length, String::kMaxHashCalcLength);
// The hash of a large string is simply computed from the length. We don't
// have quite enough bits, so we drop the least significant bit.
// TODO(9904): Free up one bit, so we don't have to drop anything here.
constexpr int kDroppedBits = 1;
// Ensure that the max length after dropping bits is small enough to be
// shifted without losing information.
STATIC_ASSERT(base::bits::CountLeadingZeros32(String::kMaxLength) +
kDroppedBits >=
String::kHashShift);
uint32_t hash = static_cast<uint32_t>(length) >> kDroppedBits;
return (hash << String::kHashShift) | String::kIsNotArrayIndexMask |
String::kIsNotIntegerIndexMask;
// String hash of a large string is simply the length.
return (static_cast<uint32_t>(length) << String::kHashShift) |
String::kIsNotArrayIndexMask | String::kIsNotIntegerIndexMask;
}
template <typename schar>
......
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
const kLength = Math.min(536870912, %StringMaxLength());
const v2 = "foo".padEnd(kLength);
delete v2[v2];
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