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

Issue 14018036: Remove holders for runtime type information. (Closed)

Created:
7 years, 7 months ago by karlklose
Modified:
7 years, 5 months ago
Reviewers:
ahe, ngeoffray, sra1
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Remove holders for runtime type information. Use the constructors of interceptors for native classes and mark classes that are used as type arguments only as needed. To output the correct class name for native types, encode the type name in the class description. R=sra@google.com Committed: https://code.google.com/p/dart/source/detail?r=22172

Patch Set 1 #

Total comments: 2

Patch Set 2 : Rebase. #

Total comments: 8

Patch Set 3 : Address comments. #

Patch Set 4 : Fix type annotation. #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+109 lines, -82 lines) Patch
M sdk/lib/_internal/compiler/implementation/js_backend/backend.dart View 1 1 chunk +18 lines, -0 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart View 1 2 10 chunks +41 lines, -60 lines 4 comments Download
M sdk/lib/_internal/compiler/implementation/js_backend/namer.dart View 1 2 3 1 chunk +23 lines, -3 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart View 1 2 12 chunks +24 lines, -17 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/ssa/builder.dart View 1 1 chunk +3 lines, -2 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
karlklose
7 years, 7 months ago (2013-04-29 13:39:28 UTC) #1
ngeoffray
DBC https://codereview.chromium.org/14018036/diff/1/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart File sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (right): https://codereview.chromium.org/14018036/diff/1/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart#newcode2563 sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart:2563: rti.allArguments.forEach((ClassElement c) { Please add a comment on ...
7 years, 7 months ago (2013-04-29 14:14:22 UTC) #2
sra1
lgtm https://codereview.chromium.org/14018036/diff/5001/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart File sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (right): https://codereview.chromium.org/14018036/diff/5001/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart#newcode610 sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart:610: * descriptor. Commeny should say what name 'name' ...
7 years, 7 months ago (2013-04-29 19:04:12 UTC) #3
karlklose
Thanks for the review, Nicolas and Stephen. https://codereview.chromium.org/14018036/diff/1/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart File sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (right): https://codereview.chromium.org/14018036/diff/1/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart#newcode2563 sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart:2563: rti.allArguments.forEach((ClassElement c) ...
7 years, 7 months ago (2013-04-30 09:29:40 UTC) #4
karlklose
Committed patchset #4 manually as r22172 (presubmit successful).
7 years, 7 months ago (2013-04-30 10:22:42 UTC) #5
ahe
7 years, 5 months ago (2013-07-19 16:30:25 UTC) #6
Message was sent while issue was closed.
https://codereview.chromium.org/14018036/diff/18001/sdk/lib/_internal/compile...
File sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (right):

https://codereview.chromium.org/14018036/diff/18001/sdk/lib/_internal/compile...
sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart:1470:
getterCode += backend.fieldHasInterceptedGetter(member) ? 2 : 0;
Read my comment on line 2602 first.

Consider CssStyleDeclaration.cssText:

CssStyleDeclaration is not instantiated, so we have not recorded that cssText
should be intercepted.

So this is equivalent to:

getterCode += 0;

https://codereview.chromium.org/14018036/diff/18001/sdk/lib/_internal/compile...
sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart:1471:
getterCode += backend.isInterceptorClass(classElement) ? 0 : 1;
For CssStyleDeclaration.cssText, classElement is an interceptor class, so we add
0.

getterCode remains 0.

https://codereview.chromium.org/14018036/diff/18001/sdk/lib/_internal/compile...
sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart:1475:
assert(getterCode != 0);
This assertion fails.

https://codereview.chromium.org/14018036/diff/18001/sdk/lib/_internal/compile...
sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart:2602:
neededClasses.add(c);
I'm not sure how this is supposed to work?

These classes might have been tree-shaken away and the rest of the compiler has
not analyzed them.  For example,  consider this class:

@DomName('CSSStyleDeclaration')
class CssStyleDeclaration extends Interceptor native
"CSSStyleDeclaration,MSStyleCSSProperties,CSS2Properties" {
  factory CssStyleDeclaration() => new CssStyleDeclaration.css('');

  factory CssStyleDeclaration.css(String css) {
    final style = new Element.tag('div').style;
    style.cssText = css;
    return style;
  }


  @DomName('CSSStyleDeclaration.cssText')
  @DocsEditable()
  String cssText;

...
}

This class is not necessarily instantiated, but instantiated classes might still
use it in a type annotation.

But if it is not instantiated, we have not recorded that the element
corresponding to cssText is intercepted.  However, this is a native class, so
scroll up to line 1475, and see my comments.

Powered by Google App Engine
This is Rietveld 408576698