diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/jit-test/tests/profiler/AutoEntryMonitor-01.js | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/profiler/AutoEntryMonitor-01.js')
-rw-r--r-- | js/src/jit-test/tests/profiler/AutoEntryMonitor-01.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/profiler/AutoEntryMonitor-01.js b/js/src/jit-test/tests/profiler/AutoEntryMonitor-01.js new file mode 100644 index 0000000000..c64a121b66 --- /dev/null +++ b/js/src/jit-test/tests/profiler/AutoEntryMonitor-01.js @@ -0,0 +1,50 @@ +// AutoEntryMonitor should catch all entry points into JavaScript. + +load(libdir + 'array-compare.js'); + +function cold_and_warm(f, params, expected) { + print(JSON.stringify(params)); + print(JSON.stringify(entryPoints(params))); + assertEq(arraysEqual(entryPoints(params), expected), true); + + // Warm up the function a bit, so the JITs will compile it, and try again. + if (f) + for (i = 0; i < 10; i++) + f(); + + assertEq(arraysEqual(entryPoints(params), expected), true); +} + +function entry1() { } +cold_and_warm(entry1, { function: entry1 }, [ "entry1" ]); + +var getx = { get x() { } }; +cold_and_warm(Object.getOwnPropertyDescriptor(getx, 'x').get, + { object: getx, property: 'x' }, [ "get x" ]); + +var sety = { set y(v) { } }; +cold_and_warm(Object.getOwnPropertyDescriptor(sety, 'y').set, + { object: sety, property: 'y', value: 'glerk' }, [ "set y" ]); + +cold_and_warm(Object.prototype.toString, { ToString: {} }, []); + +var toS = { toString: function myToString() { return "string"; } }; +cold_and_warm(toS.toString, { ToString: toS }, [ "myToString" ]); + +cold_and_warm(undefined, { ToNumber: 5 }, []); + +var vOf = { valueOf: function myValueOf() { return 42; } }; +cold_and_warm(vOf.valueOf, { ToNumber: vOf }, [ "myValueOf" ]); + +var toSvOf = { toString: function relations() { return Object; }, + valueOf: function wallpaper() { return 17; } }; +cold_and_warm(() => { toSvOf.toString(); toSvOf.valueOf(); }, + { ToString: toSvOf }, [ "relations", "wallpaper" ]); + +var vOftoS = { toString: function ettes() { return "6-inch lengths"; }, + valueOf: function deathBy() { return Math; } }; +cold_and_warm(() => { vOftoS.valueOf(); vOftoS.toString(); }, + { ToNumber: vOftoS }, [ "deathBy", "ettes" ]); + + +cold_and_warm(() => 0, { eval: "Math.atan2(1,1);" }, [ "eval:entryPoint eval" ]); |