Commit 5fcc52fc authored by yangguo@chromium.org's avatar yangguo@chromium.org

Simplify debug evaluate.

R=peter.rybin@gmail.com
BUG=v8:2585, 173608

Review URL: https://chromiumcodereview.appspot.com/12953002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14019 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 2820eeb6
This diff is collapsed.
...@@ -1240,6 +1240,7 @@ TEST(TestCodeFlushingIncrementalAbort) { ...@@ -1240,6 +1240,7 @@ TEST(TestCodeFlushingIncrementalAbort) {
// code flushing candidate. // code flushing candidate.
SimulateIncrementalMarking(); SimulateIncrementalMarking();
#ifdef ENABLE_DEBUGGER_SUPPORT
// Enable the debugger and add a breakpoint while incremental marking // Enable the debugger and add a breakpoint while incremental marking
// is running so that incremental marking aborts and code flushing is // is running so that incremental marking aborts and code flushing is
// disabled. // disabled.
...@@ -1247,6 +1248,7 @@ TEST(TestCodeFlushingIncrementalAbort) { ...@@ -1247,6 +1248,7 @@ TEST(TestCodeFlushingIncrementalAbort) {
Handle<Object> breakpoint_object(Smi::FromInt(0), isolate); Handle<Object> breakpoint_object(Smi::FromInt(0), isolate);
isolate->debug()->SetBreakPoint(function, breakpoint_object, &position); isolate->debug()->SetBreakPoint(function, breakpoint_object, &position);
isolate->debug()->ClearAllBreakPoints(); isolate->debug()->ClearAllBreakPoints();
#endif // ENABLE_DEBUGGER_SUPPORT
// Force optimization now that code flushing is disabled. // Force optimization now that code flushing is disabled.
{ v8::HandleScope scope(env->GetIsolate()); { v8::HandleScope scope(env->GetIsolate());
...@@ -3010,8 +3012,10 @@ TEST(Regress173458) { ...@@ -3010,8 +3012,10 @@ TEST(Regress173458) {
// explicitly enqueued. // explicitly enqueued.
SimulateIncrementalMarking(); SimulateIncrementalMarking();
#ifdef ENABLE_DEBUGGER_SUPPORT
// Now enable the debugger which in turn will disable code flushing. // Now enable the debugger which in turn will disable code flushing.
CHECK(isolate->debug()->Load()); CHECK(isolate->debug()->Load());
#endif // ENABLE_DEBUGGER_SUPPORT
// This cycle will bust the heap and subsequent cycles will go ballistic. // This cycle will bust the heap and subsequent cycles will go ballistic.
heap->CollectAllGarbage(Heap::kNoGCFlags); heap->CollectAllGarbage(Heap::kNoGCFlags);
......
...@@ -36,19 +36,20 @@ exception = false; ...@@ -36,19 +36,20 @@ exception = false;
function h() { function h() {
var a = 1; var a = 1;
var b = 2; var b = 2;
var eval = 5; // Overriding eval should not break anything.
debugger; // Breakpoint. debugger; // Breakpoint.
} }
function checkFrame0(frame) { function checkFrame0(frame) {
// Frame 0 (h) has normal variables a and b. // Frame 0 (h) has normal variables a and b.
var count = frame.localCount(); var count = frame.localCount();
assertEquals(2, count); assertEquals(3, count);
for (var i = 0; i < count; ++i) { for (var i = 0; i < count; ++i) {
var name = frame.localName(i); var name = frame.localName(i);
var value = frame.localValue(i).value(); var value = frame.localValue(i).value();
if (name == 'a') { if (name == 'a') {
assertEquals(1, value); assertEquals(1, value);
} else { } else if (name !='eval') {
assertEquals('b', name); assertEquals('b', name);
assertEquals(2, value); assertEquals(2, value);
} }
...@@ -115,16 +116,21 @@ function listener(event, exec_state, event_data, data) { ...@@ -115,16 +116,21 @@ function listener(event, exec_state, event_data, data) {
// Evaluating a and b on frames 0, 1 and 2 produces 1, 2, 3, 4, 5 and 6. // Evaluating a and b on frames 0, 1 and 2 produces 1, 2, 3, 4, 5 and 6.
assertEquals(1, exec_state.frame(0).evaluate('a').value()); assertEquals(1, exec_state.frame(0).evaluate('a').value());
assertEquals(2, exec_state.frame(0).evaluate('b').value()); assertEquals(2, exec_state.frame(0).evaluate('b').value());
assertEquals(5, exec_state.frame(0).evaluate('eval').value());
assertEquals(3, exec_state.frame(1).evaluate('a').value()); assertEquals(3, exec_state.frame(1).evaluate('a').value());
assertEquals(4, exec_state.frame(1).evaluate('b').value()); assertEquals(4, exec_state.frame(1).evaluate('b').value());
assertEquals("function",
typeof exec_state.frame(1).evaluate('eval').value());
assertEquals(5, exec_state.frame(2).evaluate('a').value()); assertEquals(5, exec_state.frame(2).evaluate('a').value());
assertEquals(6, exec_state.frame(2).evaluate('b').value()); assertEquals(6, exec_state.frame(2).evaluate('b').value());
assertEquals("function",
typeof exec_state.frame(2).evaluate('eval').value());
// Indicate that all was processed. // Indicate that all was processed.
listenerComplete = true; listenerComplete = true;
} }
} catch (e) { } catch (e) {
exception = e exception = e
print("Caught something. " + e + " " + e.stack);
}; };
}; };
...@@ -133,6 +139,6 @@ Debug.setListener(listener); ...@@ -133,6 +139,6 @@ Debug.setListener(listener);
f(); f();
// Make sure that the debug event listener vas invoked. // Make sure that the debug event listener was invoked.
assertTrue(listenerComplete);
assertFalse(exception, "exception in listener") assertFalse(exception, "exception in listener")
assertTrue(listenerComplete);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment