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

Issue 10119010: Start propagating non-primitive types in the backend, and fold instructions that know about the typ… (Closed)

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

Description

Start propagating non-primitive types in the backend, and fold instructions that know about the type of their receiver. Committed: https://code.google.com/p/dart/source/detail?r=6728

Patch Set 1 : #

Total comments: 22

Patch Set 2 : #

Patch Set 3 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+226 lines, -41 lines) Patch
M lib/compiler/implementation/compile_time_constants.dart View 1 3 chunks +5 lines, -0 lines 0 comments Download
M lib/compiler/implementation/compiler.dart View 1 1 chunk +4 lines, -0 lines 0 comments Download
M lib/compiler/implementation/elements/elements.dart View 1 1 chunk +11 lines, -0 lines 0 comments Download
M lib/compiler/implementation/operations.dart View 1 15 chunks +34 lines, -1 line 0 comments Download
M lib/compiler/implementation/ssa/builder.dart View 1 3 chunks +15 lines, -2 lines 0 comments Download
M lib/compiler/implementation/ssa/codegen.dart View 1 1 chunk +7 lines, -1 line 0 comments Download
M lib/compiler/implementation/ssa/nodes.dart View 1 2 13 chunks +48 lines, -25 lines 0 comments Download
M lib/compiler/implementation/ssa/optimize.dart View 1 2 chunks +99 lines, -12 lines 0 comments Download
M lib/compiler/implementation/ssa/types.dart View 1 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
ngeoffray
https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implementation/operations.dart File lib/compiler/implementation/operations.dart (right): https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implementation/operations.dart#newcode1 lib/compiler/implementation/operations.dart:1: // Copyright (c) 2012, the Dart project authors. Please ...
8 years, 8 months ago (2012-04-18 14:11:48 UTC) #1
ahe
DBC https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implementation/elements/elements.dart File lib/compiler/implementation/elements/elements.dart (right): https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implementation/elements/elements.dart#newcode752 lib/compiler/implementation/elements/elements.dart:752: Element lookupMember(SourceString memberName) { Could you put a ...
8 years, 8 months ago (2012-04-18 15:22:59 UTC) #2
floitsch
LGTM. I think we will need to differentiate between concrete and subtypes soon, but for ...
8 years, 8 months ago (2012-04-18 19:18:48 UTC) #3
kasperl
LGTM. https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implementation/ssa/nodes.dart File lib/compiler/implementation/ssa/nodes.dart (right): https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implementation/ssa/nodes.dart#newcode742 lib/compiler/implementation/ssa/nodes.dart:742: class HNonPrimitiveType extends HType { Would it make ...
8 years, 8 months ago (2012-04-19 06:46:18 UTC) #4
ngeoffray
8 years, 8 months ago (2012-04-19 08:09:33 UTC) #5
Thanks for the comments, Florian and Kasper.

https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implem...
File lib/compiler/implementation/compiler.dart (right):

https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implem...
lib/compiler/implementation/compiler.dart:388: void
registerDynamicInvocationOn(SourceString methodName,
On 2012/04/18 19:18:48, floitsch wrote:
> I would prefer Element first.

I changed the signature to only take an element.

https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implem...
lib/compiler/implementation/compiler.dart:391: assert(selector !== null);
On 2012/04/18 19:18:48, floitsch wrote:
> I think we need to register the invocation too.

If you do that, then all 'foo' methods will be compiled. This method makes sure
only the given element is compiled.

https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implem...
File lib/compiler/implementation/elements/elements.dart (right):

https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implem...
lib/compiler/implementation/elements/elements.dart:752: Element
lookupMember(SourceString memberName) {
On 2012/04/18 15:23:00, ahe wrote:
> Could you put a big fat warning about this not being the right method to use
for
> resolving unqualified sends? In a documentation comment, please.

Done.

https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implem...
File lib/compiler/implementation/ssa/nodes.dart (right):

https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implem...
lib/compiler/implementation/ssa/nodes.dart:742: class HNonPrimitiveType extends
HType {
On 2012/04/19 06:46:19, kasperl wrote:
> Would it make sense to have a HPrimitiveType too so you don't need the flag on
> HNonPrimitiveType?

Yes, added a TODO.

https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implem...
lib/compiler/implementation/ssa/nodes.dart:748: if (this === other) return this;
On 2012/04/18 19:18:48, floitsch wrote:
> Why do you not look at the type?
> We could even have a operator == that looks at the type.

Well spotted. We don;t need to think about canonicalizing these HType for now,
but I wrote the code wrongly assuming they were canonicalized.

https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implem...
lib/compiler/implementation/ssa/nodes.dart:1117: this.element = element;
On 2012/04/18 19:18:48, floitsch wrote:
> I would prefer passing the element in the super call.

Done.

https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implem...
lib/compiler/implementation/ssa/nodes.dart:1183: return getter
On 2012/04/18 19:18:48, floitsch wrote:
> one line.

Done.

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

https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implem...
lib/compiler/implementation/ssa/optimize.dart:175: if
(node.selector.applies(parameters)) {
On 2012/04/18 19:18:48, floitsch wrote:
> Even if the function doesn't apply we should set the node.element.

Why? There is no need to compile the function since we know for sure it won't be
called.

> If it doesn't apply we should probably emit a warning.

Not at this level. The warning can only be emitted by the typechecker. If it
doesn't apply, we should generate 'throw new NoSuchMethodException(...)'.

https://chromiumcodereview.appspot.com/10119010/diff/1010/lib/compiler/implem...
lib/compiler/implementation/ssa/optimize.dart:187: HInstruction
visitIndex(HIndex node) {
On 2012/04/19 06:46:19, kasperl wrote:
> This looks like this could be refactored with a helper and used for
visitIndex,
> visitIndexAssign, and visitInvokeBinary.

Done.

Powered by Google App Engine
This is Rietveld 408576698