v8/test/mjsunit/shared-memory/shared-external-string-megamorphic-ic.js
pthier 3cb7a8146f Reland "[strings] Fix raw hash lookup for forwarded strings"
This is a reland of commit 0a1f0e335e

Changes since revert:
- Deferred label for loading from forwarding table.
- Check if hash is computed instead of checking if it is a forwarding index.
- Retreive hash from forwarding table only if hash is assumed to be computed.

Original change's description:
> [strings] Fix raw hash lookup for forwarded strings
>
> Raw hashes may need to be looked up via the forwarding table when
> internalized strings are forwarded to external resources. Notably, the
> megamorphic ICs were not correctly fetching the raw hash.
>
> Bug: v8:12007
> Change-Id: Ibbc75de57e707788f544fbd1a0f8f0041350e29d
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3885379
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Commit-Queue: Shu-yu Guo <syg@chromium.org>
> Reviewed-by: Patrick Thier <pthier@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#83115}

Bug: v8:12007
Change-Id: Ia88ed51a49c62170bc960b8f69673bb1e59a6009
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3888057
Commit-Queue: Patrick Thier <pthier@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83246}
2022-09-16 08:15:13 +00:00

38 lines
879 B
JavaScript

// Copyright 2022 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: --expose-externalize-string --shared-string-table
// Flags: --allow-natives-syntax
function set(o, ext_key) {
o[ext_key] = "bar";
}
function get(o, ext_key) {
o[ext_key];
}
%PrepareFunctionForOptimization(set);
%OptimizeFunctionOnNextCall(set);
%PrepareFunctionForOptimization(get);
%OptimizeFunctionOnNextCall(get);
(function test() {
let ext_key = "AAAAAAAAAAAAAAAAAAAAAA";
externalizeString(ext_key);
set({a:1}, ext_key);
set({b:2}, ext_key);
set({c:3}, ext_key);
set({d:4}, ext_key);
set({e:5}, ext_key);
set({f:6}, ext_key);
get({a:1}, ext_key);
get({b:2}, ext_key);
get({c:3}, ext_key);
get({d:4}, ext_key);
get({e:5}, ext_key);
get({f:6}, ext_key);
})();