blob: e4cef06120d7d2f3950cfa3d0866afa84f388567 (
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
32
33
34
35
36
37
38
39
40
41
42
|
// 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: --harmony-struct --allow-natives-syntax
function Foo() {}
function TestInstanceOfMutex() {
Foo instanceof Atomics.Mutex;
}
function TestInstanceOfCondition() {
Foo instanceof Atomics.Condition;
}
function TestInstanceOfSharedArray() {
Foo instanceof SharedArray;
}
function TestInstanceOfSharedStruct() {
Foo instanceof (new SharedStructType(["foo"]));
}
%PrepareFunctionForOptimization(TestInstanceOfMutex);
%PrepareFunctionForOptimization(TestInstanceOfCondition);
%PrepareFunctionForOptimization(TestInstanceOfSharedArray);
%PrepareFunctionForOptimization(TestInstanceOfSharedStruct);
for (let i = 0; i < 10; i++) {
assertThrows(TestInstanceOfMutex, TypeError);
assertThrows(TestInstanceOfCondition, TypeError);
assertThrows(TestInstanceOfSharedArray, TypeError);
assertThrows(TestInstanceOfSharedStruct, TypeError);
}
%OptimizeFunctionOnNextCall(TestInstanceOfMutex);
%OptimizeFunctionOnNextCall(TestInstanceOfCondition);
%OptimizeFunctionOnNextCall(TestInstanceOfSharedArray);
%OptimizeFunctionOnNextCall(TestInstanceOfSharedStruct);
assertThrows(TestInstanceOfMutex, TypeError);
assertThrows(TestInstanceOfCondition, TypeError);
assertThrows(TestInstanceOfSharedArray, TypeError);
assertThrows(TestInstanceOfSharedStruct, TypeError);
|