Files
sdk/pkg/vm/testcases/bytecode/switch.dart.expect
T
Alexander Markov 1b66c0a78c [vm/kernel/bytecode] Remove extra pushes/drops for Set expressions with unused result
Also, bytecode generation of DirectPropertySet and SuperPropertySet is
corrected in case result is used.

Change-Id: I680645f961d9c471579dcbdc9a5b7544cbc9e188
Reviewed-on: https://dart-review.googlesource.com/63343
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-07-02 18:27:23 +00:00

320 lines
6.4 KiB
Plaintext

library #lib;
import self as self;
import "dart:core" as core;
[@vm.bytecode=
Bytecode {
Entry 2
CheckStack
PushConstant CP#0
PopLocal r0
Push FP[-5]
PopLocal r1
Push r1
PushConstant CP#2
InstanceCall1 2, CP#3
PushConstant CP#4
IfEqStrictTOS
Jump L1
Push r1
PushConstant CP#5
InstanceCall1 2, CP#6
PushConstant CP#4
IfEqStrictTOS
Jump L2
Push r1
PushConstant CP#7
InstanceCall1 2, CP#8
PushConstant CP#4
IfEqStrictTOS
Jump L3
Jump L4
L1:
PushConstant CP#9
PopLocal r0
Jump L4
L2:
PushConstant CP#10
PopLocal r0
Jump L4
L3:
PushConstant CP#11
PopLocal r0
Jump L4
L4:
Push r0
ReturnTOS
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = Null
[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] = Int 3
[8] = ICData target-name '==', arg-desc CP#1
[9] = Int 11
[10] = Int 22
[11] = Int 33
}
]static method foo1(core::int x) → core::int {
core::int y;
#L1:
switch(x) {
#L2:
case 1:
{
y = 11;
break #L1;
}
#L3:
case 2:
{
y = 22;
break #L1;
}
#L4:
case 3:
{
y = 33;
break #L1;
}
}
return y;
}
[@vm.bytecode=
Bytecode {
Entry 2
CheckStack
PushConstant CP#0
PopLocal r0
Push FP[-5]
PopLocal r1
Push r1
PushConstant CP#2
InstanceCall1 2, CP#3
PushConstant CP#4
IfEqStrictTOS
Jump L1
Push r1
PushConstant CP#5
InstanceCall1 2, CP#6
PushConstant CP#4
IfEqStrictTOS
Jump L1
Push r1
PushConstant CP#7
InstanceCall1 2, CP#8
PushConstant CP#4
IfEqStrictTOS
Jump L1
Push r1
PushConstant CP#9
InstanceCall1 2, CP#10
PushConstant CP#4
IfEqStrictTOS
Jump L2
Push r1
PushConstant CP#11
InstanceCall1 2, CP#12
PushConstant CP#4
IfEqStrictTOS
Jump L2
Push r1
PushConstant CP#13
InstanceCall1 2, CP#14
PushConstant CP#4
IfEqStrictTOS
Jump L2
Jump L3
L1:
PushConstant CP#15
PopLocal r0
Jump L4
L2:
PushConstant CP#16
PopLocal r0
Jump L4
L3:
PushConstant CP#17
PopLocal r0
L4:
Push r0
ReturnTOS
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = Null
[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] = Int 3
[8] = ICData target-name '==', arg-desc CP#1
[9] = Int 4
[10] = ICData target-name '==', arg-desc CP#1
[11] = Int 5
[12] = ICData target-name '==', arg-desc CP#1
[13] = Int 6
[14] = ICData target-name '==', arg-desc CP#1
[15] = Int 11
[16] = Int 22
[17] = Int 33
}
]static method foo2(core::int x) → core::int {
core::int y;
#L5:
switch(x) {
#L6:
case 1:
case 2:
case 3:
{
y = 11;
break #L5;
}
#L7:
case 4:
case 5:
case 6:
{
y = 22;
break #L5;
}
#L8:
default:
{
y = 33;
}
}
return y;
}
[@vm.bytecode=
Bytecode {
Entry 2
CheckStack
PushConstant CP#0
PopLocal r0
Push FP[-5]
PopLocal r1
Push r1
PushConstant CP#2
InstanceCall1 2, CP#3
PushConstant CP#4
IfEqStrictTOS
Jump L1
Push r1
PushConstant CP#5
InstanceCall1 2, CP#6
PushConstant CP#4
IfEqStrictTOS
Jump L1
Push r1
PushConstant CP#7
InstanceCall1 2, CP#8
PushConstant CP#4
IfEqStrictTOS
Jump L1
Push r1
PushConstant CP#9
InstanceCall1 2, CP#10
PushConstant CP#4
IfEqStrictTOS
Jump L2
Push r1
PushConstant CP#11
InstanceCall1 2, CP#12
PushConstant CP#4
IfEqStrictTOS
Jump L2
Push r1
PushConstant CP#13
InstanceCall1 2, CP#14
PushConstant CP#4
IfEqStrictTOS
Jump L2
Jump L3
L1:
PushConstant CP#15
PopLocal r0
Jump L2
L2:
PushConstant CP#16
PopLocal r0
PushConstant CP#17
ReturnTOS
L3:
PushConstant CP#18
PopLocal r0
Push r0
ReturnTOS
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = Null
[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] = Int 3
[8] = ICData target-name '==', arg-desc CP#1
[9] = Int 4
[10] = ICData target-name '==', arg-desc CP#1
[11] = Int 5
[12] = ICData target-name '==', arg-desc CP#1
[13] = Int 6
[14] = ICData target-name '==', arg-desc CP#1
[15] = Int 11
[16] = Int 22
[17] = Int 42
[18] = Int 33
}
]static method foo3(core::int x) → core::int {
core::int y;
switch(x) {
#L9:
case 1:
case 2:
case 3:
{
y = 11;
continue #L10;
}
#L10:
case 4:
case 5:
case 6:
{
y = 22;
return 42;
}
#L11:
default:
{
y = 33;
}
}
return y;
}
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = Null
}
]static method main() → dynamic {}