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

Side by Side Diff: test/mjsunit/es6/debug-step-into-constructor.js

Issue 1218493005: Debugger: use debug break slots instead of ICs (except for calls). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments Created 5 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
« no previous file with comments | « test/mjsunit/debug-stepframe.js ('k') | test/mjsunit/es6/debug-stepnext-for.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --expose-debug-as debug 5 // Flags: --expose-debug-as debug
6 6
7 'use strict'; 7 'use strict';
8 8
9 var Debug = debug.Debug 9 var Debug = debug.Debug
10 var done, stepCount; 10 var done, stepCount;
11 11
12 function listener(event, execState, eventData, data) { 12 function listener(event, execState, eventData, data) {
13 if (event == Debug.DebugEvent.Break) { 13 if (event == Debug.DebugEvent.Break) {
14 if (!done) { 14 if (!done) {
15 execState.prepareStep(Debug.StepAction.StepInto); 15 execState.prepareStep(Debug.StepAction.StepInto);
16 var s = execState.frame().sourceLineText(); 16 var s = execState.frame().sourceLineText();
17 print(s);
17 assertTrue(s.indexOf('// ' + stepCount + '.') !== -1); 18 assertTrue(s.indexOf('// ' + stepCount + '.') !== -1);
18 stepCount++; 19 stepCount++;
19 } 20 }
20 } 21 }
21 }; 22 };
22 23
23 Debug.setListener(listener); 24 Debug.setListener(listener);
24 25
25 26
26 class Base { 27 class Base {
27 constructor() { 28 constructor() { // 1.
28 var x = 1; // 1. 29 var x = 1; // 2.
29 var y = 2; // 2. 30 var y = 2; // 3.
30 done = true; // 3. 31 done = true; // 4.
31 } 32 }
32 } 33 }
33 34
34 class Derived extends Base {} 35 class Derived extends Base {}
35 36
36 37
37 (function TestBreakPointInConstructor() { 38 (function TestBreakPointInConstructor() {
38 done = false; 39 done = false;
39 stepCount = 1; 40 stepCount = 1;
40 var bp = Debug.setBreakPoint(Base, 0); 41 var bp = Debug.setBreakPoint(Base, 0);
41 42
42 new Base(); 43 new Base();
43 assertEquals(4, stepCount); 44 assertEquals(5, stepCount);
44 45
45 Debug.clearBreakPoint(bp); 46 Debug.clearBreakPoint(bp);
46 })(); 47 })();
47 48
48 49
49 (function TestDefaultConstructor() { 50 (function TestDefaultConstructor() {
50 done = false; 51 done = false;
51 stepCount = 1; 52 stepCount = 1;
52 53
53 var bp = Debug.setBreakPoint(Base, 0); 54 var bp = Debug.setBreakPoint(Base, 0);
54 new Derived(); 55 new Derived();
55 assertEquals(4, stepCount); 56 assertEquals(5, stepCount);
56 57
57 Debug.clearBreakPoint(bp); 58 Debug.clearBreakPoint(bp);
58 })(); 59 })();
59 60
60 61
61 (function TestStepInto() { 62 (function TestStepInto() {
62 done = false; 63 done = false;
63 stepCount = 0; 64 stepCount = 0;
64 65
65 function f() { 66 function f() {
66 new Derived(); // 0. 67 new Derived(); // 0.
67 } 68 }
68 69
69 var bp = Debug.setBreakPoint(f, 0); 70 var bp = Debug.setBreakPoint(f, 0);
70 f(); 71 f();
71 assertEquals(4, stepCount); 72 assertEquals(5, stepCount);
72 73
73 Debug.clearBreakPoint(bp); 74 Debug.clearBreakPoint(bp);
74 })(); 75 })();
75 76
76 77
77 (function TestExtraIndirection() { 78 (function TestExtraIndirection() {
78 done = false; 79 done = false;
79 stepCount = 0; 80 stepCount = 0;
80 81
81 class Derived2 extends Derived {} 82 class Derived2 extends Derived {}
82 83
83 function f() { 84 function f() {
84 new Derived2(); // 0. 85 new Derived2(); // 0.
85 } 86 }
86 87
87 var bp = Debug.setBreakPoint(f, 0); 88 var bp = Debug.setBreakPoint(f, 0);
88 f(); 89 f();
89 assertEquals(4, stepCount); 90 assertEquals(5, stepCount);
90 91
91 Debug.clearBreakPoint(bp); 92 Debug.clearBreakPoint(bp);
92 })(); 93 })();
93 94
94 95
95 (function TestBoundClass() { 96 (function TestBoundClass() {
96 done = false; 97 done = false;
97 stepCount = 0; 98 stepCount = 0;
98 99
99 var bound = Derived.bind(null); 100 var bound = Derived.bind(null);
100 101
101 function f() { 102 function f() {
102 new bound(); // 0. 103 new bound(); // 0.
103 } 104 }
104 105
105 var bp = Debug.setBreakPoint(f, 0); 106 var bp = Debug.setBreakPoint(f, 0);
106 f(); 107 f();
107 assertEquals(4, stepCount); 108 assertEquals(5, stepCount);
108 109
109 Debug.clearBreakPoint(bp); 110 Debug.clearBreakPoint(bp);
110 })(); 111 })();
111 112
112 113
113 Debug.setListener(null); 114 Debug.setListener(null);
OLDNEW
« no previous file with comments | « test/mjsunit/debug-stepframe.js ('k') | test/mjsunit/es6/debug-stepnext-for.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698