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