[vm/kernel/bytecode] Fix arguments descriptor for List._fromLiteral call in bytecode

Change-Id: I14a2f92f62918d04be7e7f60d0bc4625e3f85dfa
Reviewed-on: https://dart-review.googlesource.com/69041
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov 2018-08-09 03:47:28 +00:00 committed by commit-bot@chromium.org
parent bd45ec0c4b
commit 88cba7d860
4 changed files with 70 additions and 67 deletions

View file

@ -1359,7 +1359,11 @@ class BytecodeGenerator extends RecursiveVisitor<Null> {
asm.emitStoreIndexedTOS(); asm.emitStoreIndexedTOS();
} }
_genStaticCall(listFromLiteral, new ConstantArgDesc(1, numTypeArgs: 1), 2); // List._fromLiteral is a factory constructor.
// Type arguments passed to a factory constructor are counted as a normal
// argument and not counted in number of type arguments.
assert(listFromLiteral.isFactory);
_genStaticCall(listFromLiteral, new ConstantArgDesc(2, numTypeArgs: 0), 2);
} }
@override @override

View file

@ -260,7 +260,7 @@ ConstantPool {
[27] = Type T7 [27] = Type T7
[28] = Int 7 [28] = Int 7
[29] = Type T8 [29] = Type T8
[30] = ArgDesc num-args 1, num-type-args 1, names [] [30] = ArgDesc num-args 2, num-type-args 0, names []
[31] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#30 [31] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#30
[32] = ArgDesc num-args 1, num-type-args 0, names [] [32] = ArgDesc num-args 1, num-type-args 0, names []
[33] = StaticICData target 'dart.core::print', arg-desc CP#32 [33] = StaticICData target 'dart.core::print', arg-desc CP#32
@ -881,44 +881,44 @@ L2:
Push r0 Push r0
LoadContextVar 0 LoadContextVar 0
PushConstant CP#5 PushConstant CP#5
InstanceCall1 2, CP#7 InstanceCall1 2, CP#6
AssertBoolean 0 AssertBoolean 0
PushConstant CP#8 PushConstant CP#7
IfNeStrictTOS IfNeStrictTOS
Jump L1 Jump L1
Push r2 Push r2
Allocate CP#15 Allocate CP#14
StoreLocal r3 StoreLocal r3
Push r3 Push r3
PushConstant CP#13 PushConstant CP#12
StoreFieldTOS CP#16 StoreFieldTOS CP#15
Push r3 Push r3
PushConstant CP#13 PushConstant CP#12
StoreFieldTOS CP#18 StoreFieldTOS CP#17
Push r3 Push r3
PushConstant CP#9 PushConstant CP#8
StoreFieldTOS CP#20 StoreFieldTOS CP#19
Push r3 Push r3
Push r0 Push r0
StoreFieldTOS CP#10 StoreFieldTOS CP#9
InstanceCall1 2, CP#22 InstanceCall1 2, CP#21
Drop1 Drop1
Push r4 Push r4
Allocate CP#15 Allocate CP#14
StoreLocal r3 StoreLocal r3
Push r3 Push r3
PushConstant CP#13 PushConstant CP#12
StoreFieldTOS CP#16 StoreFieldTOS CP#15
Push r3 Push r3
PushConstant CP#13 PushConstant CP#12
StoreFieldTOS CP#18 StoreFieldTOS CP#17
Push r3 Push r3
PushConstant CP#23 PushConstant CP#22
StoreFieldTOS CP#20 StoreFieldTOS CP#19
Push r3 Push r3
Push r0 Push r0
StoreFieldTOS CP#10 StoreFieldTOS CP#9
InstanceCall1 2, CP#29 InstanceCall1 2, CP#28
Drop1 Drop1
Push r0 Push r0
CloneContext CloneContext
@ -926,8 +926,8 @@ L2:
Push r0 Push r0
Push r0 Push r0
LoadContextVar 0 LoadContextVar 0
PushConstant CP#30 PushConstant CP#29
InstanceCall1 2, CP#31 InstanceCall1 2, CP#30
StoreLocal r3 StoreLocal r3
StoreContextVar 0 StoreContextVar 0
Push r3 Push r3
@ -940,82 +940,81 @@ L1:
Push r0 Push r0
LoadContextParent LoadContextParent
PopLocal r0 PopLocal r0
PushConstant CP#13 PushConstant CP#12
ReturnTOS ReturnTOS
} }
ConstantPool { ConstantPool {
[0] = Int 0 [0] = Int 0
[1] = TypeArgs [dart.core::Function] [1] = TypeArgs [dart.core::Function]
[2] = ArgDesc num-args 1, num-type-args 1, names [] [2] = ArgDesc num-args 2, num-type-args 0, names []
[3] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#2 [3] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#2
[4] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#2 [4] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#2
[5] = Int 10 [5] = Int 10
[6] = ArgDesc num-args 2, num-type-args 0, names [] [6] = ICData target-name '<', arg-desc CP#2
[7] = ICData target-name '<', arg-desc CP#6 [7] = Bool true
[8] = Bool true [8] = ClosureFunction <anonymous closure> () → dart.core::int;
[9] = ClosureFunction <anonymous closure> () → dart.core::int; [9] = InstanceField dart.core::_Closure::_context
[10] = InstanceField dart.core::_Closure::_context [10] = Reserved
[11] = Reserved [11] = ICData target-name '+', arg-desc CP#2
[12] = ICData target-name '+', arg-desc CP#6 [12] = Null
[13] = Null [13] = EndClosureFunctionScope
[14] = EndClosureFunctionScope [14] = Class dart.core::_Closure
[15] = Class dart.core::_Closure [15] = InstanceField dart.core::_Closure::_instantiator_type_arguments
[16] = InstanceField dart.core::_Closure::_instantiator_type_arguments [16] = Reserved
[17] = Reserved [17] = InstanceField dart.core::_Closure::_function_type_arguments
[18] = InstanceField dart.core::_Closure::_function_type_arguments [18] = Reserved
[19] = Reserved [19] = InstanceField dart.core::_Closure::_function
[20] = InstanceField dart.core::_Closure::_function [20] = Reserved
[21] = Reserved [21] = ICData target-name 'add', arg-desc CP#2
[22] = ICData target-name 'add', arg-desc CP#6 [22] = ClosureFunction <anonymous closure> (dart.core::int ii) → dart.core::Null;
[23] = ClosureFunction <anonymous closure> (dart.core::int ii) → dart.core::Null; [23] = Type dart.core::int
[24] = Type dart.core::int [24] = String 'ii'
[25] = String 'ii' [25] = SubtypeTestCache
[26] = SubtypeTestCache [26] = ICData target-name '+', arg-desc CP#2
[27] = ICData target-name '+', arg-desc CP#6 [27] = EndClosureFunctionScope
[28] = EndClosureFunctionScope [28] = ICData target-name 'add', arg-desc CP#2
[29] = ICData target-name 'add', arg-desc CP#6 [29] = Int 1
[30] = Int 1 [30] = ICData target-name '+', arg-desc CP#2
[31] = ICData target-name '+', arg-desc CP#6
} }
Closure CP#9 { Closure CP#8 {
Entry 2 Entry 2
CheckStack CheckStack
Push FP[-5] Push FP[-5]
LoadFieldTOS CP#10 LoadFieldTOS CP#9
PopLocal r0 PopLocal r0
Push r0 Push r0
LoadContextVar 0 LoadContextVar 0
Push r0 Push r0
LoadContextParent LoadContextParent
LoadContextVar 0 LoadContextVar 0
InstanceCall1 2, CP#12 InstanceCall1 2, CP#11
ReturnTOS ReturnTOS
PushConstant CP#13 PushConstant CP#12
ReturnTOS ReturnTOS
} }
Closure CP#23 { Closure CP#22 {
Entry 3 Entry 3
CheckStack CheckStack
Push FP[-6] Push FP[-6]
LoadFieldTOS CP#10 LoadFieldTOS CP#9
PopLocal r0 PopLocal r0
Push FP[-5] Push FP[-5]
PushConstant CP#13 PushConstant CP#12
PushConstant CP#13 PushConstant CP#12
PushConstant CP#23
PushConstant CP#24 PushConstant CP#24
PushConstant CP#25 AssertAssignable 1, CP#25
AssertAssignable 1, CP#26
Drop1 Drop1
Push r0 Push r0
Push FP[-5] Push FP[-5]
Push r0 Push r0
LoadContextParent LoadContextParent
LoadContextVar 0 LoadContextVar 0
InstanceCall1 2, CP#27 InstanceCall1 2, CP#26
StoreContextVar 0 StoreContextVar 0
PushConstant CP#13 PushConstant CP#12
ReturnTOS ReturnTOS
} }
@ -1417,7 +1416,7 @@ ConstantPool {
[16] = Type #lib::callWithArgs::T7 [16] = Type #lib::callWithArgs::T7
[17] = Int 7 [17] = Int 7
[18] = Type #lib::callWithArgs::T8 [18] = Type #lib::callWithArgs::T8
[19] = ArgDesc num-args 1, num-type-args 1, names [] [19] = ArgDesc num-args 2, num-type-args 0, names []
[20] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#19 [20] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#19
[21] = ArgDesc num-args 1, num-type-args 0, names [] [21] = ArgDesc num-args 1, num-type-args 0, names []
[22] = StaticICData target 'dart.core::print', arg-desc CP#21 [22] = StaticICData target 'dart.core::print', arg-desc CP#21

View file

@ -516,7 +516,7 @@ ConstantPool {
[2] = Int 0 [2] = Int 0
[3] = Int 1 [3] = Int 1
[4] = Int 2 [4] = Int 2
[5] = ArgDesc num-args 1, num-type-args 1, names [] [5] = ArgDesc num-args 2, num-type-args 0, names []
[6] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#5 [6] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#5
[7] = ArgDesc num-args 1, num-type-args 0, names [] [7] = ArgDesc num-args 1, num-type-args 0, names []
[8] = StaticICData target 'dart.core::print', arg-desc CP#7 [8] = StaticICData target 'dart.core::print', arg-desc CP#7

View file

@ -295,7 +295,7 @@ ConstantPool {
[5] = Type dart.core::Map<#lib::D::P, #lib::D::Q> [5] = Type dart.core::Map<#lib::D::P, #lib::D::Q>
[6] = String '' [6] = String ''
[7] = SubtypeTestCache [7] = SubtypeTestCache
[8] = ArgDesc num-args 1, num-type-args 1, names [] [8] = ArgDesc num-args 2, num-type-args 0, names []
[9] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#8 [9] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#8
[10] = SubtypeTestCache [10] = SubtypeTestCache
} }