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

Issue 10964016: Change the type inference for fields in dart2js (Closed)

Created:
8 years, 3 months ago by Søren Gjesse
Modified:
8 years, 2 months ago
Reviewers:
ngeoffray, kasperl
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Change the type inference for fields in dart2js The type inference for fields now uses the same mechanism as is used for type inference for arguments and return types. That means that compilation is optimistically taking the current inferred type for a field. When an inferred type for a field changes all functions previously compiled under the previous type assumption are scheduled for recompilation. There is special handling of constructors where fields which are always set in a constructor is identified. This is done to avoid having to combine with the null type which can be set by the initializer list. This change removes the two phase compilation previously used for inferring field types. R=kasperl@google.com, ngeoffray@google.com BUG= Committed: https://code.google.com/p/dart/source/detail?r=12956

Patch Set 1 #

Patch Set 2 : Minor fixes and rebased #

Total comments: 36

Patch Set 3 : Addressed revew comments from negoffray@ #

Patch Set 4 : Addressed review comments from ngeoffray@ #

Patch Set 5 : Rebased to r12709 #

Total comments: 26

Patch Set 6 : Rebased to r12757 #

Total comments: 2

Patch Set 7 : Addressed second round of comments #

Total comments: 17

Patch Set 8 : Addressed third round of comments and added more tests #

Patch Set 9 : Rebased to r12841 #

Total comments: 26

Patch Set 10 : Addressed more comments and added more tests #

Total comments: 43

