Index: test/mjsunit/regress/regress-opt-after-debug-deopt.js |
diff --git a/test/mjsunit/regress/regress-embedded-cons-string.js b/test/mjsunit/regress/regress-opt-after-debug-deopt.js |
similarity index 67% |
copy from test/mjsunit/regress/regress-embedded-cons-string.js |
copy to test/mjsunit/regress/regress-opt-after-debug-deopt.js |
index afb3835688565986e45452d038866025ae11b0f0..be12cc56fde38ada0d00a9293e3a4dced3682486 100644 |
--- a/test/mjsunit/regress/regress-embedded-cons-string.js |
+++ b/test/mjsunit/regress/regress-opt-after-debug-deopt.js |
@@ -25,8 +25,7 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --fold-constants --nodead-code-elimination |
-// Flags: --expose-gc --allow-natives-syntax |
+// Flags: --expose-debug-as debug --allow-natives-syntax |
// Flags: --parallel-recompilation --parallel-recompilation-delay=300 |
if (!%IsParallelRecompilationSupported()) { |
@@ -34,33 +33,37 @@ if (!%IsParallelRecompilationSupported()) { |
quit(); |
} |
-function assertUnoptimized(fun) { |
- assertTrue(%GetOptimizationStatus(fun) != 1); |
-} |
+Debug = debug.Debug; |
-function test(fun) { |
- fun(); |
- fun(); |
- %OptimizeFunctionOnNextCall(fun, "parallel"); |
- fun(); // Trigger optimization in the background. |
- gc(); // Tenure cons string. |
- assertUnoptimized(fun); // Compilation not complete yet. |
- %CompleteOptimization(fun); // Compilation embeds tenured cons string. |
- gc(); // Visit embedded cons string during mark compact. |
-} |
+function listener(event, exec_state, event_data, data) { |
+ if (event != Debug.DebugEvent.Break) return; |
+ try { |
+ assertEquals("foo", exec_state.frame(0).evaluate("a").value()); |
+ } catch (e) { |
+ exception = e; |
+ }; |
+ listened++; |
+}; |
-function f() { |
- return "abcdefghijklmn" + "123456789"; |
-} |
+var exception = null; |
+var listened = 0; |
-function g() { |
- return "abcdefghijklmn\u2603" + "123456789"; |
+var f = function() { |
+ var a = "foo"; |
+ var b = a.substring("1"); |
+ [a, b].sort(); |
+ return a; |
} |
-function h() { |
- return "abcdefghijklmn\u2603" + "123456789\u2604"; |
-} |
+f(); |
+f(); |
+%OptimizeFunctionOnNextCall(f, "parallel"); // Mark with builtin. |
+f(); // Kick off parallel recompilation. |
+ |
+Debug.setListener(listener); // Activate debugger. |
+Debug.setBreakPoint(f, 2, 0); // Force deopt. |
+%CompleteOptimization(f); // Install optimized code. |
-test(f); |
-test(g); |
-test(h); |
+f(); // Trigger break point. |
+assertEquals(1, listened); |
+assertNull(exception); |