blob: dada3f47bd2656d7fdc797e5f228a4455de5f96f [file] [log] [blame]
Kaido Kertf309f9a2021-04-30 12:09:15 -07001// Copyright 2019 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --allow-natives-syntax
6
7function checkOwnProperties(v, count) {
8 var properties = Object.getOwnPropertyNames(v);
9 assertEquals(properties.length, count);
10}
11
12
13function testStoreNoFeedback() {
14 arr = new Int32Array(10);
15 function f(a) { a["-1"] = 15; }
16
17 for (var i = 0; i < 3; i++) {
18 arr.__defineGetter__("x", function() { });
19 checkOwnProperties(arr, 11);
20 f(arr);
21 }
22}
23testStoreNoFeedback();
24
25function testStoreGeneric() {
26 arr = new Int32Array(10);
27 var index = "-1";
28 function f1(a) { a[index] = 15; }
29 %EnsureFeedbackVectorForFunction(f1);
30
31 // Make a[index] in f1 megamorphic
32 f1({a: 1});
33 f1({b: 1});
34 f1({c: 1});
35 f1({d: 1});
36
37 for (var i = 0; i < 3; i++) {
38 arr.__defineGetter__("x", function() { });
39 checkOwnProperties(arr, 11);
40 f1(arr);
41 }
42}
43testStoreGeneric();