Patch Set 11 : Final round of changes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+791 lines, -374 lines) Patch
M lib/compiler/implementation/compiler.dart View 1 2 3 4 5 5 chunks +6 lines, -33 lines 0 comments Download
M lib/compiler/implementation/enqueue.dart View 1 2 3 4 5 6 7 8 9 10 5 chunks +1 line, -42 lines 0 comments Download
M lib/compiler/implementation/js_backend/backend.dart View 1 2 3 4 5 6 7 8 9 10 9 chunks +247 lines, -115 lines 0 comments Download
M lib/compiler/implementation/ssa/codegen.dart View 1 2 3 4 5 6 7 8 9 10 3 chunks +7 lines, -31 lines 0 comments Download
M lib/compiler/implementation/ssa/optimize.dart View 1 2 3 4 5 6 7 8 9 10 5 chunks +131 lines, -151 lines 0 comments Download
M lib/compiler/implementation/universe/function_set.dart View 1 chunk +1 line, -1 line 0 comments Download
M lib/compiler/implementation/universe/universe.dart View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
A tests/compiler/dart2js/field_type_inferer_test.dart View 1 2 3 4 5 6 7 8 9 10 1 chunk +390 lines, -0 lines 0 comments Download
M tests/compiler/dart2js/metadata_test.dart View 4 chunks +4 lines, -0 lines 0 comments Download
M tests/language/language_dart2js.status View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
Søren Gjesse
8 years, 3 months ago (2012-09-20 13:49:11 UTC) #1
ngeoffray
http://codereview.chromium.org/10964016/diff/2001/lib/compiler/implementation/enqueue.dart File lib/compiler/implementation/enqueue.dart (right): http://codereview.chromium.org/10964016/diff/2001/lib/compiler/implementation/enqueue.dart#newcode263 lib/compiler/implementation/enqueue.dart:263: compiler.backend.addedDynamicSetter(selector); I don't understand why you have to do ...
8 years, 3 months ago (2012-09-20 14:43:01 UTC) #2
Søren Gjesse
PTAL I changed the SSA propagation of fields set in the generative constructor body. I ...
8 years, 3 months ago (2012-09-21 13:49:43 UTC) #3
ngeoffray
https://chromiumcodereview.appspot.com/10964016/diff/17002/lib/compiler/implementation/js_backend/backend.dart File lib/compiler/implementation/js_backend/backend.dart (right): https://chromiumcodereview.appspot.com/10964016/diff/17002/lib/compiler/implementation/js_backend/backend.dart#newcode296 lib/compiler/implementation/js_backend/backend.dart:296: if (compiler.codegenWorld.hasInvokedSetter(field, compiler)) { Why do you need the ...
8 years, 3 months ago (2012-09-24 08:15:49 UTC) #4
Søren Gjesse
ptal http://codereview.chromium.org/10964016/diff/17002/lib/compiler/implementation/js_backend/backend.dart File lib/compiler/implementation/js_backend/backend.dart (right): http://codereview.chromium.org/10964016/diff/17002/lib/compiler/implementation/js_backend/backend.dart#newcode296 lib/compiler/implementation/js_backend/backend.dart:296: if (compiler.codegenWorld.hasInvokedSetter(field, compiler)) { On 2012/09/24 08:15:49, ngeoffray ...
8 years, 3 months ago (2012-09-24 15:06:50 UTC) #5
ngeoffray
LGTM, with a few comments http://codereview.chromium.org/10964016/diff/18001/lib/compiler/implementation/js_backend/backend.dart File lib/compiler/implementation/js_backend/backend.dart (right): http://codereview.chromium.org/10964016/diff/18001/lib/compiler/implementation/js_backend/backend.dart#newcode251 lib/compiler/implementation/js_backend/backend.dart:251: optimizedStaticFunctions.remove(field); Put the remove ...
8 years, 3 months ago (2012-09-24 15:39:29 UTC) #6
Søren Gjesse
Please look once more Addressed review comments. Also added tests and it turned out that ...
8 years, 2 months ago (2012-09-25 13:33:21 UTC) #7
Søren Gjesse
Missed a single comment. https://chromiumcodereview.appspot.com/10964016/diff/18001/tests/compiler/dart2js/field_type_inferer_test.dart File tests/compiler/dart2js/field_type_inferer_test.dart (right): https://chromiumcodereview.appspot.com/10964016/diff/18001/tests/compiler/dart2js/field_type_inferer_test.dart#newcode1 tests/compiler/dart2js/field_type_inferer_test.dart:1: // Copyright (c) 2012, the ...
8 years, 2 months ago (2012-09-25 14:47:05 UTC) #8
ngeoffray
Sorry, still have a few more comments :) https://codereview.chromium.org/10964016/diff/25001/lib/compiler/implementation/js_backend/backend.dart File lib/compiler/implementation/js_backend/backend.dart (right): https://codereview.chromium.org/10964016/diff/25001/lib/compiler/implementation/js_backend/backend.dart#newcode228 lib/compiler/implementation/js_backend/backend.dart:228: final ...
8 years, 2 months ago (2012-09-25 21:15:43 UTC) #9
Søren Gjesse
Ready for another round. https://codereview.chromium.org/10964016/diff/25001/lib/compiler/implementation/js_backend/backend.dart File lib/compiler/implementation/js_backend/backend.dart (right): https://codereview.chromium.org/10964016/diff/25001/lib/compiler/implementation/js_backend/backend.dart#newcode228 lib/compiler/implementation/js_backend/backend.dart:228: final Map<Element, Set<Element>> constructors; On ...
8 years, 2 months ago (2012-09-27 11:53:39 UTC) #10
ngeoffray
LGTM! Sorry about the comma comments :) https://codereview.chromium.org/10964016/diff/32001/lib/compiler/implementation/js_backend/backend.dart File lib/compiler/implementation/js_backend/backend.dart (right): https://codereview.chromium.org/10964016/diff/32001/lib/compiler/implementation/js_backend/backend.dart#newcode230 lib/compiler/implementation/js_backend/backend.dart:230: * For ...
8 years, 2 months ago (2012-09-27 12:35:46 UTC) #11
Søren Gjesse
Addressed all comments. Also updated the status file related to issue 5517. Thanks for you ...
8 years, 2 months ago (2012-09-27 13:22:49 UTC) #12
ngeoffray
8 years, 2 months ago (2012-09-27 13:25:03 UTC) #13
https://codereview.chromium.org/10964016/diff/32001/lib/compiler/implementati...
File lib/compiler/implementation/ssa/optimize.dart (right):

https://codereview.chromium.org/10964016/diff/32001/lib/compiler/implementati...
lib/compiler/implementation/ssa/optimize.dart:1292: thisExposed = thisExposed ||
thisUsers.contains(phi);
On 2012/09/27 13:22:49, Søren Gjesse wrote:
> On 2012/09/27 12:35:46, ngeoffray wrote:
> > We talked about adding the users of the phi to thisUsers if the phi is a
user
> of
> > 'this'. Is a test failing if you do such optimization?
> 
> That is actually why I still had the thisInstruction member above. Changed it
> to:
> 
> if (phi.inputs.indexOf(thisInstruction) != -1) {

How about if (thisUsers.contains(phi)) ?

>   thisUsers.addAll(phi.usedBy);
> }
> 
> (can't remember why I changed it to the pessimistic version).
> 
> Modified the expectations for TEST_18 and added TEST_19 where the phi is used
in
> an invoke to really expose this.

Powered by Google App Engine
This is Rietveld 408576698