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

Issue 1314373003: Revert "dart2js cps: Use dummy constant in dummy receiver optimization." (Closed)

Created:
5 years, 3 months ago by asgerf
Modified:
5 years, 3 months ago
CC:
reviews_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Revert "dart2js cps: Use dummy constant in dummy receiver optimization." This reverts commit 4d20c86fd03aafb2d55d3efd9cbc1436a9ebdf0b. BUG= Committed: https://github.com/dart-lang/sdk/commit/7624ec59dab018cd0c509f33752773aafcbc379e

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -18 lines) Patch
M pkg/compiler/lib/src/cps_ir/type_propagation.dart View 5 chunks +11 lines, -16 lines 0 comments Download
M pkg/compiler/lib/src/js_backend/codegen/glue.dart View 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 5 (1 generated)
asgerf
5 years, 3 months ago (2015-08-27 15:08:53 UTC) #2
asgerf
Committed patchset #1 (id:1) manually as 7624ec59dab018cd0c509f33752773aafcbc379e (presubmit successful).
5 years, 3 months ago (2015-08-27 15:09:05 UTC) #3
asgerf
On 2015/08/27 15:09:05, asgerf wrote: > Committed patchset #1 (id:1) manually as > 7624ec59dab018cd0c509f33752773aafcbc379e (presubmit ...
5 years, 3 months ago (2015-08-27 16:43:58 UTC) #4
sra1
5 years, 3 months ago (2015-08-27 18:29:01 UTC) #5
Message was sent while issue was closed.
On 2015/08/27 16:43:58, asgerf wrote:
> On 2015/08/27 15:09:05, asgerf wrote:
> > Committed patchset #1 (id:1) manually as
> > 7624ec59dab018cd0c509f33752773aafcbc379e (presubmit successful).
> 
> This was causing problems when a dummy interceptor was created for a null
> receiver.

Do you mean the type copied to the constant is '[null]', as in
(v = null).add$1(v, 123)
-->
null.add$1(0, 123)

Is cps_ir doing something special when the type is [null]?

(I assume the method is not one of ==, get hashCode, toString, get runtimeType,
otherwise you need the explicit receiver parameter, e.g.  JSNull_methods.$eq(v,
123))

> 
> Why do we need the dummy interceptor constant?

It is a dummy receiver.

So it can have a type that is 'correct', int constant would be expected to have
an int type.
In SSA, the receiver could be a HTypeKnown type refinement that has a better
type than the input to getInterceptor.
When we codegen  x.add$1(y, 123)  we generate a demand for methods called add$1
with the receiver type y.

Consider:

    if (y.length == 0) return;
    if (y is List) y.add(123);

--->

    x = getInterceptor(y);
    if (x.get$length(0) == 0) return;   // could be Map / Iterable / String /
Queue
    if (y is List) {
      y2 = HTypeKnown(List, y);
      x.add$1(y2, 123);
    }

We avoid compiling add methods on non-List objects, e.g. Queue.add,
LinkedHashSet.add.

Powered by Google App Engine
This is Rietveld 408576698