Index: test/mjsunit/debug-evaluate-closure.js |
diff --git a/test/mjsunit/regress/regress-debug-deopt-while-recompile.js b/test/mjsunit/debug-evaluate-closure.js |
similarity index 54% |
copy from test/mjsunit/regress/regress-debug-deopt-while-recompile.js |
copy to test/mjsunit/debug-evaluate-closure.js |
index 3a6623568497b0fe05bce23875d8cd8f3da2a30f..778defd0ab7a03cb4d58a965b3469fc6f1bb145f 100644 |
--- a/test/mjsunit/regress/regress-debug-deopt-while-recompile.js |
+++ b/test/mjsunit/debug-evaluate-closure.js |
@@ -28,57 +28,64 @@ |
// Flags: --expose-debug-as debug --allow-natives-syntax |
Debug = debug.Debug; |
+var listened = false; |
function listener(event, exec_state, event_data, data) { |
if (event != Debug.DebugEvent.Break) return; |
try { |
- assertEquals("foo", exec_state.frame(0).evaluate("bar").value()); |
+ assertEquals("goo", exec_state.frame(0).evaluate("goo").value()); |
+ exec_state.frame(0).evaluate("goo = 'goo foo'"); |
+ assertEquals("bar return", exec_state.frame(0).evaluate("bar()").value()); |
+ assertEquals("inner bar", exec_state.frame(0).evaluate("inner").value()); |
+ assertEquals("outer bar", exec_state.frame(0).evaluate("outer").value()); |
+ assertEquals("baz inner", exec_state.frame(0).evaluate("baz").value()); |
+ assertEquals("baz outer", exec_state.frame(1).evaluate("baz").value()); |
+ exec_state.frame(0).evaluate("w = 'w foo'"); |
+ exec_state.frame(0).evaluate("inner = 'inner foo'"); |
+ exec_state.frame(0).evaluate("outer = 'outer foo'"); |
+ exec_state.frame(0).evaluate("baz = 'baz inner foo'"); |
+ exec_state.frame(1).evaluate("baz = 'baz outer foo'"); |
+ listened = true; |
} catch (e) { |
- exception = e; |
- }; |
- listened++; |
-}; |
- |
-var exception = null; |
-var listened = 0; |
- |
-var f = function() { |
- var bar = "foo"; |
- var baz = bar; // Break point should be here. |
- return bar; |
-} |
- |
-var g = function() { |
- var bar = "foo"; |
- var baz = bar; // Break point should be here. |
- return bar; |
+ print(e); |
+ print(e.stack); |
+ } |
} |
-f(); |
-f(); |
-g(); |
-g(); |
+Debug.setListener(listener); |
-// Mark with builtin. |
-%OptimizeFunctionOnNextCall(f); |
-if (%IsParallelRecompilationSupported()) { |
- %OptimizeFunctionOnNextCall(g, "parallel"); |
-} |
+var outer = "outer"; |
+var baz = "baz outer"; |
-// Activate debugger. |
-Debug.setListener(listener); |
+function foo() { |
+ var inner = "inner"; |
+ var baz = "baz inner"; |
+ var goo = "goo"; |
+ var withw = { w: "w" }; |
+ var withv = { v: "v" }; |
- // Set break point. |
-Debug.setBreakPoint(f, 2, 0); |
-Debug.setBreakPoint(g, 2, 0); |
+ with (withv) { |
+ var bar = function bar() { |
+ assertEquals("goo foo", goo); |
+ inner = "inner bar"; |
+ outer = "outer bar"; |
+ v = "v bar"; |
+ return "bar return"; |
+ }; |
+ } |
-// Trigger break point. |
-f(); |
-g(); |
+ with (withw) { |
+ debugger; |
+ } |
-// Assert that break point is set at expected location. |
-assertTrue(Debug.showBreakPoints(f).indexOf("[B0]var baz = bar;") > 0); |
-assertTrue(Debug.showBreakPoints(g).indexOf("[B0]var baz = bar;") > 0); |
+ assertEquals("inner foo", inner); |
+ assertEquals("baz inner foo", baz); |
+ assertEquals("w foo", withw.w); |
+ assertEquals("v bar", withv.v); |
+} |
-assertEquals(2, listened); |
-assertNull(exception); |
+foo(); |
+assertEquals("outer foo", outer); |
+assertEquals("baz outer foo", baz); |
+assertTrue(listened); |
+Debug.setListener(null); |