blob: baa0ac2c12d972902c318b1ff5c12d48f70027ad [file] [log] [blame]
library #lib;
import self as self;
import "dart:core" as core;
[@vm.bytecode=
Bytecode {
Entry 4
CheckStack
Try #0 start:
PushConstant CP#0
PushConstant CP#2
IndirectStaticCall 1, CP#1
Drop1
Jump L1
Try #0 end:
Try #0 handler:
MoveSpecial r0, exception
MoveSpecial r1, stackTrace
Push r0
PopLocal r2
PushConstant CP#4
PushConstant CP#5
CreateArrayTOS
StoreLocal r3
Push r3
PushConstant CP#6
PushConstant CP#7
StoreIndexedTOS
Push r3
PushConstant CP#8
Push r2
StoreIndexedTOS
PushConstant CP#9
IndirectStaticCall 1, CP#1
PushConstant CP#10
IndirectStaticCall 1, CP#1
Drop1
Jump L1
L1:
PushConstant CP#4
ReturnTOS
}
ExceptionsTable {
try-index 0, outer -1, start 2, end 7, handler 7, types [CP#3]
}
ConstantPool {
[0] = String 'danger!'
[1] = ArgDesc num-args 1, num-type-args 0, names []
[2] = StaticICData target 'dart.core::print', arg-desc CP#1
[3] = Type dynamic
[4] = Null
[5] = Int 2
[6] = Int 0
[7] = String 'caught '
[8] = Int 1
[9] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#1
[10] = StaticICData target 'dart.core::print', arg-desc CP#1
}
]static method testTryCatch1() dynamic {
try {
core::print("danger!");
}
on dynamic catch(final dynamic e) {
core::print("caught ${e}");
}
}
[@vm.bytecode=
Bytecode {
Entry 5
CheckStack
Try #0 start:
PushConstant CP#0
PushConstant CP#2
IndirectStaticCall 1, CP#1
Drop1
Jump L1
Try #0 end:
Try #0 handler:
MoveSpecial r0, exception
MoveSpecial r1, stackTrace
Push r0
PushConstant CP#4
PushConstant CP#4
PushConstant CP#3
InstanceCall1 4, CP#6
PushConstant CP#7
IfNeStrictTOS
Jump L2
PushConstant CP#8
PushConstant CP#9
IndirectStaticCall 1, CP#1
Drop1
Jump L1
L2:
Push r0
PushConstant CP#4
PushConstant CP#4
PushConstant CP#10
InstanceCall1 4, CP#11
PushConstant CP#7
IfNeStrictTOS
Jump L3
Push r0
PopLocal r2
PushConstant CP#4
PushConstant CP#12
CreateArrayTOS
StoreLocal r3
Push r3
PushConstant CP#13
PushConstant CP#14
StoreIndexedTOS
Push r3
PushConstant CP#15
Push r2
StoreIndexedTOS
PushConstant CP#16
IndirectStaticCall 1, CP#1
PushConstant CP#17
IndirectStaticCall 1, CP#1
Drop1
Jump L1
L3:
Push r0
PushConstant CP#4
PushConstant CP#4
PushConstant CP#18
InstanceCall1 4, CP#19
PushConstant CP#7
IfNeStrictTOS
Jump L4
Push r0
PopLocal r2
Push r1
PopLocal r3
PushConstant CP#4
PushConstant CP#20
CreateArrayTOS
StoreLocal r4
Push r4
PushConstant CP#13
PushConstant CP#21
StoreIndexedTOS
Push r4
PushConstant CP#15
Push r2
StoreIndexedTOS
Push r4
PushConstant CP#12
PushConstant CP#22
StoreIndexedTOS
Push r4
PushConstant CP#23
Push r3
StoreIndexedTOS
PushConstant CP#24
IndirectStaticCall 1, CP#1
PushConstant CP#25
IndirectStaticCall 1, CP#1
Drop1
Jump L1
L4:
Push r0
PopLocal r2
Push r1
PopLocal r3
PushConstant CP#4
PushConstant CP#20
CreateArrayTOS
StoreLocal r4
Push r4
PushConstant CP#13
PushConstant CP#27
StoreIndexedTOS
Push r4
PushConstant CP#15
Push r2
StoreIndexedTOS
Push r4
PushConstant CP#12
PushConstant CP#22
StoreIndexedTOS
Push r4
PushConstant CP#23
Push r3
StoreIndexedTOS
PushConstant CP#28
IndirectStaticCall 1, CP#1
PushConstant CP#29
IndirectStaticCall 1, CP#1
Drop1
Jump L1
L1:
PushConstant CP#4
ReturnTOS
}
ExceptionsTable {
try-index 0, outer -1, start 2, end 7, handler 7, needs-stack-trace, types [CP#3, CP#10, CP#18, CP#26]
}
ConstantPool {
[0] = String 'danger!'
[1] = ArgDesc num-args 1, num-type-args 0, names []
[2] = StaticICData target 'dart.core::print', arg-desc CP#1
[3] = Type dart.core::TypeError
[4] = Null
[5] = ArgDesc num-args 4, num-type-args 0, names []
[6] = ICData target-name 'dart.core::_instanceOf', arg-desc CP#5
[7] = Bool true
[8] = String 'caught type error'
[9] = StaticICData target 'dart.core::print', arg-desc CP#1
[10] = Type dart.core::AssertionError
[11] = ICData target-name 'dart.core::_instanceOf', arg-desc CP#5
[12] = Int 2
[13] = Int 0
[14] = String 'caught assertion error '
[15] = Int 1
[16] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#1
[17] = StaticICData target 'dart.core::print', arg-desc CP#1
[18] = Type dart.core::Error
[19] = ICData target-name 'dart.core::_instanceOf', arg-desc CP#5
[20] = Int 4
[21] = String 'caught error '
[22] = String ' '
[23] = Int 3
[24] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#1
[25] = StaticICData target 'dart.core::print', arg-desc CP#1
[26] = Type dynamic
[27] = String 'caught something '
[28] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#1
[29] = StaticICData target 'dart.core::print', arg-desc CP#1
}
]static method testTryCatch2() dynamic {
try {
core::print("danger!");
}
on core::TypeError catch(no-exception-var) {
core::print("caught type error");
}
on core::AssertionError catch(final core::AssertionError e) {
core::print("caught assertion error ${e}");
}
on core::Error catch(final core::Error e, final core::StackTrace st) {
core::print("caught error ${e} ${st}");
}
on dynamic catch(final dynamic e, final core::StackTrace st) {
core::print("caught something ${e} ${st}");
}
}
[@vm.bytecode=
Bytecode {
Entry 7
CheckStack
AllocateContext 1
StoreLocal r1
Push r1
Push r0
StoreFieldTOS CP#0
PopLocal r0
Push r0
PushConstant CP#1
StoreFieldTOS CP#2
Push r0
PopLocal r2
Try #0 start:
AllocateContext 1
StoreLocal r1
Push r1
Push r0
StoreFieldTOS CP#0
PopLocal r0
Push r0
PushConstant CP#3
StoreFieldTOS CP#2
Allocate CP#14
StoreLocal r5
Push r5
PushConstant CP#12
StoreFieldTOS CP#15
Push r5
PushConstant CP#12
StoreFieldTOS CP#16
Push r5
PushConstant CP#4
StoreFieldTOS CP#17
Push r5
Push r0
StoreFieldTOS CP#5
PopLocal r4
Push r4
InstanceCall1 1, CP#18
Drop1
Push r0
LoadFieldTOS CP#2
PushConstant CP#19
IndirectStaticCall 1, CP#7
Drop1
Push r0
LoadFieldTOS CP#0
PopLocal r0
Jump L1
Try #0 end:
Try #0 handler:
Push r2
PopLocal r0
MoveSpecial r2, exception
MoveSpecial r3, stackTrace
AllocateContext 1
StoreLocal r1
Push r1
Push r0
StoreFieldTOS CP#0
PopLocal r0
Push r2
PopLocal r4
Push r0
Push r3
StoreFieldTOS CP#2
PushConstant CP#12
PushConstant CP#20
CreateArrayTOS
StoreLocal r5
Push r5
PushConstant CP#21
PushConstant CP#22
StoreIndexedTOS
Push r5
PushConstant CP#1
Push r4
StoreIndexedTOS
Push r5
PushConstant CP#3
PushConstant CP#23
StoreIndexedTOS
Push r5
PushConstant CP#11
Push r0
LoadFieldTOS CP#2
StoreIndexedTOS
PushConstant CP#24
IndirectStaticCall 1, CP#7
PushConstant CP#25
IndirectStaticCall 1, CP#7
Drop1
Allocate CP#14
StoreLocal r5
Push r5
PushConstant CP#12
StoreFieldTOS CP#15
Push r5
PushConstant CP#12
StoreFieldTOS CP#16
Push r5
PushConstant CP#26
StoreFieldTOS CP#17
Push r5
Push r0
StoreFieldTOS CP#5
PopLocal r6
Push r6
ReturnTOS
Push r0
LoadFieldTOS CP#0
PopLocal r0
Jump L1
L1:
Push r0
LoadFieldTOS CP#0
PopLocal r0
PushConstant CP#12
ReturnTOS
}
ExceptionsTable {
try-index 0, outer -1, start 13, end 49, handler 49, needs-stack-trace, types [CP#9]
}
ConstantPool {
[0] = ContextOffset parent
[1] = Int 1
[2] = ContextOffset var [0]
[3] = Int 2
[4] = ClosureFunction foo () void;
[5] = FieldOffset dart.core::_Closure::_context
[6] = String 'danger foo'
[7] = ArgDesc num-args 1, num-type-args 0, names []
[8] = StaticICData target 'dart.core::print', arg-desc CP#7
[9] = Type dynamic
[10] = StaticICData target 'dart.core::print', arg-desc CP#7
[11] = Int 3
[12] = Null
[13] = EndClosureFunctionScope
[14] = Class dart.core::_Closure
[15] = FieldOffset dart.core::_Closure::_instantiator_type_arguments
[16] = FieldOffset dart.core::_Closure::_function_type_arguments
[17] = FieldOffset dart.core::_Closure::_function
[18] = ICData target-name 'call', arg-desc CP#7
[19] = StaticICData target 'dart.core::print', arg-desc CP#7
[20] = Int 4
[21] = Int 0
[22] = String 'caught '
[23] = String ' '
[24] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#7
[25] = StaticICData target 'dart.core::print', arg-desc CP#7
[26] = ClosureFunction bar () void;
[27] = String 'danger bar'
[28] = StaticICData target 'dart.core::print', arg-desc CP#7
[29] = Type dart.core::Error
[30] = ArgDesc num-args 4, num-type-args 0, names []
[31] = ICData target-name 'dart.core::_instanceOf', arg-desc CP#30
[32] = Bool true
[33] = String 'error '
[34] = String ', captured stack trace: '
[35] = StaticICData target 'dart.core::_StringBase::_interpolate', arg-desc CP#7
[36] = StaticICData target 'dart.core::print', arg-desc CP#7
[37] = EndClosureFunctionScope
}
Closure CP#4 {
Entry 6
CheckStack
Push FP[-5]
LoadFieldTOS CP#5
PopLocal r0
Push r0
PopLocal r2
Try #0 start:
PushConstant CP#6
PushConstant CP#8
IndirectStaticCall 1, CP#7
Drop1
Jump L1
Try #0 end:
Try #0 handler:
Push r2
PopLocal r0
MoveSpecial r2, exception
MoveSpecial r3, stackTrace
Push r2
PopLocal r4
Push r0
LoadFieldTOS CP#0
LoadFieldTOS CP#2
PushConstant CP#10
IndirectStaticCall 1, CP#7
Drop1
Push r0
PushConstant CP#11
StoreFieldTOS CP#2
Jump L1
L1:
PushConstant CP#12
ReturnTOS
}
Closure CP#26 {
Entry 6
CheckStack
Push FP[-5]
LoadFieldTOS CP#5
PopLocal r0
Push r0
PopLocal r2
Try #0 start:
PushConstant CP#27
PushConstant CP#28
IndirectStaticCall 1, CP#7
Drop1
Jump L1
Try #0 end:
Try #0 handler:
Push r2
PopLocal r0
MoveSpecial r2, exception
MoveSpecial r3, stackTrace
Push r2
PushConstant CP#12
PushConstant CP#12
PushConstant CP#29
InstanceCall1 4, CP#31
PushConstant CP#32
IfNeStrictTOS
Jump L2
Push r2
PopLocal r4
PushConstant CP#12
PushConstant CP#20
CreateArrayTOS
StoreLocal r5
Push r5
PushConstant CP#21
PushConstant CP#33
StoreIndexedTOS
Push r5
PushConstant CP#1
Push r4
StoreIndexedTOS
Push r5
PushConstant CP#3
PushConstant CP#34
StoreIndexedTOS
Push r5
PushConstant CP#11
Push r0
LoadFieldTOS CP#2
StoreIndexedTOS
PushConstant CP#35
IndirectStaticCall 1, CP#7
PushConstant CP#36
IndirectStaticCall 1, CP#7
Drop1
Jump L1
L2:
Push r2
Push r3
Throw 1
L1:
PushConstant CP#12
ReturnTOS
}
]static method testTryCatch3() dynamic {
core::int x = 1;
try {
core::int y = 2;
function foo() void {
try {
core::print("danger foo");
}
on dynamic catch(final dynamic e) {
core::print(x);
y = 3;
}
}
foo.call();
core::print(y);
}
on dynamic catch(final dynamic e, final core::StackTrace st) {
core::print("caught ${e} ${st}");
function bar() void {
try {
core::print("danger bar");
}
on core::Error catch(final core::Error e) {
core::print("error ${e}, captured stack trace: ${st}");
}
}
return bar;
}
}
[@vm.bytecode=
Bytecode {
Entry 8
CheckStack
Try #0 start:
Try #1 start:
PushConstant CP#0
PushConstant CP#2
IndirectStaticCall 1, CP#1
Drop1
Jump L1
Try #1 end:
Try #1 handler:
MoveSpecial r2, exception
MoveSpecial r3, stackTrace
Push r2
PopLocal r4
Try #2 start:
PushConstant CP#4
PushConstant CP#5
IndirectStaticCall 1, CP#1
Drop1
Push FP[-5]
AssertBoolean 0
PushConstant CP#6
IfNeStrictTOS
Jump L2
Push r2
Push r3
Throw 1
Drop1
L2:
Jump L3
Try #2 end:
Try #2 handler:
MoveSpecial r5, exception
MoveSpecial r6, stackTrace
Push r5
PopLocal r7
PushConstant CP#7
PushConstant CP#8
IndirectStaticCall 1, CP#1
Drop1
Jump L3
L3:
Jump L1
L1:
Jump L4
Try #0 end:
Try #0 handler:
MoveSpecial r0, exception
MoveSpecial r1, stackTrace
Push r0
PopLocal r2
Push r1
PopLocal r3
PushConstant CP#9
PushConstant CP#10
IndirectStaticCall 1, CP#1
Drop1
Push r3
PushConstant CP#11
IndirectStaticCall 1, CP#1
Drop1
Jump L4
L4:
PushConstant CP#12
ReturnTOS
}
ExceptionsTable {
try-index 0, outer -1, start 2, end 36, handler 36, needs-stack-trace, types [CP#3]
try-index 1, outer 0, start 2, end 7, handler 7, needs-stack-trace, types [CP#3]
try-index 2, outer 0, start 11, end 25, handler 25, types [CP#3]
}
ConstantPool {
[0] = String 'try 1 > try 2'
[1] = ArgDesc num-args 1, num-type-args 0, names []
[2] = StaticICData target 'dart.core::print', arg-desc CP#1
[3] = Type dynamic
[4] = String 'try 1 > catch 2 > try 3'
[5] = StaticICData target 'dart.core::print', arg-desc CP#1
[6] = Bool true
[7] = String 'try 1 > catch 2 > catch 3'
[8] = StaticICData target 'dart.core::print', arg-desc CP#1
[9] = String 'catch 1'
[10] = StaticICData target 'dart.core::print', arg-desc CP#1
[11] = StaticICData target 'dart.core::print', arg-desc CP#1
[12] = Null
}
]static method testRethrow(core::bool cond) dynamic {
try {
try {
core::print("try 1 > try 2");
}
on dynamic catch(final dynamic e) {
try {
core::print("try 1 > catch 2 > try 3");
if(cond) {
rethrow;
}
}
on dynamic catch(final dynamic e) {
core::print("try 1 > catch 2 > catch 3");
}
}
}
on dynamic catch(final dynamic e, final core::StackTrace st) {
core::print("catch 1");
core::print(st);
}
}
[@vm.bytecode=
Bytecode {
Entry 3
CheckStack
PushConstant CP#0
PopLocal r0
L5:
CheckStack
Push r0
PushConstant CP#1
InstanceCall1 2, CP#3
AssertBoolean 0
PushConstant CP#4
IfNeStrictTOS
Jump L1
Try #0 start:
Push r0
PushConstant CP#5
InstanceCall1 2, CP#6
AssertBoolean 0
PushConstant CP#4
IfNeStrictTOS
Jump L2
Jump L3
L2:
Jump L4
Try #0 end:
Try #0 handler:
MoveSpecial r1, exception
MoveSpecial r2, stackTrace
Push r0
PushConstant CP#9
IndirectStaticCall 1, CP#8
Drop1
Push r1
Push r2
Throw 1
L3:
Push r0
PushConstant CP#10
IndirectStaticCall 1, CP#8
Drop1
Jump L1
L4:
Push r0
PushConstant CP#11
IndirectStaticCall 1, CP#8
Drop1
Push r0
PushConstant CP#12
InstanceCall1 2, CP#13
StoreLocal r0
Drop1
Jump L5
L1:
PushConstant CP#14
ReturnTOS
}
ExceptionsTable {
try-index 0, outer -1, start 12, end 21, handler 21, needs-stack-trace, types [CP#7]
}
ConstantPool {
[0] = Int 0
[1] = Int 10
[2] = ArgDesc num-args 2, num-type-args 0, names []
[3] = ICData target-name '<', arg-desc CP#2
[4] = Bool true
[5] = Int 5
[6] = ICData target-name '>', arg-desc CP#2
[7] = Type dynamic
[8] = ArgDesc num-args 1, num-type-args 0, names []
[9] = StaticICData target 'dart.core::print', arg-desc CP#8
[10] = StaticICData target 'dart.core::print', arg-desc CP#8
[11] = StaticICData target 'dart.core::print', arg-desc CP#8
[12] = Int 1
[13] = ICData target-name '+', arg-desc CP#2
[14] = Null
}
]static method testTryFinally1() dynamic {
#L1:
for (core::int i = 0; i.{core::num::<}(10); i = i.{core::num::+}(1)) {
try {
if(i.{core::num::>}(5)) {
break #L1;
}
}
finally {
core::print(i);
}
}
}
[@vm.bytecode=
Bytecode {
Entry 9
CheckStack
AllocateContext 1
PopLocal r0
Push r0
Push FP[-5]
StoreFieldTOS CP#0
Push r0
LoadFieldTOS CP#0
PopLocal r2
Push r2
PushConstant CP#2
InstanceCall1 2, CP#3
PushConstant CP#4
IfEqStrictTOS
Jump L1
Push r2
PushConstant CP#5
InstanceCall1 2, CP#6
PushConstant CP#4
IfEqStrictTOS
Jump L2
Jump L3
L1:
Push r0
PopLocal r3
Try #0 start:
AllocateContext 1
StoreLocal r1
Push r1
Push r0
StoreFieldTOS CP#7
PopLocal r0
PushConstant CP#8
PushConstant CP#10
IndirectStaticCall 1, CP#9
Drop1
Push r0
PushConstant CP#11
StoreFieldTOS CP#0
Push r0
PopLocal r5
Try #1 start:
PushConstant CP#12
PushConstant CP#13
IndirectStaticCall 1, CP#9
Drop1
Allocate CP#20
StoreLocal r8
Push r8
PushConstant CP#18
StoreFieldTOS CP#21
Push r8
PushConstant CP#18
StoreFieldTOS CP#22
Push r8
PushConstant CP#14
StoreFieldTOS CP#23
Push r8
Push r0
StoreFieldTOS CP#15
PopLocal r7
Push r7
InstanceCall1 1, CP#24
Drop1
Jump L4
Jump L5
Try #1 end:
Try #1 handler:
Push r5
PopLocal r0
MoveSpecial r5, exception
MoveSpecial r6, stackTrace
PushConstant CP#26
PushConstant CP#27
IndirectStaticCall 1, CP#9
Drop1
Push r5
Push r6
Throw 1
L4:
Push r5
PopLocal r0
PushConstant CP#26
PushConstant CP#28
IndirectStaticCall 1, CP#9
Drop1
Jump L6
L5:
Push r5
PopLocal r0
PushConstant CP#26
PushConstant CP#29
IndirectStaticCall 1, CP#9
Drop1
PushConstant CP#30
PushConstant CP#31
IndirectStaticCall 1, CP#9
Drop1
Push r0
LoadFieldTOS CP#7
PopLocal r0
Jump L7
Try #0 end:
Try #0 handler:
Push r3
PopLocal r0
MoveSpecial r3, exception
MoveSpecial r4, stackTrace
PushConstant CP#32
PushConstant CP#33
IndirectStaticCall 1, CP#9
Drop1
Push r3
Push r4
Throw 1
L6:
Push r3
PopLocal r0
PushConstant CP#32
PushConstant CP#34
IndirectStaticCall 1, CP#9
Drop1
Jump L2
L7:
Push r3
PopLocal r0
PushConstant CP#32
PushConstant CP#35
IndirectStaticCall 1, CP#9
Drop1
Jump L3
L2:
PushConstant CP#36
PushConstant CP#37
IndirectStaticCall 1, CP#9
Drop1
Jump L3
L3:
PushConstant CP#18
ReturnTOS
}
ExceptionsTable {
try-index 0, outer -1, start 25, end 96, handler 96, needs-stack-trace, types [CP#25]
try-index 1, outer 0, start 40, end 64, handler 64, needs-stack-trace, types [CP#25]
}
ConstantPool {
[0] = ContextOffset var [0]
[1] = ArgDesc num-args 2, num-type-args 0, names []
[2] = Int 1
[3] = ICData target-name '==', arg-desc CP#1
[4] = Bool true
[5] = Int 2
[6] = ICData target-name '==', arg-desc CP#1
[7] = ContextOffset parent
[8] = String 'before try 1'
[9] = ArgDesc num-args 1, num-type-args 0, names []
[10] = StaticICData target 'dart.core::print', arg-desc CP#9
[11] = Int 3
[12] = String 'try'
[13] = StaticICData target 'dart.core::print', arg-desc CP#9
[14] = ClosureFunction foo () void;
[15] = FieldOffset dart.core::_Closure::_context
[16] = StaticICData target 'dart.core::print', arg-desc CP#9
[17] = StaticICData target 'dart.core::print', arg-desc CP#9
[18] = Null
[19] = EndClosureFunctionScope
[20] = Class dart.core::_Closure
[21] = FieldOffset dart.core::_Closure::_instantiator_type_arguments
[22] = FieldOffset dart.core::_Closure::_function_type_arguments
[23] = FieldOffset dart.core::_Closure::_function
[24] = ICData target-name 'call', arg-desc CP#9
[25] = Type dynamic
[26] = String 'finally 1'
[27] = StaticICData target 'dart.core::print', arg-desc CP#9
[28] = StaticICData target 'dart.core::print', arg-desc CP#9
[29] = StaticICData target 'dart.core::print', arg-desc CP#9
[30] = String 'after try 1'
[31] = StaticICData target 'dart.core::print', arg-desc CP#9
[32] = String 'finally 2'
[33] = StaticICData target 'dart.core::print', arg-desc CP#9
[34] = StaticICData target 'dart.core::print', arg-desc CP#9
[35] = StaticICData target 'dart.core::print', arg-desc CP#9
[36] = String 'case 2'
[37] = StaticICData target 'dart.core::print', arg-desc CP#9
}
Closure CP#14 {
Entry 2
CheckStack
Push FP[-5]
LoadFieldTOS CP#15
PopLocal r0
Push r0
LoadFieldTOS CP#7
LoadFieldTOS CP#0
PushConstant CP#16
IndirectStaticCall 1, CP#9
Drop1
Push r0
LoadFieldTOS CP#0
PushConstant CP#17
IndirectStaticCall 1, CP#9
Drop1
PushConstant CP#18
ReturnTOS
}
]static method testTryFinally2(core::int x) dynamic {
#L2:
switch(x) {
#L3:
case 1:
{
try {
core::print("before try 1");
core::int y = 3;
try {
core::print("try");
function foo() void {
core::print(x);
core::print(y);
}
foo.call();
continue #L4;
}
finally {
core::print("finally 1");
}
core::print("after try 1");
}
finally {
core::print("finally 2");
}
break #L2;
}
#L4:
case 2:
{
core::print("case 2");
break #L2;
}
}
}
[@vm.bytecode=
Bytecode {
Entry 6
CheckStack
AllocateContext 1
StoreLocal r1
Push r1
Push r0
StoreFieldTOS CP#0
PopLocal r0
Push r0
PushConstant CP#1
StoreFieldTOS CP#2
PushConstant CP#3
PopLocal r2
Push r0
PopLocal r3
Try #0 start:
Allocate CP#27
StoreLocal r5
Push r5
PushConstant CP#3
StoreFieldTOS CP#28
Push r5
PushConstant CP#3
StoreFieldTOS CP#29
Push r5
PushConstant CP#4
StoreFieldTOS CP#30
Push r5
Push r0
StoreFieldTOS CP#5
PopLocal r2
Jump L1
Try #0 end:
Try #0 handler:
Push r3
PopLocal r0
MoveSpecial r3, exception
MoveSpecial r4, stackTrace
Push r0
LoadFieldTOS CP#2
PushConstant CP#31
IndirectStaticCall 1, CP#6
Drop1
Push r2
InstanceCall1 1, CP#32
Drop1
Push r3
Push r4
Throw 1
L1:
Push r3
PopLocal r0
Push r0
LoadFieldTOS CP#2
PushConstant CP#33
IndirectStaticCall 1, CP#6
Drop1
Push r2
InstanceCall1 1, CP#34
Drop1
Push r0
LoadFieldTOS CP#0
PopLocal r0
PushConstant CP#3
ReturnTOS
}
ExceptionsTable {
try-index 0, outer -1, start 15, end 31, handler 31, needs-stack-trace, types [CP#11]
}
ConstantPool {
[0] = ContextOffset parent
[1] = Int 11
[2] = ContextOffset var [0]
[3] = Null
[4] = ClosureFunction <anonymous closure> () dart.core::int;
[5] = FieldOffset dart.core::_Closure::_context
[6] = ArgDesc num-args 1, num-type-args 0, names []
[7] = StaticICData target 'dart.core::print', arg-desc CP#6
[8] = String 'try 1'
[9] = StaticICData target 'dart.core::print', arg-desc CP#6
[10] = Int 42
[11] = Type dynamic
[12] = String 'try 2'
[13] = StaticICData target 'dart.core::print', arg-desc CP#6
[14] = Int 43
[15] = StaticICData target 'dart.core::print', arg-desc CP#6
[16] = StaticICData target 'dart.core::print', arg-desc CP#6
[17] = StaticICData target 'dart.core::print', arg-desc CP#6
[18] = StaticICData target 'dart.core::print', arg-desc CP#6
[19] = StaticICData target 'dart.core::print', arg-desc CP#6
[20] = StaticICData target 'dart.core::print', arg-desc CP#6
[21] = StaticICData target 'dart.core::print', arg-desc CP#6
[22] = StaticICData target 'dart.core::print', arg-desc CP#6
[23] = StaticICData target 'dart.core::print', arg-desc CP#6
[24] = StaticICData target 'dart.core::print', arg-desc CP#6
[25] = StaticICData target 'dart.core::print', arg-desc CP#6
[26] = EndClosureFunctionScope
[27] = Class dart.core::_Closure
[28] = FieldOffset dart.core::_Closure::_instantiator_type_arguments
[29] = FieldOffset dart.core::_Closure::_function_type_arguments
[30] = FieldOffset dart.core::_Closure::_function
[31] = StaticICData target 'dart.core::print', arg-desc CP#6
[32] = ICData target-name 'call', arg-desc CP#6
[33] = StaticICData target 'dart.core::print', arg-desc CP#6
[34] = ICData target-name 'call', arg-desc CP#6
}
Closure CP#4 {
Entry 6
CheckStack
Push FP[-5]
LoadFieldTOS CP#5
PopLocal r0
Push r0
LoadFieldTOS CP#2
PushConstant CP#7
IndirectStaticCall 1, CP#6
Drop1
Push r0
PopLocal r2
Try #0 start:
PushConstant CP#8
PushConstant CP#9
IndirectStaticCall 1, CP#6
Drop1
PushConstant CP#10
Jump L1
Jump L2
Try #0 end:
Try #0 handler:
Push r2
PopLocal r0
MoveSpecial r2, exception
MoveSpecial r3, stackTrace
Push r0
PopLocal r4
Try #1 start:
PushConstant CP#12
PushConstant CP#13
IndirectStaticCall 1, CP#6
Drop1
PushConstant CP#14
Jump L3
Jump L4
Try #1 end:
Try #1 handler:
Push r4
PopLocal r0
MoveSpecial r4, exception
MoveSpecial r5, stackTrace
Push r0
LoadFieldTOS CP#2
PushConstant CP#15
IndirectStaticCall 1, CP#6
Drop1
Push r4
Push r5
Throw 1
L3:
Push r4
PopLocal r0
Push r0
LoadFieldTOS CP#2
PushConstant CP#16
IndirectStaticCall 1, CP#6
Drop1
ReturnTOS
L4:
Push r4
PopLocal r0
Push r0
LoadFieldTOS CP#2
PushConstant CP#17
IndirectStaticCall 1, CP#6
Drop1
Push r2
Push r3
Throw 1
L1:
Push r2
PopLocal r0
Push r0
PopLocal r4
Try #2 start:
PushConstant CP#12
PushConstant CP#18
IndirectStaticCall 1, CP#6
Drop1
PushConstant CP#14
Jump L5
Jump L6
Try #2 end:
Try #2 handler:
Push r4
PopLocal r0
MoveSpecial r4, exception
MoveSpecial r5, stackTrace
Push r0
LoadFieldTOS CP#2
PushConstant CP#19
IndirectStaticCall 1, CP#6
Drop1
Push r4
Push r5
Throw 1
L5:
Push r4
PopLocal r0
Push r0
LoadFieldTOS CP#2
PushConstant CP#20
IndirectStaticCall 1, CP#6
Drop1
ReturnTOS
L6:
Push r4
PopLocal r0
Push r0
LoadFieldTOS CP#2
PushConstant CP#21
IndirectStaticCall 1, CP#6
Drop1
ReturnTOS
L2:
Push r2
PopLocal r0
Push r0
PopLocal r4
Try #3 start:
PushConstant CP#12
PushConstant CP#22
IndirectStaticCall 1, CP#6
Drop1
PushConstant CP#14
Jump L7
Jump L8
Try #3 end:
Try #3 handler:
Push r4
PopLocal r0
MoveSpecial r4, exception
MoveSpecial r5, stackTrace
Push r0
LoadFieldTOS CP#2
PushConstant CP#23
IndirectStaticCall 1, CP#6
Drop1
Push r4
Push r5
Throw 1
L7:
Push r4
PopLocal r0
Push r0
LoadFieldTOS CP#2
PushConstant CP#24
IndirectStaticCall 1, CP#6
Drop1
ReturnTOS
L8:
Push r4
PopLocal r0
Push r0
LoadFieldTOS CP#2
PushConstant CP#25
IndirectStaticCall 1, CP#6
Drop1
PushConstant CP#3
ReturnTOS
}
]static method testTryFinally3() dynamic {
core::int x = 11;
dynamic y;
try {
y = () core::int {
core::print(x);
try {
core::print("try 1");
return 42;
}
finally {
try {
core::print("try 2");
return 43;
}
finally {
core::print(x);
}
}
};
}
finally {
core::print(x);
y.call();
}
}
[@vm.bytecode=
Bytecode {
Entry 5
CheckStack
Try #0 start:
Try #1 start:
PushConstant CP#0
PushConstant CP#2
IndirectStaticCall 1, CP#1
Drop1
Jump L1
Try #1 end:
Try #1 handler:
MoveSpecial r2, exception
MoveSpecial r3, stackTrace
Push r2
PopLocal r4
PushConstant CP#4
PushConstant CP#5
IndirectStaticCall 1, CP#1
Drop1
Jump L1
L1:
Jump L2
Try #0 end:
Try #0 handler:
MoveSpecial r0, exception
MoveSpecial r1, stackTrace
PushConstant CP#6
PushConstant CP#7
IndirectStaticCall 1, CP#1
Drop1
Push r0
Push r1
Throw 1
L2:
PushConstant CP#6
PushConstant CP#8
IndirectStaticCall 1, CP#1
Drop1
PushConstant CP#9
ReturnTOS
}
ExceptionsTable {
try-index 0, outer -1, start 2, end 17, handler 17, needs-stack-trace, types [CP#3]
try-index 1, outer 0, start 2, end 7, handler 7, types [CP#3]
}
ConstantPool {
[0] = String 'try'
[1] = ArgDesc num-args 1, num-type-args 0, names []
[2] = StaticICData target 'dart.core::print', arg-desc CP#1
[3] = Type dynamic
[4] = String 'catch'
[5] = StaticICData target 'dart.core::print', arg-desc CP#1
[6] = String 'finally'
[7] = StaticICData target 'dart.core::print', arg-desc CP#1
[8] = StaticICData target 'dart.core::print', arg-desc CP#1
[9] = Null
}
]static method testTryCatchFinally() dynamic {
try
try {
core::print("try");
}
on dynamic catch(final dynamic e) {
core::print("catch");
}
finally {
core::print("finally");
}
}
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = Null
}
]static method main() dynamic {}