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

Issue 10353014: Start implementing checked mode and tools support for using it. (Closed)

Created:
8 years, 7 months ago by ngeoffray
Modified:
8 years, 7 months ago
Reviewers:
floitsch, kasperl
CC:
reviews_dartlang.org, ahe, karlklose, Lasse Reichstein Nielsen
Visibility:
Public.

Description

Start implementing checked mode and tools support for using it. Committed: https://code.google.com/p/dart/source/detail?r=7375

Patch Set 1 : #

Total comments: 37

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+329 lines, -53 lines) Patch
M frog/tests/leg_only/for_in_test.dart View 1 2 chunks +2 lines, -2 lines 0 comments Download
M lib/compiler/implementation/apiimpl.dart View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M lib/compiler/implementation/compiler.dart View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M lib/compiler/implementation/dart2js.dart View 1 1 chunk +2 lines, -0 lines 0 comments Download
M lib/compiler/implementation/lib/js_helper.dart View 1 2 2 chunks +114 lines, -2 lines 0 comments Download
M lib/compiler/implementation/lib/mock.dart View 1 1 chunk +5 lines, -1 line 0 comments Download
M lib/compiler/implementation/ssa/builder.dart View 1 2 3 3 chunks +36 lines, -2 lines 0 comments Download
M lib/compiler/implementation/ssa/codegen.dart View 1 4 chunks +66 lines, -7 lines 0 comments Download
M lib/compiler/implementation/ssa/codegen_helpers.dart View 1 3 chunks +8 lines, -4 lines 0 comments Download
M lib/compiler/implementation/ssa/nodes.dart View 1 1 chunk +7 lines, -10 lines 0 comments Download
M lib/compiler/implementation/ssa/optimize.dart View 1 2 4 chunks +7 lines, -5 lines 0 comments Download
M lib/compiler/implementation/ssa/types.dart View 1 3 chunks +58 lines, -17 lines 0 comments Download
M lib/compiler/implementation/universe.dart View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M tests/language/language.status View 1 2 3 1 chunk +15 lines, -1 line 0 comments Download
M tools/testing/dart/test_suite.dart View 1 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
ngeoffray
8 years, 7 months ago (2012-05-03 14:50:56 UTC) #1
floitsch
First round of comments. https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implementation/lib/js_helper.dart File lib/compiler/implementation/lib/js_helper.dart (right): https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implementation/lib/js_helper.dart#newcode826 lib/compiler/implementation/lib/js_helper.dart:826: String name = property.substring(3, property.length); ...
8 years, 7 months ago (2012-05-07 09:50:07 UTC) #2
kasperl
Quick comments: https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implementation/lib/mock.dart File lib/compiler/implementation/lib/mock.dart (right): https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implementation/lib/mock.dart#newcode11 lib/compiler/implementation/lib/mock.dart:11: String msg; final? https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implementation/lib/mock.dart#newcode12 lib/compiler/implementation/lib/mock.dart:12: TypeError(this.msg); const? ...
8 years, 7 months ago (2012-05-07 10:42:39 UTC) #3
floitsch
LGTM after all the comments have been addressed. https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implementation/lib/js_helper.dart File lib/compiler/implementation/lib/js_helper.dart (right): https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implementation/lib/js_helper.dart#newcode847 lib/compiler/implementation/lib/js_helper.dart:847: if ...
8 years, 7 months ago (2012-05-07 11:06:56 UTC) #4
ahe
DBC https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implementation/apiimpl.dart File lib/compiler/implementation/apiimpl.dart (right): https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implementation/apiimpl.dart#newcode24 lib/compiler/implementation/apiimpl.dart:24: bool checkedMode = false; Developer mode, please. https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implementation/apiimpl.dart#newcode28 ...
8 years, 7 months ago (2012-05-07 11:59:57 UTC) #5
ngeoffray
8 years, 7 months ago (2012-05-07 13:15:42 UTC) #6
https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
File lib/compiler/implementation/apiimpl.dart (right):

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/apiimpl.dart:24: bool checkedMode = false;
On 2012/05/07 11:59:57, ahe wrote:
> Developer mode, please.

