Files
sdk/pkg/vm/testcases/bytecode/switch.dart.expect
T
Alexander Markov 68de477535 [vm/bytecode] Compact encoding of bytecode instructions (part 3/3)
Corresponding VM changes:
https://dart-review.googlesource.com/c/sdk/+/101062

On a large app, size of bytecode instructions:
Before: 12115384
After: 6282376 (-48.1%)

Total size of the app:
Before: 29790240
After: 23681504 (-20.5%)

Change-Id: Idd8f97e991236c25d663d1bcf18a51a53e73a2b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99400
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-05-08 17:33:15 +00:00

278 lines
5.3 KiB
Plaintext

main = #lib::main;
[@vm.bytecode=
ComponentBytecodeMetadata {
Bytecode (version: stable)
Main library: #lib
}
] [@vm.bytecode=
MembersBytecodeMetadata {
Members {
Function 'foo1', static, reflectable, debuggable
parameters [dart:core::int 'x'] (required: 1)
return-type dart:core::int
Bytecode {
Entry 2
CheckStack 0
PushNull
PopLocal r0
Push FP[-5]
PopLocal r1
Push r1
PushInt 1
InterfaceCall CP#0, 2
JumpIfTrue L1
Push r1
PushInt 2
InterfaceCall CP#0, 2
JumpIfTrue L2
Push r1
PushInt 3
InterfaceCall CP#0, 2
JumpIfTrue L3
Jump L4
L1:
PushInt 11
PopLocal r0
Jump L4
L2:
PushInt 22
PopLocal r0
Jump L4
L3:
PushInt 33
PopLocal r0
Jump L4
L4:
Push r0
ReturnTOS
}
ConstantPool {
[0] = InterfaceCall 'dart:core::Object::==', ArgDesc num-args 2, num-type-args 0, names []
[1] = Reserved
}
Function 'foo2', static, reflectable, debuggable
parameters [dart:core::int 'x'] (required: 1)
return-type dart:core::int
Bytecode {
Entry 2
CheckStack 0
PushNull
PopLocal r0
Push FP[-5]
PopLocal r1
Push r1
PushInt 1
InterfaceCall CP#0, 2
JumpIfTrue L1
Push r1
PushInt 2
InterfaceCall CP#0, 2
JumpIfTrue L1
Push r1
PushInt 3
InterfaceCall CP#0, 2
JumpIfTrue L1
Push r1
PushInt 4
InterfaceCall CP#0, 2
JumpIfTrue L2
Push r1
PushInt 5
InterfaceCall CP#0, 2
JumpIfTrue L2
Push r1
PushInt 6
InterfaceCall CP#0, 2
JumpIfTrue L2
Jump L3
L1:
PushInt 11
PopLocal r0
Jump L4
L2:
PushInt 22
PopLocal r0
Jump L4
L3:
PushInt 33
PopLocal r0
L4:
Push r0
ReturnTOS
}
ConstantPool {
[0] = InterfaceCall 'dart:core::Object::==', ArgDesc num-args 2, num-type-args 0, names []
[1] = Reserved
}
Function 'foo3', static, reflectable, debuggable
parameters [dart:core::int 'x'] (required: 1)
return-type dart:core::int
Bytecode {
Entry 2
CheckStack 0
PushNull
PopLocal r0
Push FP[-5]
PopLocal r1
Push r1
PushInt 1
InterfaceCall CP#0, 2
JumpIfTrue L1
Push r1
PushInt 2
InterfaceCall CP#0, 2
JumpIfTrue L1
Push r1
PushInt 3
InterfaceCall CP#0, 2
JumpIfTrue L1
Push r1
PushInt 4
InterfaceCall CP#0, 2
JumpIfTrue L2
Push r1
PushInt 5
InterfaceCall CP#0, 2
JumpIfTrue L2
Push r1
PushInt 6
InterfaceCall CP#0, 2
JumpIfTrue L2
Jump L3
L1:
PushInt 11
PopLocal r0
Jump L2
L2:
PushInt 22
PopLocal r0
PushInt 42
ReturnTOS
L3:
PushInt 33
PopLocal r0
Push r0
ReturnTOS
}
ConstantPool {
[0] = InterfaceCall 'dart:core::Object::==', ArgDesc num-args 2, num-type-args 0, names []
[1] = Reserved
}
Function 'main', static, reflectable, debuggable
parameters [] (required: 0)
return-type dynamic
Bytecode {
Entry 0
CheckStack 0
PushNull
ReturnTOS
}
ConstantPool {
}
}
}
]library #lib from "#lib" as #lib {
static method foo1(dart.core::int x) → dart.core::int {
dart.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;
}
static method foo2(dart.core::int x) → dart.core::int {
dart.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;
}
static method foo3(dart.core::int x) → dart.core::int {
dart.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;
}
static method main() → dynamic {}
}