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

Issue 10908142: Add runtimeType() to Object which returns canonicalized instances of Type. (Closed)

Created:
8 years, 3 months ago by karlklose
Modified:
8 years, 3 months ago
Reviewers:
ngeoffray, kasperl
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Add runtimeType() to Object which returns canonicalized instances of Type. BUG=3903 Committed: https://code.google.com/p/dart/source/detail?r=12491

Patch Set 1 : #

Patch Set 2 : #

Total comments: 11

Patch Set 3 : Refactor. #

Total comments: 13

Patch Set 4 : Address Kasper's comments. #

Patch Set 5 : Now that we have a real class Type, dartc does not need to add it. #

Patch Set 6 : Address more comments. #

Total comments: 24
Unified diffs Side-by-side diffs Delta from patch set Stats (+191 lines, -27 lines) Patch
M compiler/java/com/google/dart/compiler/DartCompiler.java View 1 2 3 4 1 chunk +0 lines, -7 lines 0 comments Download
M lib/compiler/implementation/compiler.dart View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M lib/compiler/implementation/enqueue.dart View 1 2 1 chunk +5 lines, -0 lines 0 comments Download
M lib/compiler/implementation/js_backend/emitter.dart View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M lib/compiler/implementation/lib/core_patch.dart View 1 2 3 1 chunk +5 lines, -0 lines 0 comments Download
M lib/compiler/implementation/lib/interceptors.dart View 1 chunk +14 lines, -0 lines 0 comments Download
M lib/compiler/implementation/lib/js_helper.dart View 1 2 3 1 chunk +20 lines, -0 lines 6 comments Download
M lib/compiler/implementation/ssa/builder.dart View 1 2 3 4 5 3 chunks +47 lines, -19 lines 0 comments Download
M lib/compiler/implementation/ssa/ssa.dart View 1 2 3 1 chunk +53 lines, -0 lines 16 comments Download
M lib/compiler/implementation/world.dart View 1 2 3 1 chunk +3 lines, -1 line 2 comments Download
M lib/core/object.dart View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
A tests/language/first_class_types.dart View 1 chunk +34 lines, -0 lines 0 comments Download
M tests/language/language.status View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
karlklose
8 years, 3 months ago (2012-09-13 13:57:00 UTC) #1
kasperl
LGTM, but I think the code in the builder could use some refactoring. https://chromiumcodereview.appspot.com/10908142/diff/1021/lib/compiler/implementation/lib/js_helper.dart File ...
8 years, 3 months ago (2012-09-14 07:26:48 UTC) #2
ngeoffray
https://chromiumcodereview.appspot.com/10908142/diff/1021/lib/compiler/implementation/enqueue.dart File lib/compiler/implementation/enqueue.dart (right): https://chromiumcodereview.appspot.com/10908142/diff/1021/lib/compiler/implementation/enqueue.dart#newcode252 lib/compiler/implementation/enqueue.dart:252: compiler.enabledRuntimeType = true; I'd prefer doing the check on ...
8 years, 3 months ago (2012-09-14 07:30:21 UTC) #3
karlklose
PTAL. https://codereview.chromium.org/10908142/diff/1021/lib/compiler/implementation/enqueue.dart File lib/compiler/implementation/enqueue.dart (right): https://codereview.chromium.org/10908142/diff/1021/lib/compiler/implementation/enqueue.dart#newcode252 lib/compiler/implementation/enqueue.dart:252: compiler.enabledRuntimeType = true; On 2012/09/14 07:30:21, ngeoffray wrote: ...
8 years, 3 months ago (2012-09-14 12:07:13 UTC) #4
kasperl
https://codereview.chromium.org/10908142/diff/12011/lib/compiler/implementation/ssa/builder.dart File lib/compiler/implementation/ssa/builder.dart (right): https://codereview.chromium.org/10908142/diff/12011/lib/compiler/implementation/ssa/builder.dart#newcode2666 lib/compiler/implementation/ssa/builder.dart:2666: HInstruction typeInfo; Isn't this typeInfo variable unused (shadowed)? https://codereview.chromium.org/10908142/diff/12011/lib/compiler/implementation/ssa/builder.dart#newcode2673 ...
8 years, 3 months ago (2012-09-14 12:35:37 UTC) #5
karlklose
https://codereview.chromium.org/10908142/diff/12011/lib/compiler/implementation/ssa/builder.dart File lib/compiler/implementation/ssa/builder.dart (right): https://codereview.chromium.org/10908142/diff/12011/lib/compiler/implementation/ssa/builder.dart#newcode2666 lib/compiler/implementation/ssa/builder.dart:2666: HInstruction typeInfo; Done, removed. https://codereview.chromium.org/10908142/diff/12011/lib/compiler/implementation/ssa/builder.dart#newcode2673 lib/compiler/implementation/ssa/builder.dart:2673: runtimeType = On ...
8 years, 3 months ago (2012-09-17 14:50:37 UTC) #6
ngeoffray
LGTM https://codereview.chromium.org/10908142/diff/4003/lib/compiler/implementation/lib/js_helper.dart File lib/compiler/implementation/lib/js_helper.dart (right): https://codereview.chromium.org/10908142/diff/4003/lib/compiler/implementation/lib/js_helper.dart#newcode1335 lib/compiler/implementation/lib/js_helper.dart:1335: Type runtimeType = JS('Object', @'$.runtimeTypeCache[#]', key); 'Object' -> ...
8 years, 3 months ago (2012-09-17 15:31:14 UTC) #7
kasperl
LGTM if you address Nicolas' comments. https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implementation/ssa/ssa.dart File lib/compiler/implementation/ssa/ssa.dart (right): https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implementation/ssa/ssa.dart#newcode43 lib/compiler/implementation/ssa/ssa.dart:43: static String forEachTypeVariable(Link ...
8 years, 3 months ago (2012-09-18 06:06:11 UTC) #8
karlklose
8 years, 3 months ago (2012-09-19 06:40:45 UTC) #9
https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
File lib/compiler/implementation/lib/js_helper.dart (right):

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
lib/compiler/implementation/lib/js_helper.dart:1335: Type runtimeType =
JS('Object', @'$.runtimeTypeCache[#]', key);
On 2012/09/17 15:31:14, ngeoffray wrote:
> 'Object' -> 'Type'

