| OLD | NEW |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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: --ignition | 5 // Flags: --ignition --side-effect-free-debug-evaluate |
| 6 | 6 |
| 7 Debug = debug.Debug | 7 Debug = debug.Debug |
| 8 | 8 |
| 9 var exception = null; | 9 var exception = null; |
| 10 | 10 |
| 11 function listener(event, exec_state, event_data, data) { | 11 function listener(event, exec_state, event_data, data) { |
| 12 if (event != Debug.DebugEvent.Break) return; | 12 if (event != Debug.DebugEvent.Break) return; |
| 13 try { | 13 try { |
| 14 function success(expectation, source) { | 14 function success(expectation, source) { |
| 15 assertEquals(expectation, | 15 assertEquals(expectation, exec_state.frame(0).evaluate(source).value()); |
| 16 exec_state.frame(0).evaluate(source, true).value()); | |
| 17 } | 16 } |
| 18 function fail(source) { | 17 function fail(source) { |
| 19 assertThrows(() => exec_state.frame(0).evaluate(source, true), | 18 assertThrows(() => exec_state.frame(0).evaluate(source), EvalError); |
| 20 EvalError); | |
| 21 } | 19 } |
| 22 | 20 |
| 23 // Test Math functions. | 21 // Test Math functions. |
| 24 for (f of Object.getOwnPropertyNames(Math)) { | 22 for (f of Object.getOwnPropertyNames(Math)) { |
| 25 if (typeof Math[f] === "function") { | 23 if (typeof Math[f] === "function") { |
| 26 var result = exec_state.frame(0).evaluate( | 24 var result = exec_state.frame(0).evaluate( |
| 27 `Math.${f}(0.5, -0.5);`).value(); | 25 `Math.${f}(0.5, -0.5);`).value(); |
| 28 if (f != "random") assertEquals(Math[f](0.5, -0.5), result); | 26 if (f != "random") assertEquals(Math[f](0.5, -0.5), result); |
| 29 } | 27 } |
| 30 } | 28 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Add the debug event listener. | 80 // Add the debug event listener. |
| 83 Debug.setListener(listener); | 81 Debug.setListener(listener); |
| 84 | 82 |
| 85 function f() { | 83 function f() { |
| 86 debugger; | 84 debugger; |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 f(); | 87 f(); |
| 90 | 88 |
| 91 assertNull(exception); | 89 assertNull(exception); |
| OLD | NEW |