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

Issue 10584009: Refactor the collection of initializer list types (Closed)

Created:
8 years, 6 months ago by Søren Gjesse
Modified:
8 years, 6 months ago
Reviewers:
karlklose, floitsch
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Refactor the collection of initializer list types Instead of storing a boolean to indicate whether a field is only intialized to an integer store the propagated type instead. If different types are encountered for the same field indicate this with HType.UNKNOWN. Also fix a bug in the checking, as potential single type initializers is not the same as known single type initializers. This is in preparation for information on other types than integers. R=floitsch@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=8963

Patch Set 1 #

Patch Set 2 : Moved data structures to backend #

Total comments: 1

Patch Set 3 : Moved data structures to JavaScriptBackend and used Element as key #

Patch Set 4 : Rebased to r8890 #

Patch Set 5 : Minor fix #

Total comments: 12

Patch Set 6 : Addressed last round of comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+78 lines, -80 lines) Patch
M lib/compiler/implementation/compiler.dart View 1 2 3 4 5 4 chunks +65 lines, -1 line 0 comments Download
M lib/compiler/implementation/enqueue.dart View 1 2 chunks +1 line, -8 lines 0 comments Download
M lib/compiler/implementation/ssa/codegen.dart View 1 2 3 4 5 2 chunks +5 lines, -7 lines 0 comments Download
M lib/compiler/implementation/ssa/optimize.dart View 1 2 3 4 5 1 chunk +7 lines, -10 lines 0 comments Download
M lib/compiler/implementation/universe.dart View 1 3 chunks +0 lines, -54 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Søren Gjesse
8 years, 6 months ago (2012-06-19 08:15:02 UTC) #1
Søren Gjesse
PTAL As discussed offline moved the support data structures to the backend object. I still ...
8 years, 6 months ago (2012-06-19 14:38:18 UTC) #2
karlklose
https://chromiumcodereview.appspot.com/10584009/diff/3001/lib/compiler/implementation/compiler.dart File lib/compiler/implementation/compiler.dart (right): https://chromiumcodereview.appspot.com/10584009/diff/3001/lib/compiler/implementation/compiler.dart#newcode37 lib/compiler/implementation/compiler.dart:37: final Map<Element, Map<SourceString, HType>> fieldInitializers; Why not move these ...
8 years, 6 months ago (2012-06-19 15:07:39 UTC) #3
Søren Gjesse
PTAL Moved to JavaScriptBackend used Element as key.
8 years, 6 months ago (2012-06-20 09:07:10 UTC) #4
floitsch
LGTM with comments. https://chromiumcodereview.appspot.com/10584009/diff/9001/lib/compiler/implementation/compiler.dart File lib/compiler/implementation/compiler.dart (right): https://chromiumcodereview.appspot.com/10584009/diff/9001/lib/compiler/implementation/compiler.dart#newcode54 lib/compiler/implementation/compiler.dart:54: class JavaScriptBackend extends Backend { We ...
8 years, 6 months ago (2012-06-20 10:20:33 UTC) #5
karlklose
LGTM. https://chromiumcodereview.appspot.com/10584009/diff/9001/lib/compiler/implementation/ssa/optimize.dart File lib/compiler/implementation/ssa/optimize.dart (right): https://chromiumcodereview.appspot.com/10584009/diff/9001/lib/compiler/implementation/ssa/optimize.dart#newcode1204 lib/compiler/implementation/ssa/optimize.dart:1204: type, left.element) && Does this fit in in ...
8 years, 6 months ago (2012-06-20 11:26:32 UTC) #6
Søren Gjesse
8 years, 6 months ago (2012-06-21 08:51:34 UTC) #7
https://chromiumcodereview.appspot.com/10584009/diff/9001/lib/compiler/implem...
File lib/compiler/implementation/compiler.dart (right):

https://chromiumcodereview.appspot.com/10584009/diff/9001/lib/compiler/implem...
lib/compiler/implementation/compiler.dart:54: class JavaScriptBackend extends
Backend {
On 2012/06/20 10:20:33, floitsch wrote:
> We should probably move the class out of the compiler file.
> But in a different CL.

Will do.

https://chromiumcodereview.appspot.com/10584009/diff/9001/lib/compiler/implem...
lib/compiler/implementation/compiler.dart:119: if (fields[field] !=
propagatedType) fields[field] = HType.UNKNOWN;
On 2012/06/20 10:20:33, floitsch wrote:
> can't you just union the types?

Done, that should also be better.

https://chromiumcodereview.appspot.com/10584009/diff/9001/lib/compiler/implem...
lib/compiler/implementation/compiler.dart:161: bool
couldHaveFieldOnlyIntegerSetters(Type type, Element field) {
On 2012/06/20 10:20:33, floitsch wrote:
> Doesn't the  field element contain the enclosing class? If yes it should be
> enough to pass the field-element.

It does. The element of the type can be a sub-class of the containing element
for the field, but that should be OK as we only use HFieldGet/Set when the field
name is unique in the class hierarchy.

https://chromiumcodereview.appspot.com/10584009/diff/9001/lib/compiler/implem...
lib/compiler/implementation/compiler.dart:170: bool
hasFieldOnlyIntegerSetters(Type type, Element field) {
On 2012/06/20 10:20:33, floitsch wrote:
> I would remove this method. It is identical to the
> couldHaveFieldOnlyIntegerSetters.
> Also it is misleading. Even when returning true the field might still have
> non-integer setters (if there are dynamic setters). So from this point of view
> "couldHaveFieldOnly..." fills the role. I would also add a comment to
couldHave
> stating that it returns true if all seen (typed) setters have been integers.

Changed the name to onlyFieldIntegerSettersSoFar (and dropped the other). Added
a comment. The name was supposed to indicate that the information is from
HFieldSet instructions only and does not include dynamic setters.

https://chromiumcodereview.appspot.com/10584009/diff/9001/lib/compiler/implem...
File lib/compiler/implementation/ssa/optimize.dart (right):

https://chromiumcodereview.appspot.com/10584009/diff/9001/lib/compiler/implem...
lib/compiler/implementation/ssa/optimize.dart:1204: type, left.element) &&
On 2012/06/20 11:26:32, karlklose wrote:
> Does this fit in in previous line now?

Done.

https://chromiumcodereview.appspot.com/10584009/diff/9001/lib/compiler/implem...
lib/compiler/implementation/ssa/optimize.dart:1213: type, left.element) &&
On 2012/06/20 11:26:32, karlklose wrote:
> ditto.

Done.

Powered by Google App Engine
This is Rietveld 408576698