Index: runtime/vm/intermediate_language.h |
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h |
index 823f4774b718309cd26bfb9df3363c42e2245f6f..4ab0b04eb28b7de11c01ec40c30e153c454a9939 100644 |
--- a/runtime/vm/intermediate_language.h |
+++ b/runtime/vm/intermediate_language.h |
@@ -2714,6 +2714,7 @@ class ClosureCallInstr : public TemplateDefinition<1, Throws> { |
ClosureCallNode* node, |
ZoneGrowableArray<PushArgumentInstr*>* arguments) |
: TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
+ type_args_len_(node->arguments()->type_args_len()), |
argument_names_(node->arguments()->names()), |
token_pos_(node->token_pos()), |
arguments_(arguments) { |
@@ -2722,9 +2723,11 @@ class ClosureCallInstr : public TemplateDefinition<1, Throws> { |
ClosureCallInstr(Value* function, |
ZoneGrowableArray<PushArgumentInstr*>* arguments, |
+ intptr_t type_args_len, |
const Array& argument_names, |
TokenPosition token_pos) |
: TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
+ type_args_len_(type_args_len), |
argument_names_(argument_names), |
token_pos_(token_pos), |
arguments_(arguments) { |
@@ -2733,9 +2736,11 @@ class ClosureCallInstr : public TemplateDefinition<1, Throws> { |
DECLARE_INSTRUCTION(ClosureCall) |
+ intptr_t type_args_len() const { return type_args_len_; } |
const Array& argument_names() const { return argument_names_; } |
virtual TokenPosition token_pos() const { return token_pos_; } |
+ // ArgumentCount() includes the type argument vector if any. |
virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
return (*arguments_)[index]; |
@@ -2751,6 +2756,7 @@ class ClosureCallInstr : public TemplateDefinition<1, Throws> { |
PRINT_OPERANDS_TO_SUPPORT |
private: |
+ intptr_t type_args_len_; |
Vyacheslav Egorov (Google)
2017/05/04 12:12:23
I suggest the following refactoring of call instru
regis
2017/05/09 18:31:23
Done.
|
const Array& argument_names_; |
TokenPosition token_pos_; |
ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
@@ -2765,6 +2771,7 @@ class InstanceCallInstr : public TemplateDefinition<0, Throws> { |
const String& function_name, |
Token::Kind token_kind, |
ZoneGrowableArray<PushArgumentInstr*>* arguments, |
+ intptr_t type_args_len, |
const Array& argument_names, |
intptr_t checked_argument_count, |
const ZoneGrowableArray<const ICData*>& ic_data_array) |
@@ -2774,6 +2781,7 @@ class InstanceCallInstr : public TemplateDefinition<0, Throws> { |
function_name_(function_name), |
token_kind_(token_kind), |
arguments_(arguments), |
+ type_args_len_(type_args_len), |
argument_names_(argument_names), |
checked_argument_count_(checked_argument_count), |
has_unique_selector_(false) { |
@@ -2802,10 +2810,12 @@ class InstanceCallInstr : public TemplateDefinition<0, Throws> { |
virtual TokenPosition token_pos() const { return token_pos_; } |
const String& function_name() const { return function_name_; } |
Token::Kind token_kind() const { return token_kind_; } |
+ // ArgumentCount() includes the type argument vector if any. |
virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
return (*arguments_)[index]; |
} |
+ intptr_t type_args_len() const { return type_args_len_; } |
const Array& argument_names() const { return argument_names_; } |
intptr_t checked_argument_count() const { return checked_argument_count_; } |
@@ -2838,6 +2848,7 @@ class InstanceCallInstr : public TemplateDefinition<0, Throws> { |
const String& function_name_; |
const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. |
ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
+ intptr_t type_args_len_; |
const Array& argument_names_; |
const intptr_t checked_argument_count_; |
bool has_unique_selector_; |
@@ -2889,9 +2900,9 @@ class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { |
virtual intptr_t CallCount() const; |
// If this polymophic call site was created to cover the remaining cids after |
- // inlinng then we need to keep track of the total number of calls including |
- // the ones that wer inlined. This is different from the CallCount above: Eg |
- // if there were 100 calls originally, distributed across three class-ids in |
+ // inlining then we need to keep track of the total number of calls including |
+ // the ones that we inlined. This is different from the CallCount above: Eg |
+ // if there were 100 calls originally, distributed across three class-ids in |
// the ratio 50, 40, 7, 3. The first two were inlined, so now we have only |
// 10 calls in the CallCount above, but the heuristics need to know that the |
// last two cids cover 7% and 3% of the calls, not 70% and 30%. |
@@ -3222,6 +3233,7 @@ class StaticCallInstr : public TemplateDefinition<0, Throws> { |
public: |
StaticCallInstr(TokenPosition token_pos, |
const Function& function, |
+ intptr_t type_args_len, |
const Array& argument_names, |
ZoneGrowableArray<PushArgumentInstr*>* arguments, |
const ZoneGrowableArray<const ICData*>& ic_data_array) |
@@ -3229,6 +3241,7 @@ class StaticCallInstr : public TemplateDefinition<0, Throws> { |
ic_data_(NULL), |
token_pos_(token_pos), |
function_(function), |
+ type_args_len_(type_args_len), |
argument_names_(argument_names), |
arguments_(arguments), |
result_cid_(kDynamicCid), |
@@ -3242,6 +3255,7 @@ class StaticCallInstr : public TemplateDefinition<0, Throws> { |
StaticCallInstr(TokenPosition token_pos, |
const Function& function, |
+ intptr_t type_args_len, |
const Array& argument_names, |
ZoneGrowableArray<PushArgumentInstr*>* arguments, |
intptr_t deopt_id) |
@@ -3249,6 +3263,7 @@ class StaticCallInstr : public TemplateDefinition<0, Throws> { |
ic_data_(NULL), |
token_pos_(token_pos), |
function_(function), |
+ type_args_len_(type_args_len), |
argument_names_(argument_names), |
arguments_(arguments), |
result_cid_(kDynamicCid), |
@@ -3271,9 +3286,11 @@ class StaticCallInstr : public TemplateDefinition<0, Throws> { |
// Accessors forwarded to the AST node. |
const Function& function() const { return function_; } |
+ intptr_t type_args_len() const { return type_args_len_; } |
const Array& argument_names() const { return argument_names_; } |
virtual TokenPosition token_pos() const { return token_pos_; } |
+ // ArgumentCount() includes the type argument vector if any. |
virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
return (*arguments_)[index]; |
@@ -3311,6 +3328,7 @@ class StaticCallInstr : public TemplateDefinition<0, Throws> { |
const ICData* ic_data_; |
const TokenPosition token_pos_; |
const Function& function_; |
+ intptr_t type_args_len_; |
const Array& argument_names_; |
ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
intptr_t result_cid_; // For some library functions we know the result. |
@@ -6735,6 +6753,7 @@ class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { |
Value* right, |
InstanceCallInstr* call) |
: TemplateDefinition(call->deopt_id()), call_(call), op_kind_(op_kind) { |
+ ASSERT(call->type_args_len() == 0); |
SetInputAt(0, left); |
SetInputAt(1, right); |
} |
@@ -6770,6 +6789,7 @@ class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> { |
: TemplateComparison(call->token_pos(), op_kind, call->deopt_id()), |
call_(call), |
is_negated_(false) { |
+ ASSERT(call->type_args_len() == 0); |
SetInputAt(0, left); |
SetInputAt(1, right); |
} |