Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Issue 2955073005: VM-codegen: Add IL instruction to check if a Smi is in a constant range

Created:
3 years, 5 months ago by erikcorry
Modified:
3 years, 5 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

VM-codegen: Add IL instruction to check if a Smi is in a constant range. This instruction has a single comparison and branch and is used to check whether a class-ID is withing a range. This is used in the polymorphic inliner. R=vegorov@google.com BUG=

Patch Set 1 #

Total comments: 10

Patch Set 2 : Remove unrelated change and other Slava feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+223 lines, -62 lines) Patch
M runtime/vm/constant_propagator.cc View 1 1 chunk +16 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_inliner.cc View 3 chunks +10 lines, -62 lines 0 comments Download
M runtime/vm/flow_graph_type_propagator.cc View 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/il_printer.cc View 1 1 chunk +16 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language.h View 1 2 chunks +49 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language.cc View 1 1 chunk +18 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_arm.cc View 1 1 chunk +21 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_arm64.cc View 1 1 chunk +21 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_dbc.cc View 1 1 chunk +20 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_ia32.cc View 1 1 chunk +23 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language_x64.cc View 1 1 chunk +24 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (3 generated)
erikcorry
3 years, 5 months ago (2017-06-28 08:07:41 UTC) #1
Vyacheslav Egorov (Google)
LGTM with this change split in two (instruction separately from abstract class fix). Also please ...
3 years, 5 months ago (2017-06-28 13:53:47 UTC) #2
erikcorry
3 years, 5 months ago (2017-07-03 08:59:56 UTC) #6
https://codereview.chromium.org/2955073005/diff/1/runtime/vm/constant_propaga...
File runtime/vm/constant_propagator.cc (right):

https://codereview.chromium.org/2955073005/diff/1/runtime/vm/constant_propaga...
runtime/vm/constant_propagator.cc:441: if (number < instr->from() || instr->to()
< number) {
On 2017/06/28 13:53:47, Vyacheslav Egorov (Google) wrote:
> maybe better:
> 
> bool result = instr->from() <= number && number < instr->to();
> if (instr->is_negated()) { result = !result; }
> 
> SetValue(instr, Bool::Get(result));
> 
> 

Done, but with <= because to() is inclusive.

https://codereview.chromium.org/2955073005/diff/1/runtime/vm/flow_graph_compi...
File runtime/vm/flow_graph_compiler.h (right):

https://codereview.chromium.org/2955073005/diff/1/runtime/vm/flow_graph_compi...
runtime/vm/flow_graph_compiler.h:608: static bool LookupMethodFor(int class_id,
On 2017/06/28 13:53:47, Vyacheslav Egorov (Google) wrote:
> If possible please exclude abstract class change from this CL as it is not
> directly related.
> 
> I would like to keep CL minimal (e.g. they solve one particular problem).

Done.

https://codereview.chromium.org/2955073005/diff/1/runtime/vm/intermediate_lan...
File runtime/vm/intermediate_language.h (right):

https://codereview.chromium.org/2955073005/diff/1/runtime/vm/intermediate_lan...
runtime/vm/intermediate_language.h:6976: : TemplateComparison(token_pos,
Token::kIS, Thread::kNoDeoptId),
On 2017/06/28 13:53:47, Vyacheslav Egorov (Google) wrote:
> Please comment here why Token::kIS makes sense for this instruction. 

Done.

https://codereview.chromium.org/2955073005/diff/1/runtime/vm/intermediate_lan...
runtime/vm/intermediate_language.h:6994: bool is_negated() const { return
is_negated_; }
On 2017/06/28 13:53:47, Vyacheslav Egorov (Google) wrote:
> I think you don't need is_negated_ member:
> 
> is_negated() => op_kind() == Token::kIS_NOT;

Done.

https://codereview.chromium.org/2955073005/diff/1/runtime/vm/intermediate_lan...
runtime/vm/intermediate_language.h:7011: intptr_t from_;
On 2017/06/28 13:53:47, Vyacheslav Egorov (Google) wrote:
> const intptr_t from_; 
> const intptr_t to_;
> 
> Also you need to override AttributesEqual otherwise CSE will think that all
> SmiRangeComparisonInstr are the same.

Done.

Powered by Google App Engine
This is Rietveld 408576698