Renamed to enableTypeAssertions.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/apiimpl.dart:28: checkedMode =
options.indexOf('--enable-checked-mode') !== -1;
On 2012/05/07 11:59:57, ahe wrote:
> I don't like this flag name. I think it should be something like:
> 
> --developer-mode
> 
> I'm fine having aliases for compatibility with the VM. But I think we need to
> *think* about flag names, instead of just doing something. This is the most
> fundamental interface to the compiler, and it should be "designed".

As discussed, keeping enable-checked-mode only for now.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/apiimpl.dart:102: bool get isCheckedModeEnabled() {
On 2012/05/07 11:59:57, ahe wrote:
> Developer mode, please.

I removed the getter.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
File lib/compiler/implementation/lib/js_helper.dart (right):

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/lib/js_helper.dart:826: String name =
property.substring(3, property.length);
On 2012/05/07 11:59:57, ahe wrote:
> On 2012/05/07 09:50:07, floitsch wrote:
> > explain what is cut off.
> > maybe assert that the property starts with the expected prefix.
> 
> Be careful about asserting anything in this code. The assertion will affect
the
> user's code.

Very good point.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/lib/js_helper.dart:844:
listSuperNativeTypeCheck(value, property) {
On 2012/05/07 09:50:07, floitsch wrote:
> Explain what this does.

Done.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/lib/js_helper.dart:847: if (JS('bool', '#.#()',
value, property)) return value;
On 2012/05/07 11:06:56, floitsch wrote:
> #.# won't work.

Done.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/lib/js_helper.dart:852: propertyTypeCheck(value,
property) {
On 2012/05/07 09:50:07, floitsch wrote:
> ditto.

Done.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/lib/js_helper.dart:859: callTypeCheck(value,
property) {
On 2012/05/07 09:50:07, floitsch wrote:
> ditto.

Done.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/lib/js_helper.dart:862: && JS('bool', '#.#()',
value, property)) {
On 2012/05/07 11:06:56, floitsch wrote:
> #.# won't work.

Done.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
File lib/compiler/implementation/lib/mock.dart (right):

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/lib/mock.dart:11: String msg;
On 2012/05/07 10:42:39, kasperl wrote:
> final?

Done.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/lib/mock.dart:12: TypeError(this.msg);
On 2012/05/07 10:42:39, kasperl wrote:
> const?

Done.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
File lib/compiler/implementation/ssa/builder.dart (right):

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/ssa/builder.dart:1040: if (type !== null) {
On 2012/05/07 10:42:39, kasperl wrote:
> Bailout style? 
> 
>    if (type === null) return original;
>    ...

Done.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/ssa/builder.dart:1045: if
(original.guaranteedType.union(convertedType) === convertedType) {
On 2012/05/07 09:50:07, floitsch wrote:
> ==

Done.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
File lib/compiler/implementation/ssa/codegen.dart (right):

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/ssa/codegen.dart:1902: if (node.checked) {
On 2012/05/07 11:06:56, floitsch wrote:
> not sure I like that all of this is in the codegen.

As discussed, I will live it here, but we can revisit once the HType API
stabilizes.

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

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/ssa/optimize.dart:441: if
(!left.propagatedType.canBeNull()) {
On 2012/05/07 09:50:07, floitsch wrote:
> I would prefer switching to the new semantics in a separate CL.

This should have been if (leg.propagatedType.isPrimitive()) ...

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/ssa/optimize.dart:536: &&
!expressionType.canBeNull()
On 2012/05/07 09:50:07, floitsch wrote:
> you could move that check into the 'true' section.
> if the is-check would be false, then 'null' can't change that.

Done.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
File lib/compiler/implementation/ssa/types.dart (right):

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/ssa/types.dart:8: factory HType.fromBoundedType(Type
type,
On 2012/05/07 09:50:07, floitsch wrote:
> /***/ doc explaining what boundedType means.

Done.

https://chromiumcodereview.appspot.com/10353014/diff/5001/lib/compiler/implem...
lib/compiler/implementation/ssa/types.dart:43: return null;
On 2012/05/07 09:50:07, floitsch wrote:
> Please don't return 'null' from a factory.
> I would prefer having a special Type node.

I plan on changing that. I added a TODO here and where I do a null check.

Powered by Google App Engine
This is Rietveld 408576698