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

Side by Side Diff: test/mjsunit/debug-evaluate-locals-optimized-double.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 | « test/mjsunit/debug-evaluate-locals-optimized.js ('k') | no next file » | 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 + (i * 2 + 1) / 100,
49 frame.localValue(0).value());
50 assertEquals(i * 2 + 2 + (i * 2 + 2) / 100,
51 frame.localValue(1).value());
52 }
53
54 // When function f is optimized (2 means YES, see runtime.cc) we
55 // expect an optimized frame for f with g1, g2 and g3 inlined.
56 if (%GetOptimizationStatus(f) == 2) {
57 if (i == 1 || i == 2 || i == 3) {
58 assertTrue(frame.isOptimizedFrame());
59 assertTrue(frame.isInlinedFrame());
60 } else if (i == 4) {
61 assertTrue(frame.isOptimizedFrame());
62 assertFalse(frame.isInlinedFrame());
63 } else {
64 assertFalse(frame.isOptimizedFrame());
65 assertFalse(frame.isInlinedFrame());
66 }
67 }
68 }
69
70 // Indicate that all was processed.
71 listenerComplete = true;
72 }
73 } catch (e) {
74 exception = e
75 };
76 };
77
78 f();f();f();
79 %OptimizeFunctionOnNextCall(f);
80 f();
81
82 // Add the debug event listener.
83 Debug.setListener(listener);
84
85 function h(x, y) {
86 var a = 1;
87 var b = 2;
88 a = a + a / 100;
89 b = b + b / 100;
90 debugger; // Breakpoint.
91 };
92
93 function g3(x, y) {
94 var a = 3;
95 var b = 4;
96 a = a + a / 100;
97 b = b + b / 100;
98 h(a, b);
99 return a+b;
100 };
101
102 function g2(x, y) {
103 var a = 5;
104 var b = 6;
105 a = a + a / 100;
106 b = b + b / 100;
107 g3(a, b);
108 };
109
110 function g1(x, y) {
111 var a = 7;
112 var b = 8;
113 a = a + a / 100;
114 b = b + b / 100;
115 g2(a, b);
116 };
117
118 function f(x, y) {
119 var a = 9;
120 var b = 10;
121 a = a + a / 100;
122 b = b + b / 100;
123 g1(a, b);
124 };
125
126 f(11.11, 12.12);
127
128 // Make sure that the debug event listener vas invoked.
129 assertFalse(exception, "exception in listener " + exception)
130 assertTrue(listenerComplete);
131
132 Debug.setListener(null);
OLDNEW
« no previous file with comments | « test/mjsunit/debug-evaluate-locals-optimized.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698