v8/test/mjsunit/shared-memory/shared-struct-property-storage.js
Shu-yu Guo 381b8f55e9 [shared-struct] Fix in/out-of-object property storage
In a few places, shared structs currently incorrectly assume all storage
is in-object. This CL fixes those and rename
CSA::StoreJSSharedStructInObjectField to CSA::StoreSharedObjectField to
reflect the genericity.

Bug: v8:12547
Change-Id: I7c155b6bc584fbdcdbd484fda38f9f8a1940953d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3997700
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84022}
2022-11-02 18:50:49 +00:00

24 lines
605 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: --shared-string-table --harmony-struct
'use strict';
let fieldNames = [];
for (let i = 0; i < 999; i++) {
fieldNames.push('field' + i);
}
let s = new (new SharedStructType(fieldNames));
// Write to an out-of-object field.
(function storeOutOfObject() {
for (let i = 0; i < 100; i++) s.field998 = i;
})();
// Write to an in-object field.
(function storeInObject() {
for (let i = 0; i < 100; i++) s.field0 = i;
})();