OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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: --noalways-opt | |
6 | |
7 var Debug = debug.Debug; | 5 var Debug = debug.Debug; |
8 var global_marker = 7; | 6 var global_marker = 7; |
9 | 7 |
10 async function thrower() { throw 'Exception'; } | 8 async function thrower() { throw 'Exception'; } |
11 | 9 |
12 async function test(name, func, args, handler, continuation) { | 10 async function test(name, func, args, handler, continuation) { |
13 var handler_called = false; | 11 var handler_called = false; |
14 var exception = null; | 12 var exception = null; |
15 | 13 |
16 function listener(event, exec_state, event_data, data) { | 14 function listener(event, exec_state, event_data, data) { |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 await test( | 393 await test( |
396 "(AsyncFunctionExpression) Closure 1 --- resume normal", | 394 "(AsyncFunctionExpression) Closure 1 --- resume normal", |
397 async function(a) { let x = await 2; | 395 async function(a) { let x = await 2; |
398 return function() { debugger; return a; } }, [1], | 396 return function() { debugger; return a; } }, [1], |
399 exec_state => { | 397 exec_state => { |
400 CheckScopeChain([debug.ScopeType.Local, | 398 CheckScopeChain([debug.ScopeType.Local, |
401 debug.ScopeType.Closure, | 399 debug.ScopeType.Closure, |
402 debug.ScopeType.Closure, | 400 debug.ScopeType.Closure, |
403 debug.ScopeType.Script, | 401 debug.ScopeType.Script, |
404 debug.ScopeType.Global], exec_state); | 402 debug.ScopeType.Global], exec_state); |
405 CheckScopeContent({a:1}, 1, exec_state); | 403 CheckScopeContent({a:1, x: 2}, 1, exec_state); |
406 }, | 404 }, |
407 result => result()); | 405 result => result()); |
408 | 406 |
409 await test( | 407 await test( |
410 "(AsyncFunctionExpression) Closure 1 --- resume throw", | 408 "(AsyncFunctionExpression) Closure 1 --- resume throw", |
411 async function(a) { let x = await 2; | 409 async function(a) { let x = await 2; |
412 return async function() { | 410 return async function() { |
413 try { await thrower(); } | 411 try { await thrower(); } |
414 catch (e) { debugger; } return a; }; }, [1], | 412 catch (e) { debugger; } return a; }; }, [1], |
415 exec_state => { | 413 exec_state => { |
416 CheckScopeChain([debug.ScopeType.Catch, | 414 CheckScopeChain([debug.ScopeType.Catch, |
417 debug.ScopeType.Local, | 415 debug.ScopeType.Local, |
418 debug.ScopeType.Closure, | 416 debug.ScopeType.Closure, |
419 debug.ScopeType.Closure, | 417 debug.ScopeType.Closure, |
420 debug.ScopeType.Script, | 418 debug.ScopeType.Script, |
421 debug.ScopeType.Global], exec_state); | 419 debug.ScopeType.Global], exec_state); |
422 CheckScopeContent({e: 'Exception'}, 0, exec_state); | 420 CheckScopeContent({e: 'Exception'}, 0, exec_state); |
423 CheckScopeContent({a:1}, 2, exec_state); | 421 CheckScopeContent({a:1, x: 2}, 2, exec_state); |
424 }, | 422 }, |
425 result => result()); | 423 result => result()); |
426 | 424 |
427 await test( | 425 await test( |
428 "(AsyncFunctionExpression) Catch block 1", | 426 "(AsyncFunctionExpression) Catch block 1", |
429 async function() { try { throw 'Exception'; } catch (e) { debugger; } }, [], | 427 async function() { try { throw 'Exception'; } catch (e) { debugger; } }, [], |
430 exec_state => { | 428 exec_state => { |
431 CheckScopeChain([debug.ScopeType.Catch, | 429 CheckScopeChain([debug.ScopeType.Catch, |
432 debug.ScopeType.Local, | 430 debug.ScopeType.Local, |
433 debug.ScopeType.Closure, | 431 debug.ScopeType.Closure, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 | 539 |
542 if (scope_size < count) { | 540 if (scope_size < count) { |
543 print('Names found in scope:'); | 541 print('Names found in scope:'); |
544 var names = scope.scopeObject().propertyNames(); | 542 var names = scope.scopeObject().propertyNames(); |
545 for (var i = 0; i < names.length; i++) { | 543 for (var i = 0; i < names.length; i++) { |
546 print(names[i]); | 544 print(names[i]); |
547 } | 545 } |
548 } | 546 } |
549 assertTrue(scope_size >= count); | 547 assertTrue(scope_size >= count); |
550 } | 548 } |
OLD | NEW |