OLD | NEW |
| (Empty) |
1 // Copyright 2014 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 | |
6 function f0() { | |
7 var v00 = 0; // Break 1 | |
8 var v01 = 1; | |
9 // Normal function call in a catch scope. | |
10 try { | |
11 throw 1; | |
12 } catch (e) { | |
13 try { | |
14 f1(); | |
15 } catch (e) { | |
16 var v02 = 2; // Break 13 | |
17 } | |
18 } | |
19 var v03 = 3; | |
20 var v04 = 4; | |
21 eval('var v05 = 5; // Break 14'); | |
22 var v06 = 6; // Break 15 | |
23 } | |
24 | |
25 function f1() { | |
26 var v10 = 0; // Break 2 | |
27 var v11 = 1; | |
28 // Getter call. | |
29 var v12 = o.get; | |
30 var v13 = 3 // Break 4 | |
31 // Setter call. | |
32 o.set = 2; | |
33 var v14 = 4; // Break 6 | |
34 // Function.prototype.call. | |
35 f2.call(); | |
36 var v15 = 5; // Break 12 | |
37 var v16 = 6; | |
38 // Exit function by throw. | |
39 throw 1; | |
40 var v17 = 7; | |
41 } | |
42 | |
43 function get() { | |
44 var g0 = 0; // Break 3 | |
45 var g1 = 1; | |
46 return 3; | |
47 } | |
48 | |
49 function set() { | |
50 var s0 = 0; // Break 5 | |
51 return 3; | |
52 } | |
53 | |
54 function f2() { | |
55 var v20 = 0; // Break 7 | |
56 // Construct call. | |
57 var v21 = new c0(); | |
58 var v22 = 2; // Break 9 | |
59 // Bound function. | |
60 b0(); | |
61 return 2; // Break 11 | |
62 } | |
63 | |
64 function c0() { | |
65 this.v0 = 0; // Break 8 | |
66 this.v1 = 1; | |
67 } | |
68 | |
69 function f3() { | |
70 var v30 = 0; // Break 10 | |
71 var v31 = 1; | |
72 return 3; | |
73 } | |
74 | |
75 var b0 = f3.bind(o); | |
76 | |
77 var o = {}; | |
78 Object.defineProperty(o, "get", { get : get }); | |
79 Object.defineProperty(o, "set", { set : set }); | |
80 | |
81 Debug = debug.Debug; | |
82 var break_count = 0 | |
83 var exception = null; | |
84 | |
85 function listener(event, exec_state, event_data, data) { | |
86 if (event != Debug.DebugEvent.Break) return; | |
87 try { | |
88 var line = exec_state.frame(0).sourceLineText(); | |
89 print(line); | |
90 var match = line.match(/\/\/ Break (\d+)$/); | |
91 assertEquals(2, match.length); | |
92 assertEquals(break_count, parseInt(match[1])); | |
93 break_count ++; | |
94 exec_state.prepareStep(Debug.StepAction.StepFrame); | |
95 } catch (e) { | |
96 print(e + e.stack); | |
97 exception = e; | |
98 } | |
99 } | |
100 | |
101 | |
102 break_count = 0; | |
103 Debug.setListener(listener); | |
104 debugger; // Break 0 | |
105 f0(); | |
106 Debug.setListener(null); // Break 16 | |
107 assertTrue(break_count > 14); | |
108 | |
109 assertNull(exception); | |
OLD | NEW |