61f0f5bc43
This change replaces kernel AST declarations of fields and functions with bytecode declarations. Size of dilp files is reduced by 11-12%. Startup latency: Time to the first full frame: 1.945s -> 1.687s FinalizeClass: 554ms -> 277ms FinishClassLoading: 296ms -> 156ms There are following regressions in bytecode mode, which will be fixed in future: * dart:mirrors are not supported yet (implementation of mirrors relies on reading kernel AST in certain cases). As the result, lib_2/mirrors/* tests fail. * native extensions are not supported yet (annotations on libraries and classes in AST are cleaned up as they could reference members which are now removed from AST). As the result, standalone_2/entrypoints_verification_test test fails. * language_2/spread_collections/const_error_test/* tests fail due to https://github.com/dart-lang/sdk/issues/36286. Change-Id: I5130f401fd7b84038b136136e7ccc1a6e51b6cea Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97561 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com>
278 lines
5.3 KiB
Plaintext
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 2, CP#0
|
|
JumpIfTrue L1
|
|
Push r1
|
|
PushInt 2
|
|
InterfaceCall 2, CP#0
|
|
JumpIfTrue L2
|
|
Push r1
|
|
PushInt 3
|
|
InterfaceCall 2, CP#0
|
|
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 2, CP#0
|
|
JumpIfTrue L1
|
|
Push r1
|
|
PushInt 2
|
|
InterfaceCall 2, CP#0
|
|
JumpIfTrue L1
|
|
Push r1
|
|
PushInt 3
|
|
InterfaceCall 2, CP#0
|
|
JumpIfTrue L1
|
|
Push r1
|
|
PushInt 4
|
|
InterfaceCall 2, CP#0
|
|
JumpIfTrue L2
|
|
Push r1
|
|
PushInt 5
|
|
InterfaceCall 2, CP#0
|
|
JumpIfTrue L2
|
|
Push r1
|
|
PushInt 6
|
|
InterfaceCall 2, CP#0
|
|
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 2, CP#0
|
|
JumpIfTrue L1
|
|
Push r1
|
|
PushInt 2
|
|
InterfaceCall 2, CP#0
|
|
JumpIfTrue L1
|
|
Push r1
|
|
PushInt 3
|
|
InterfaceCall 2, CP#0
|
|
JumpIfTrue L1
|
|
Push r1
|
|
PushInt 4
|
|
InterfaceCall 2, CP#0
|
|
JumpIfTrue L2
|
|
Push r1
|
|
PushInt 5
|
|
InterfaceCall 2, CP#0
|
|
JumpIfTrue L2
|
|
Push r1
|
|
PushInt 6
|
|
InterfaceCall 2, CP#0
|
|
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 {}
|
|
}
|