summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/regress/regress-1422166.js
blob: e624322641f6d82e7d9e40cf1ea2b563da79bb92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2023 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 buf = new SharedArrayBuffer(8, { "maxByteLength": 8 });

class obj extends Uint8ClampedArray {
  constructor() {
    super(buf);
  }
  defineProperty() {
    for (let i = 0; i < 3; i++) {
      super.length;
    }
    SharedArrayBuffer.__proto__ = this;
  }
}

function opt() {
  new obj().defineProperty();
}

%PrepareFunctionForOptimization(opt);
opt();
opt();
opt();
opt();
%OptimizeFunctionOnNextCall(opt)
opt();