diff options
Diffstat (limited to 'deps/v8/test/mjsunit/shared-memory/non-instance-prototype.js')
-rw-r--r-- | deps/v8/test/mjsunit/shared-memory/non-instance-prototype.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/shared-memory/non-instance-prototype.js b/deps/v8/test/mjsunit/shared-memory/non-instance-prototype.js new file mode 100644 index 0000000000..e4cef06120 --- /dev/null +++ b/deps/v8/test/mjsunit/shared-memory/non-instance-prototype.js @@ -0,0 +1,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); |