From 38f70158ce8bbdb4e3872172122c000dbe2b6756 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Wed, 9 Jul 2014 20:53:39 +0200 Subject: [PATCH] Bug 1031272 - Remove fixed timeout in test_enterjit_osr.js. r=jld. --- tools/profiler/tests/test_enterjit_osr.js | 32 ++++++++++++++++------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/tools/profiler/tests/test_enterjit_osr.js b/tools/profiler/tests/test_enterjit_osr.js index fc2baa89367..2595b28ec8d 100644 --- a/tools/profiler/tests/test_enterjit_osr.js +++ b/tools/profiler/tests/test_enterjit_osr.js @@ -17,16 +17,28 @@ function run_test() { const ms = 5; p.StartProfiler(100, ms, ["js"], 1); - let profile = (function arbitrary_name(){ - // A frame for |arbitrary_name| has been pushed. - let then = Date.now(); - do { - let n = 10000; - while (--n); // OSR happens here - // Spin until we're sure we have a sample. - } while (Date.now() - then < ms * 2.5); - return p.getProfileData().threads[0].samples; - })(); + + function arbitrary_name(){ + // A frame for |arbitrary_name| has been pushed. Do a sequence of + // increasingly long spins until we get a sample. + var delayMS = 5; + while (1) { + do_print("loop: ms = " + delayMS); + let then = Date.now(); + do { + let n = 10000; + while (--n); // OSR happens here + // Spin in the hope of getting a sample. + } while (Date.now() - then < delayMS); + let pr = p.getProfileData().threads[0].samples; + if (pr.length > 0 || delayMS > 30000) + return pr; + delayMS *= 2; + } + }; + + var profile = arbitrary_name(); + do_check_neq(profile.length, 0); let stack = profile[profile.length - 1].frames.map(f => f.location); stack = stack.slice(stack.lastIndexOf("js::RunScript") + 1);