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 8457007: Better runtime type checks. (Closed)

Created:
9 years, 1 month ago by Jennifer Messerly
Modified:
9 years, 1 month ago
Reviewers:
jimhug
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Better runtime type checks. The generated code is nicer+faster and they're generated in more places. Since it's reasonably fast now, I enabled it in presubmit.py. TBR=jimhug Committed: https://code.google.com/p/dart/source/detail?r=1232

Patch Set 1 #

Patch Set 2 : turn on checked mode in presubmit #

Patch Set 3 : cleaner output #

Total comments: 4

Patch Set 4 : fix an out of date comment #

Patch Set 5 : merged, and fix typo in member name #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+2781 lines, -2237 lines) Patch
M frog/frog.dart View 1 1 chunk +8 lines, -2 lines 2 comments Download
M frog/frogsh View 1 2 3 4 623 chunks +2499 lines, -2117 lines 0 comments Download
M frog/gen.dart View 1 2 3 chunks +12 lines, -3 lines 0 comments Download
M frog/lib/core.js View 1 1 chunk +7 lines, -0 lines 2 comments Download
M frog/lib/num.dart View 1 chunk +3 lines, -0 lines 0 comments Download
M frog/library.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M frog/member.dart View 1 2 3 chunks +26 lines, -1 line 1 comment Download
M frog/parser.dart View 1 2 chunks +15 lines, -6 lines 0 comments Download
M frog/presubmit.py View 1 1 chunk +11 lines, -5 lines 0 comments Download
M frog/scripts/token_info.py View 1 chunk +3 lines, -2 lines 0 comments Download
M frog/tests/TokenizerTest.dart View 1 chunk +2 lines, -2 lines 0 comments Download
M frog/token_kind.g.dart View 2 chunks +62 lines, -58 lines 0 comments Download
M frog/tokenizer.dart View 4 chunks +7 lines, -5 lines 0 comments Download
M frog/tokenizer.g.dart View 1 chunk +1 line, -1 line 0 comments Download
M frog/type.dart View 1 2 3 4 6 chunks +14 lines, -3 lines 0 comments Download
M frog/value.dart View 1 2 3 4 2 chunks +100 lines, -26 lines 1 comment Download
M frog/var_member.dart View 1 2 1 chunk +5 lines, -2 lines 0 comments Download
M frog/world.dart View 1 2 chunks +4 lines, -0 lines 1 comment Download
M tests/language/language.status View 1 2 2 chunks +1 line, -3 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Jennifer Messerly
submitted http://codereview.chromium.org/8457007/diff/4001/frog/library.dart File frog/library.dart (right): http://codereview.chromium.org/8457007/diff/4001/frog/library.dart#newcode117 frog/library.dart:117: // Function types implement the Function interface. feedback ...
9 years, 1 month ago (2011-11-05 00:45:10 UTC) #1
jimhug
LGTM! We still got some big issues (like how to implement the checks on a ...
9 years, 1 month ago (2011-11-07 16:41:26 UTC) #2
Jennifer Messerly
http://codereview.chromium.org/8457007/diff/2002/frog/frog.dart File frog/frog.dart (right): http://codereview.chromium.org/8457007/diff/2002/frog/frog.dart#newcode16 frog/frog.dart:16: var argv = new List.from(process.argv); On 2011/11/07 16:41:26, jimhug ...
9 years, 1 month ago (2011-11-07 22:13:10 UTC) #3
Jennifer Messerly
9 years, 1 month ago (2011-11-08 03:56:16 UTC) #4
http://codereview.chromium.org/8457007/diff/2002/frog/lib/core.js
File frog/lib/core.js (right):

http://codereview.chromium.org/8457007/diff/2002/frog/lib/core.js#newcode181
frog/lib/core.js:181: return test === true;
On 2011/11/07 16:41:26, jimhug wrote:
> I wonder if this would be better?
> 
> (possibly inlined at call sites?)
> 
> return test === true ? true : test === false ? false : $bool_error();
> 
> It seems like this could also be further optimized for if/else branches by
using
> the if (test === true) ... else { assert(test === false); ...} pattern.

I was mostly trying to keep checked mode relatively readable, hence going
through the method. I agree it'd be good to try a few different patterns and see
if we can get it inlined.

However I suspect once we start tracking non-nullable bools (e.g. anything that
is a result of a non-overloaded == or != operator or && || ! operator) we will
be able to eliminate a lot of the checks.

Powered by Google App Engine
This is Rietveld 408576698