Done.

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
lib/compiler/implementation/lib/js_helper.dart:1335: Type runtimeType =
JS('Object', @'$.runtimeTypeCache[#]', key);
On 2012/09/17 15:31:14, ngeoffray wrote:
> Please use JS_CURRENT_ISOLATE() instead of $.

Done.

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
lib/compiler/implementation/lib/js_helper.dart:1338: JS('void',
@'$.runtimeTypeCache[#] = #', key, runtimeType);
On 2012/09/17 15:31:14, ngeoffray wrote:
> ditto

Done.

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
File lib/compiler/implementation/ssa/ssa.dart (right):

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
lib/compiler/implementation/ssa/ssa.dart:43: static String
forEachTypeVariable(Link collection,
On 2012/09/17 15:31:14, ngeoffray wrote:
> Add a top-level comment on what this method does.

Done.

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
lib/compiler/implementation/ssa/ssa.dart:70: String stringify(_, hasValue) {
On 2012/09/17 15:31:14, ngeoffray wrote:
> Please add types to the parameters.

Done.

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
lib/compiler/implementation/ssa/ssa.dart:70: String stringify(_, hasValue) {
I added it for the hasValue. I use '_' as a marker that I am not interested in
the argument and I do not think that adding a type would increase readability
here.

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
lib/compiler/implementation/ssa/ssa.dart:71: return hasValue ? "' + # + '" :
"Dynamic";
On 2012/09/17 15:31:14, ngeoffray wrote:
> Use the => notation?

Done.

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
lib/compiler/implementation/ssa/ssa.dart:71: return hasValue ? "' + # + '" :
"Dynamic";
On 2012/09/17 15:31:14, ngeoffray wrote:
> Use the => notation?

Done.

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
lib/compiler/implementation/ssa/ssa.dart:71: return hasValue ? "' + # + '" :
"Dynamic";
Which case do you mean?

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
lib/compiler/implementation/ssa/ssa.dart:87: StringBuffer buffer = new
StringBuffer();
Done, removed.

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
lib/compiler/implementation/ssa/ssa.dart:89: (variable, bool hasValue) {
On 2012/09/17 15:31:14, ngeoffray wrote:
> I find it easier to have this closure as a function statement (like in line
71)

Done.

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
File lib/compiler/implementation/world.dart (right):

https://chromiumcodereview.appspot.com/10908142/diff/4003/lib/compiler/implem...
lib/compiler/implementation/world.dart:76: return
classesNeedingRti.contains(cls) || compiler.enabledRuntimeType;
No, I don't think we need to check that here. Currently we simply need the type
arguments to construct the runtime type string representation.

Powered by Google App Engine
This is Rietveld 408576698