diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/jit-test/manual-tests | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/manual-tests')
3 files changed, 179 insertions, 0 deletions
diff --git a/js/src/jit-test/manual-tests/TypedObject-TypeDescrIsArrayType-unknown.js b/js/src/jit-test/manual-tests/TypedObject-TypeDescrIsArrayType-unknown.js new file mode 100644 index 000000000..17de9af69 --- /dev/null +++ b/js/src/jit-test/manual-tests/TypedObject-TypeDescrIsArrayType-unknown.js @@ -0,0 +1,77 @@ +/* -*- tab-width: 8; indent-tabs-mode: nil; js-indent-level: 2 -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Susceptible to timeouts on some systems, see bug 1203595, if run + * with --ion-eager --ion-offthread-compile=off. + * + * Probably only meaningful to run this with default flags. + */ + +/* This test is intended to test Ion code generation for the internal + * primitive TypeDescrIsArrayType(), available to self-hosted code. + * + * This test differs from the one in TypedObject-TypeDescrIsArrayType.js + * in that it tries to hide type information from the JIT. Sadly, + * it turns out to be hard to write a test that causes a run-time test + * to be inserted at the right spot. This is my best effort, + * but the test was still specialized as "true" in the generated code + * last I looked. + * + * To do that, it must trigger enough uses of that primitive as well + * as enough uses of a caller of the primitive to trigger inlining of + * the primitive into its compiled caller. + * + * It turns out that TypeDescrIsArrayType() is used early in the map() + * method on TypedObject arrays, so code that heavily uses the latter + * method will usually be good enough. + * + * In practice this test just asserts that map() works, and thus that + * the code for TypeDescrIsArrayType() is at least not completely + * broken. + * + * The test is only meaningful if inlining actually happens. Here is + * how to verify that (manually): + * + * Run this with IONFLAGS=logs, generate pdfs with iongraph, and then + * try running "pdfgrep TypeDescrIsArrayType func*pass00*.pdf", this + * might net a function that is a likely candidate for manual inspection. + * + * (It is sometimes useful to comment out the assert() macro in the + * self-hosted code.) + */ + +if (!this.TypedObject) { + print("No TypedObject, skipping"); + quit(); +} + +var T = TypedObject; +var AT = new T.ArrayType(T.int32, 100); + +function check(v) { + return v.map(x => x+1); +} + +function Array_build(n, f) { + var a = new Array(n); + for ( var i=0 ; i < n ; i++ ) + a[i] = f(i); + return a; +} + +function test() { + var w1 = AT.build(x => x+1); + var w2 = Array_build(100, x => x+1); + w2.map = w1.map; + var a = [ w1, w2 ]; + for ( var i=0 ; i < 2000 ; i++ ) + try { a[i%2] = check(a[i%2]); } catch (e) { assertEq( i%2, 1 ); } + return a[0]; +} + +var w = test(); +assertEq(w.length, 100); +assertEq(w[99], 1100); +print("Done"); diff --git a/js/src/jit-test/manual-tests/TypedObject-TypeDescrIsArrayType.js b/js/src/jit-test/manual-tests/TypedObject-TypeDescrIsArrayType.js new file mode 100644 index 000000000..5600da1c9 --- /dev/null +++ b/js/src/jit-test/manual-tests/TypedObject-TypeDescrIsArrayType.js @@ -0,0 +1,62 @@ +/* -*- tab-width: 8; indent-tabs-mode: nil; js-indent-level: 2 -*- + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Susceptible to timeouts on some systems, see bug 1203595, if run + * with --ion-eager --ion-offthread-compile=off. + * + * Probably only meaningful to run this with default flags. + */ + +/* This test is intended to test Ion code generation for the internal + * primitive TypeDescrIsArrayType(), available to self-hosted code. + * + * To do that, it must trigger enough uses of that primitive as well + * as enough uses of a caller of the primitive to trigger inlining of + * the primitive into its compiled caller. + * + * It turns out that TypeDescrIsArrayType() is used early in the map() + * method on TypedObject arrays, so code that heavily uses the latter + * method will usually be good enough. + * + * In practice this test just asserts that map() works, and thus that + * the code for TypeDescrIsArrayType() is at least not completely + * broken. + * + * The test is only meaningful if inlining actually happens. Here is + * how to verify that (manually): + * + * Run this test with IONFLAGS=logs, generate pdfs with iongraph, and + * then try running "pdfgrep TypeDescrIsArrayType func*pass00*.pdf", + * this might net a function that is a likely candidate for further + * manual inspection. + * + * (It is sometimes useful to comment out the assert() macro in the + * self-hosted code.) + */ + +if (!this.TypedObject) { + print("No TypedObject, skipping"); + quit(); +} + +var T = TypedObject; +var AT = new T.ArrayType(T.int32, 100); + +function check(v) { + return v.map(x => x+1); +} + +function test() { + var w = new AT(); + for ( var i=0 ; i < 1000 ; i++ ) + w = check(w); + return w; +} + +var w = test(); +assertEq(w.length, 100); +assertEq(w[99], 1000); +print("Done"); + diff --git a/js/src/jit-test/manual-tests/dense-to-sparse.js b/js/src/jit-test/manual-tests/dense-to-sparse.js new file mode 100644 index 000000000..efe56620d --- /dev/null +++ b/js/src/jit-test/manual-tests/dense-to-sparse.js @@ -0,0 +1,40 @@ +// |jit-test| allow-oom +// Appending elements to a dense array should make the array sparse when the +// length exceeds the limit. + +function test() { + const MAX_DENSE_ELEMENTS_ALLOCATION = (1 << 28) - 1; + const VALUES_PER_HEADER = 2; + const MAX_DENSE_ELEMENTS_COUNT = MAX_DENSE_ELEMENTS_ALLOCATION - VALUES_PER_HEADER; + const SPARSE_DENSITY_RATIO = 8; + const MIN_DENSE = MAX_DENSE_ELEMENTS_COUNT / SPARSE_DENSITY_RATIO; + const MARGIN = 16; + + let a = []; + // Fill the beginning of array to make it keep dense until length exceeds + // MAX_DENSE_ELEMENTS_COUNT. + for (let i = 0; i < MIN_DENSE; i++) + a[i] = i; + + // Skip from MIN_DENSE to MAX_DENSE_ELEMENTS_COUNT - MARGIN, to reduce the + // time taken by test. + + // Fill the ending of array to make it sparse at MAX_DENSE_ELEMENTS_COUNT. + for (let i = MAX_DENSE_ELEMENTS_COUNT - MARGIN; i < MAX_DENSE_ELEMENTS_COUNT + MARGIN; i++) + a[i] = i; + + // Make sure the last element is defined. + assertEq(a.length, MAX_DENSE_ELEMENTS_COUNT + MARGIN); + assertEq(a[a.length - 1], MAX_DENSE_ELEMENTS_COUNT + MARGIN - 1); + + // Make sure elements around MAX_DENSE_ELEMENTS_COUNT are also defined. + assertEq(a[MAX_DENSE_ELEMENTS_COUNT - 1], MAX_DENSE_ELEMENTS_COUNT - 1); + assertEq(a[MAX_DENSE_ELEMENTS_COUNT], MAX_DENSE_ELEMENTS_COUNT); + assertEq(a[MAX_DENSE_ELEMENTS_COUNT + 1], MAX_DENSE_ELEMENTS_COUNT + 1); +} + +var config = getBuildConfiguration(); +// Takes too long time on debug build. +if (!config.debug) { + test(); +} |