Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: test/mjsunit/manual-parallel-recompile.js

Issue 11419012: Introduce helper functions to test parallel recompilation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/runtime.cc ('K') | « src/runtime-profiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/manual-parallel-recompile.js
diff --git a/test/mjsunit/regress/regress-2339.js b/test/mjsunit/manual-parallel-recompile.js
similarity index 63%
copy from test/mjsunit/regress/regress-2339.js
copy to test/mjsunit/manual-parallel-recompile.js
index b16821dbade251a765a715a0bd18a4665dca125a..7eb26960396f4f60c6df045cf1775b08c75a68ad 100644
--- a/test/mjsunit/regress/regress-2339.js
+++ b/test/mjsunit/manual-parallel-recompile.js
@@ -26,34 +26,55 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --expose-gc
+// Flags: --parallel-recompilation --manual-parallel-recompilation
-/**
- * The possible optimization states of a function. Must be in sync with the
- * return values of Runtime_GetOptimizationStatus() in runtime.cc!
- */
+function assertOptimized(fun) {
+ // This assertion takes --always-opt and --nocrankshaft flags into account.
+ assertTrue(%GetOptimizationStatus(fun) != 2);
+}
+
+function assertUnoptimized(fun) {
+ assertTrue(%GetOptimizationStatus(fun) != 1);
+}
-var OptimizationState = {
- YES: 1,
- NO: 2,
- ALWAYS: 3,
- NEVER: 4
-};
+function f(x) {
+ var xx = x * x;
+ var xxstr = xx.toString();
+ return xxstr.length;
+}
-function simple() {
- return simple_two_args(0, undefined);
+function g(x) {
+ var xxx = Math.sqrt(x) | 0;
+ var xxxstr = xxx.toString();
+ return xxxstr.length;
}
-function simple_two_args(always_zero, always_undefined) {
- var always_five = always_undefined || 5;
- return always_zero * always_five * .5;
+function k(x) {
+ return x * x;
}
+f(g(1));
+f(g(2));
+assertUnoptimized(f);
+assertUnoptimized(g);
-simple();
-simple();
-%OptimizeFunctionOnNextCall(simple);
-simple();
-var raw_optimized = %GetOptimizationStatus(simple);
-assertFalse(raw_optimized == OptimizationState.NO);
+%ForceParallelRecompile(f);
+%ForceParallelRecompile(g);
+assertUnoptimized(f);
+assertUnoptimized(g);
+
+var sum = 0;
+for (var i = 0; i < 10000; i++) sum += f(i) + g(i);
gc();
+assertEquals(95274, sum);
+assertUnoptimized(f);
+assertUnoptimized(g);
+
+%InstallRecompiledCode(f);
+assertOptimized(f);
+assertUnoptimized(g);
+
+%InstallRecompiledCode("the rest");
+assertOptimized(g);
+
« src/runtime.cc ('K') | « src/runtime-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698