336969538c
* Type arguments are moved to global object table (and de-duplicated). * Finalize non-recursive generic types at bytecode generation time. * Constants are moved to global object table (and de-duplicated). * ICData creation is avoided for direct calls. * Interface calls reference target member instead of selector name. Size of a dilp files: 17868K => 15896K (-11%). Change-Id: I0c9bf338137a0fae6ed90ab6b125ed2b24a1a8ad Reviewed-on: https://dart-review.googlesource.com/c/91108 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Zach Anderson <zra@google.com> Reviewed-by: Régis Crelier <regis@google.com>
349 lines
8.7 KiB
Plaintext
349 lines
8.7 KiB
Plaintext
library #lib;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 2
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
PushInt 0
|
|
PopLocal r1
|
|
L2:
|
|
CheckStack 1
|
|
Push r1
|
|
Push FP[-5]
|
|
InterfaceCall 1, CP#0
|
|
CompareIntLt
|
|
JumpIfFalse L1
|
|
Push r0
|
|
Push FP[-5]
|
|
Push r1
|
|
InterfaceCall 2, CP#2
|
|
AddInt
|
|
PopLocal r0
|
|
Push r1
|
|
PushInt 1
|
|
AddInt
|
|
StoreLocal r1
|
|
Drop1
|
|
Jump L2
|
|
L1:
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
|
|
[3] = Reserved
|
|
}
|
|
]static method test_for(core::List<core::int> list) → core::int {
|
|
core::int sum = 0;
|
|
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}); i = i.{core::num::+}(1)) {
|
|
sum = sum.{core::num::+}(list.{core::List::[]}(i));
|
|
}
|
|
return sum;
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 2
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
PushInt 0
|
|
PopLocal r1
|
|
L3:
|
|
CheckStack 1
|
|
Push r1
|
|
PushInt 0
|
|
CompareIntGe
|
|
JumpIfFalse L1
|
|
Push r1
|
|
Push FP[-5]
|
|
InterfaceCall 1, CP#0
|
|
CompareIntGe
|
|
JumpIfFalse L2
|
|
Jump L1
|
|
L2:
|
|
Push r0
|
|
Push FP[-5]
|
|
Push r1
|
|
InterfaceCall 2, CP#2
|
|
AddInt
|
|
PopLocal r0
|
|
Push r1
|
|
PushInt 1
|
|
AddInt
|
|
StoreLocal r1
|
|
Drop1
|
|
Jump L3
|
|
L1:
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
|
|
[3] = Reserved
|
|
}
|
|
]static method test_for_break(core::List<core::int> list) → core::int {
|
|
core::int sum = 0;
|
|
#L1:
|
|
for (core::int i = 0; i.{core::num::>=}(0); i = i.{core::num::+}(1)) {
|
|
if(i.{core::num::>=}(list.{core::List::length})) {
|
|
break #L1;
|
|
}
|
|
sum = sum.{core::num::+}(list.{core::List::[]}(i));
|
|
}
|
|
return sum;
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 2
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
PushInt 100
|
|
NegateInt
|
|
PopLocal r1
|
|
L4:
|
|
CheckStack 1
|
|
Push r1
|
|
Push FP[-5]
|
|
InterfaceCall 1, CP#0
|
|
CompareIntLt
|
|
JumpIfFalse L1
|
|
Push r1
|
|
PushInt 0
|
|
CompareIntLt
|
|
JumpIfFalse L2
|
|
Jump L3
|
|
L2:
|
|
Push r0
|
|
Push FP[-5]
|
|
Push r1
|
|
InterfaceCall 2, CP#2
|
|
AddInt
|
|
PopLocal r0
|
|
L3:
|
|
Push r1
|
|
PushInt 1
|
|
AddInt
|
|
StoreLocal r1
|
|
Drop1
|
|
Jump L4
|
|
L1:
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
|
|
[3] = Reserved
|
|
}
|
|
]static method test_for_continue(core::List<core::int> list) → core::int {
|
|
core::int sum = 0;
|
|
for (core::int i = 100.{core::int::unary-}(); i.{core::num::<}(list.{core::List::length}); i = i.{core::num::+}(1))
|
|
#L2:
|
|
{
|
|
if(i.{core::num::<}(0)) {
|
|
break #L2;
|
|
}
|
|
sum = sum.{core::num::+}(list.{core::List::[]}(i));
|
|
}
|
|
return sum;
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 4
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
PushInt 0
|
|
PopLocal r1
|
|
L2:
|
|
CheckStack 1
|
|
Push r1
|
|
Push FP[-5]
|
|
InterfaceCall 1, CP#0
|
|
CompareIntLt
|
|
JumpIfFalse L1
|
|
Push r0
|
|
Push FP[-5]
|
|
Push r1
|
|
PopLocal r2
|
|
Push r2
|
|
PushInt 1
|
|
AddInt
|
|
StoreLocal r1
|
|
PopLocal r3
|
|
Push r2
|
|
InterfaceCall 2, CP#2
|
|
AddInt
|
|
PopLocal r0
|
|
Jump L2
|
|
L1:
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
|
|
[3] = Reserved
|
|
}
|
|
]static method test_while(core::List<core::int> list) → core::int {
|
|
core::int sum = 0;
|
|
core::int i = 0;
|
|
while (i.{core::num::<}(list.{core::List::length})) {
|
|
sum = sum.{core::num::+}(list.{core::List::[]}(let final core::int #t1 = i in let final core::int #t2 = i = #t1.{core::num::+}(1) in #t1));
|
|
}
|
|
return sum;
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 2
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
PushInt 0
|
|
PopLocal r1
|
|
L1:
|
|
CheckStack 1
|
|
Push r0
|
|
Push FP[-5]
|
|
Push r1
|
|
InterfaceCall 2, CP#0
|
|
AddInt
|
|
PopLocal r0
|
|
Push r1
|
|
PushInt 1
|
|
AddInt
|
|
PopLocal r1
|
|
Push r1
|
|
Push FP[-5]
|
|
InterfaceCall 1, CP#2
|
|
CompareIntLt
|
|
JumpIfTrue L1
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::List::[]', ArgDesc num-args 2, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::List::get:length', ArgDesc num-args 1, num-type-args 0, names []
|
|
[3] = Reserved
|
|
}
|
|
]static method test_do_while(core::List<core::int> list) → core::int {
|
|
core::int sum = 0;
|
|
core::int i = 0;
|
|
do {
|
|
sum = sum.{core::num::+}(list.{core::List::[]}(i));
|
|
i = i.{core::num::+}(1);
|
|
}
|
|
while (i.{core::num::<}(list.{core::List::length}))
|
|
return sum;
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 3
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
Push FP[-5]
|
|
InterfaceCall 1, CP#0
|
|
PopLocal r1
|
|
L2:
|
|
CheckStack 1
|
|
Push r1
|
|
InterfaceCall 1, CP#2
|
|
JumpIfFalse L1
|
|
Push r1
|
|
InterfaceCall 1, CP#4
|
|
PopLocal r2
|
|
Push r0
|
|
Push r2
|
|
AddInt
|
|
PopLocal r0
|
|
Jump L2
|
|
L1:
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::Iterable::get:iterator', ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::Iterator::moveNext', ArgDesc num-args 1, num-type-args 0, names []
|
|
[3] = Reserved
|
|
[4] = InterfaceCall 'dart:core::Iterator::get:current', ArgDesc num-args 1, num-type-args 0, names []
|
|
[5] = Reserved
|
|
}
|
|
]static method test_for_in(core::List<core::int> list) → core::int {
|
|
core::int sum = 0;
|
|
for (core::int e in list) {
|
|
sum = sum.{core::num::+}(e);
|
|
}
|
|
return sum;
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 4
|
|
CheckStack 0
|
|
PushInt 0
|
|
PopLocal r0
|
|
PushInt 42
|
|
PopLocal r1
|
|
Push FP[-5]
|
|
InterfaceCall 1, CP#0
|
|
PopLocal r2
|
|
L2:
|
|
CheckStack 1
|
|
Push r2
|
|
InterfaceCall 1, CP#2
|
|
JumpIfFalse L1
|
|
Push r2
|
|
InterfaceCall 1, CP#4
|
|
PopLocal r3
|
|
Push r3
|
|
PopLocal r1
|
|
Push r0
|
|
Push r1
|
|
AddInt
|
|
PopLocal r0
|
|
Jump L2
|
|
L1:
|
|
Push r0
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = InterfaceCall 'dart:core::Iterable::get:iterator', ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = Reserved
|
|
[2] = InterfaceCall 'dart:core::Iterator::moveNext', ArgDesc num-args 1, num-type-args 0, names []
|
|
[3] = Reserved
|
|
[4] = InterfaceCall 'dart:core::Iterator::get:current', ArgDesc num-args 1, num-type-args 0, names []
|
|
[5] = Reserved
|
|
}
|
|
]static method test_for_in_with_outer_var(core::List<core::int> list) → core::int {
|
|
core::int sum = 0;
|
|
core::int e = 42;
|
|
for (final core::int #t3 in list) {
|
|
e = #t3;
|
|
sum = sum.{core::num::+}(e);
|
|
}
|
|
return sum;
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
}
|
|
]static method main() → dynamic {}
|