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

Issue 11746024: Optimize instanceof: if all results are true and tests can be done using class only replace instanc… (Closed)

Created:
7 years, 11 months ago by srdjan
Modified:
7 years, 11 months ago
CC:
reviews_dartlang.org, Florian Schneider
Visibility:
Public.

Description

Optimize instanceof: if all results are true and tests can be done using class only replace instanceof with a Boolean constant. Committed: https://code.google.com/p/dart/source/detail?r=16648

Patch Set 1 #

Patch Set 2 : #

Total comments: 4

Patch Set 3 : #

Total comments: 4

Patch Set 4 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -3 lines) Patch
M runtime/vm/flow_graph_optimizer.h View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_optimizer.cc View 1 2 3 2 chunks +52 lines, -3 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
srdjan
7 years, 11 months ago (2013-01-03 23:18:50 UTC) #1
regis
https://codereview.chromium.org/11746024/diff/3001/runtime/vm/flow_graph_optimizer.cc File runtime/vm/flow_graph_optimizer.cc (right): https://codereview.chromium.org/11746024/diff/3001/runtime/vm/flow_graph_optimizer.cc#newcode1258 runtime/vm/flow_graph_optimizer.cc:1258: if (!type.IsInstantiated()) return Bool::null(); I suppose there is no ...
7 years, 11 months ago (2013-01-03 23:35:26 UTC) #2
srdjan
Please have another look https://codereview.chromium.org/11746024/diff/3001/runtime/vm/flow_graph_optimizer.cc File runtime/vm/flow_graph_optimizer.cc (right): https://codereview.chromium.org/11746024/diff/3001/runtime/vm/flow_graph_optimizer.cc#newcode1258 runtime/vm/flow_graph_optimizer.cc:1258: if (!type.IsInstantiated()) return Bool::null(); On ...
7 years, 11 months ago (2013-01-04 00:10:55 UTC) #3
regis
LGTM, except the TODO(regis) :-) https://codereview.chromium.org/11746024/diff/8001/runtime/vm/flow_graph_optimizer.cc File runtime/vm/flow_graph_optimizer.cc (right): https://codereview.chromium.org/11746024/diff/8001/runtime/vm/flow_graph_optimizer.cc#newcode1267 runtime/vm/flow_graph_optimizer.cc:1267: // TODO(regis): Fix Class::TypeTest ...
7 years, 11 months ago (2013-01-04 01:39:16 UTC) #4
Florian Schneider
style dbc: https://codereview.chromium.org/11746024/diff/8001/runtime/vm/flow_graph_optimizer.cc File runtime/vm/flow_graph_optimizer.cc (right): https://codereview.chromium.org/11746024/diff/8001/runtime/vm/flow_graph_optimizer.cc#newcode1295 runtime/vm/flow_graph_optimizer.cc:1295: const Bool& negate = Maybe just bool ...
7 years, 11 months ago (2013-01-04 11:35:41 UTC) #5
srdjan
7 years, 11 months ago (2013-01-04 21:10:25 UTC) #6
https://codereview.chromium.org/11746024/diff/8001/runtime/vm/flow_graph_opti...
File runtime/vm/flow_graph_optimizer.cc (right):

https://codereview.chromium.org/11746024/diff/8001/runtime/vm/flow_graph_opti...
runtime/vm/flow_graph_optimizer.cc:1267: // TODO(regis): Fix Class::TypeTest to
support NullClass.
On 2013/01/04 01:39:16, regis wrote:
> I am pretty sure that Class::TypeTest is supporting NullClass properly. There
is
> a difference between "is subtype of", which applies to types and "is an
instance
> of", which applies to instances. Class::TypeTest() implements both "is a
subtype
> of" or "is more specific than" (according to the flag passed in), but not "is
an
> instance of".
> Please note that null is an instance of Object (and of dynamic), but Null is
not
> a subtype of Object (or of any type).
> This is why Instance::IsInstanceOf handles these special cases before calling
> Class::IsSubTypeOf.

Removed TODO. Discussed off-line changes to Class::TypeTest.

https://codereview.chromium.org/11746024/diff/8001/runtime/vm/flow_graph_opti...
runtime/vm/flow_graph_optimizer.cc:1295: const Bool& negate =
On 2013/01/04 11:35:41, Florian Schneider wrote:
> Maybe just
> 
> bool negate =
>   Bool::Cast(call->ArgumentAt(4)->value()->BoundConstant()).value()
> 
> and substitute negate.value() with just negate below.

Done.

Powered by Google App Engine
This is Rietveld 408576698