From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../tests/debug/Object-isSameNativeWithJitInfo.js | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 js/src/jit-test/tests/debug/Object-isSameNativeWithJitInfo.js (limited to 'js/src/jit-test/tests/debug/Object-isSameNativeWithJitInfo.js') diff --git a/js/src/jit-test/tests/debug/Object-isSameNativeWithJitInfo.js b/js/src/jit-test/tests/debug/Object-isSameNativeWithJitInfo.js new file mode 100644 index 0000000000..648847ae49 --- /dev/null +++ b/js/src/jit-test/tests/debug/Object-isSameNativeWithJitInfo.js @@ -0,0 +1,32 @@ +var g = newGlobal({newCompartment: true}); +var dbg = Debugger(g); +var gdbg = dbg.addDebuggee(g); + +assertEq(gdbg.getProperty("print").return.isSameNativeWithJitInfo(print), true); +assertEq(gdbg.getProperty("print").return.isSameNativeWithJitInfo(newGlobal), false); + +// FakeDOMObject's accessor shares the single native functions, with +// different JSJitInfo for each. + +gdbg.executeInGlobal(` +var fun1 = Object.getOwnPropertyDescriptor(FakeDOMObject.prototype, "x").get; +var fun2 = Object.getOwnPropertyDescriptor(FakeDOMObject.prototype, "slot").get; +`); + +var g_fun1 = gdbg.executeInGlobal("fun1").return; +var g_fun2 = gdbg.executeInGlobal("fun2").return; + +var fun1 = Object.getOwnPropertyDescriptor(FakeDOMObject.prototype, "x").get; +var fun2 = Object.getOwnPropertyDescriptor(FakeDOMObject.prototype, "slot").get; + +// isSameNative doesn't distinguish between fun1 and fun2. +assertEq(g_fun1.isSameNative(fun1), true); +assertEq(g_fun1.isSameNative(fun2), true); +assertEq(g_fun2.isSameNative(fun1), true); +assertEq(g_fun2.isSameNative(fun2), true); + +// isSameNativeWithJitInfo can distinguish between fun1 and fun2. +assertEq(g_fun1.isSameNativeWithJitInfo(fun1), true); +assertEq(g_fun1.isSameNativeWithJitInfo(fun2), false); +assertEq(g_fun2.isSameNativeWithJitInfo(fun1), false); +assertEq(g_fun2.isSameNativeWithJitInfo(fun2), true); -- cgit v1.2.3