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

Side by Side Diff: test/mjsunit/debug-evaluate-locals-optimized.js

Issue 7230045: Support debugger inspection of locals in optimized frames (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 9 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/deoptimizer-x64.cc ('k') | test/mjsunit/debug-evaluate-locals-optimized-double.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 // Flags: --expose-debug-as debug --allow-natives-syntax
29 // Get the Debug object exposed from the debug context global object.
30 Debug = debug.Debug
31
32 listenerComplete = false;
33 exception = false;
34
35
36 function listener(event, exec_state, event_data, data) {
37 try {
38 if (event == Debug.DebugEvent.Break)
39 {
40 assertEquals(6, exec_state.frameCount());
41
42 for (var i = 0; i < exec_state.frameCount(); i++) {
43 var frame = exec_state.frame(i);
44 // All frames except the bottom one has normal variables a and b.
45 if (i < exec_state.frameCount() - 1) {
46 assertEquals('a', frame.localName(0));
47 assertEquals('b', frame.localName(1));
48 assertEquals(i * 2 + 1, frame.localValue(0).value());
49 assertEquals(i * 2 + 2, frame.localValue(1).value());
50 }
51
52 // When function f is optimized (2 means YES, see runtime.cc) we
53 // expect an optimized frame for f with g1, g2 and g3 inlined.
54 if (%GetOptimizationStatus(f) == 2) {
55 if (i == 1 || i == 2 || i == 3) {
56 assertTrue(frame.isOptimizedFrame());
57 assertTrue(frame.isInlinedFrame());
58 } else if (i == 4) {
59 assertTrue(frame.isOptimizedFrame());
60 assertFalse(frame.isInlinedFrame());
61 } else {
62 assertFalse(frame.isOptimizedFrame());
63 assertFalse(frame.isInlinedFrame());
64 }
65 }
66 }
67
68 // Indicate that all was processed.
69 listenerComplete = true;
70 }
71 } catch (e) {
72 exception = e
73 };
74 };
75
76 f();f();f();
77 %OptimizeFunctionOnNextCall(f);
78 f();
79
80 // Add the debug event listener.
81 Debug.setListener(listener);
82
83 function h(x, y) {
84 var a = 1;
85 var b = 2;
86 debugger; // Breakpoint.
87 };
88
89 function g3(x, y) {
90 var a = 3;
91 var b = 4;
92 h(a, b);
93 };
94
95 function g2(x, y) {
96 var a = 5;
97 var b = 6;
98 g3(a, b);
99 };
100
101 function g1(x, y) {
102 var a = 7;
103 var b = 8;
104 g2(a, b);
105 };
106
107 function f(x, y) {
108 var a = 9;
109 var b = 10;
110 g1(a, b);
111 };
112
113 f(11, 12);
114
115 // Make sure that the debug event listener vas invoked.
116 assertFalse(exception, "exception in listener " + exception)
117 assertTrue(listenerComplete);
118
119 Debug.setListener(null);
OLDNEW
« no previous file with comments | « src/x64/deoptimizer-x64.cc ('k') | test/mjsunit/debug-evaluate-locals-optimized-double.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698