| OLD | NEW | 
|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. | 
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without | 
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are | 
| 4 // met: | 4 // met: | 
| 5 // | 5 // | 
| 6 //     * Redistributions of source code must retain the above copyright | 6 //     * Redistributions of source code must retain the above copyright | 
| 7 //       notice, this list of conditions and the following disclaimer. | 7 //       notice, this list of conditions and the following disclaimer. | 
| 8 //     * Redistributions in binary form must reproduce the above | 8 //     * Redistributions in binary form must reproduce the above | 
| 9 //       copyright notice, this list of conditions and the following | 9 //       copyright notice, this list of conditions and the following | 
| 10 //       disclaimer in the documentation and/or other materials provided | 10 //       disclaimer in the documentation and/or other materials provided | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 27 | 27 | 
| 28 // Flags: --fold-constants --nodead-code-elimination | 28 // Flags: --fold-constants --nodead-code-elimination | 
| 29 // Flags: --expose-gc --allow-natives-syntax | 29 // Flags: --expose-gc --allow-natives-syntax | 
| 30 // Flags: --parallel-recompilation --parallel-recompilation-delay=300 | 30 // Flags: --parallel-recompilation --parallel-recompilation-delay=300 | 
| 31 | 31 | 
| 32 if (!%IsParallelRecompilationSupported()) { | 32 if (!%IsParallelRecompilationSupported()) { | 
| 33   print("Parallel recompilation is disabled. Skipping this test."); | 33   print("Parallel recompilation is disabled. Skipping this test."); | 
| 34   quit(); | 34   quit(); | 
| 35 } | 35 } | 
| 36 | 36 | 
| 37 function assertUnoptimized(fun) { |  | 
| 38   assertTrue(%GetOptimizationStatus(fun) != 1); |  | 
| 39 } |  | 
| 40 |  | 
| 41 function test(fun) { | 37 function test(fun) { | 
| 42   fun(); | 38   fun(); | 
| 43   fun(); | 39   fun(); | 
|  | 40   // Mark for parallel optimization. | 
| 44   %OptimizeFunctionOnNextCall(fun, "parallel"); | 41   %OptimizeFunctionOnNextCall(fun, "parallel"); | 
| 45   fun();  // Trigger optimization in the background. | 42   //Trigger optimization in the background. | 
| 46   gc();   // Tenure cons string. | 43   fun(); | 
| 47   assertUnoptimized(fun);      // Compilation not complete yet. | 44   //Tenure cons string. | 
| 48   %CompleteOptimization(fun);  // Compilation embeds tenured cons string. | 45   gc(); | 
| 49   gc();   // Visit embedded cons string during mark compact. | 46   // In the mean time, parallel recompiling is not complete yet. | 
|  | 47   assertUnoptimized(fun, "no sync"); | 
|  | 48   // Parallel recompilation eventually finishes and embeds tenured cons string. | 
|  | 49   assertOptimized(fun, "sync"); | 
|  | 50   //Visit embedded cons string during mark compact. | 
|  | 51   gc(); | 
| 50 } | 52 } | 
| 51 | 53 | 
| 52 function f() { | 54 function f() { | 
| 53   return "abcdefghijklmn" + "123456789"; | 55   return "abcdefghijklmn" + "123456789"; | 
| 54 } | 56 } | 
| 55 | 57 | 
| 56 function g() { | 58 function g() { | 
| 57   return "abcdefghijklmn\u2603" + "123456789"; | 59   return "abcdefghijklmn\u2603" + "123456789"; | 
| 58 } | 60 } | 
| 59 | 61 | 
| 60 function h() { | 62 function h() { | 
| 61   return "abcdefghijklmn\u2603" + "123456789\u2604"; | 63   return "abcdefghijklmn\u2603" + "123456789\u2604"; | 
| 62 } | 64 } | 
| 63 | 65 | 
| 64 test(f); | 66 test(f); | 
| 65 test(g); | 67 test(g); | 
| 66 test(h); | 68 test(h); | 
| OLD | NEW | 
|---|