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

Issue 12049036: Cleanup the namer, and add a test with fields that used to clash with internal names used by the co… (Closed)

Created:
7 years, 11 months ago by ngeoffray
Modified:
7 years, 11 months ago
Reviewers:
erikcorry, sra1, kasperl
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Cleanup the namer, and add a test with fields that used to clash with internal names used by the compiler. Committed: https://code.google.com/p/dart/source/detail?r=17535

Patch Set 1 : #

Total comments: 8

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 2

Patch Set 5 : #

Total comments: 10

Patch Set 6 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+173 lines, -231 lines) Patch
M sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart View 1 2 3 4 5 2 chunks +2 lines, -2 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart View 1 2 3 4 5 2 chunks +6 lines, -2 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/js_backend/namer.dart View 1 2 3 4 5 14 chunks +129 lines, -23 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/lib/foreign_helper.dart View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/lib/js_helper.dart View 1 2 3 4 5 3 chunks +4 lines, -4 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/ssa/builder.dart View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
D sdk/lib/_internal/compiler/implementation/ssa/js_names.dart View 1 2 3 4 5 1 chunk +0 lines, -196 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/ssa/ssa.dart View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
M sdk/lib/_internal/compiler/implementation/ssa/variable_allocator.dart View 1 2 3 4 5 1 chunk +3 lines, -2 lines 0 comments Download
M tests/compiler/dart2js/class_order_test.dart View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
A tests/language/namer2_test.dart View 1 chunk +22 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
ngeoffray
7 years, 11 months ago (2013-01-23 12:18:28 UTC) #1
kasperl
https://codereview.chromium.org/12049036/diff/2001/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart File sdk/lib/_internal/compiler/implementation/js_backend/namer.dart (right): https://codereview.chromium.org/12049036/diff/2001/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart#newcode233 sdk/lib/_internal/compiler/implementation/js_backend/namer.dart:233: if (selector.isCall() && name == closureInvocationSelectorName) { Could this ...
7 years, 11 months ago (2013-01-23 13:58:29 UTC) #2
ngeoffray
https://codereview.chromium.org/12049036/diff/2001/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart File sdk/lib/_internal/compiler/implementation/js_backend/namer.dart (right): https://codereview.chromium.org/12049036/diff/2001/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart#newcode233 sdk/lib/_internal/compiler/implementation/js_backend/namer.dart:233: if (selector.isCall() && name == closureInvocationSelectorName) { On 2013/01/23 ...
7 years, 11 months ago (2013-01-23 14:00:16 UTC) #3
kasperl
https://codereview.chromium.org/12049036/diff/2001/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart File sdk/lib/_internal/compiler/implementation/js_backend/namer.dart (right): https://codereview.chromium.org/12049036/diff/2001/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart#newcode13 sdk/lib/_internal/compiler/implementation/js_backend/namer.dart:13: // These are current keywords Terminate comment with . ...
7 years, 11 months ago (2013-01-23 14:05:36 UTC) #4
ngeoffray
https://codereview.chromium.org/12049036/diff/2001/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart File sdk/lib/_internal/compiler/implementation/js_backend/namer.dart (right): https://codereview.chromium.org/12049036/diff/2001/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart#newcode13 sdk/lib/_internal/compiler/implementation/js_backend/namer.dart:13: // These are current keywords On 2013/01/23 14:05:36, kasperl ...
7 years, 11 months ago (2013-01-23 14:42:04 UTC) #5
kasperl
https://codereview.chromium.org/12049036/diff/10001/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart File sdk/lib/_internal/compiler/implementation/js_backend/namer.dart (right): https://codereview.chromium.org/12049036/diff/10001/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart#newcode13 sdk/lib/_internal/compiler/implementation/js_backend/namer.dart:13: // These are current keywords No .?
7 years, 11 months ago (2013-01-23 14:46:15 UTC) #6
ngeoffray
https://codereview.chromium.org/12049036/diff/10001/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart File sdk/lib/_internal/compiler/implementation/js_backend/namer.dart (right): https://codereview.chromium.org/12049036/diff/10001/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart#newcode13 sdk/lib/_internal/compiler/implementation/js_backend/namer.dart:13: // These are current keywords On 2013/01/23 14:46:15, kasperl ...
7 years, 11 months ago (2013-01-23 14:48:08 UTC) #7
sra1
https://codereview.chromium.org/12049036/diff/10002/sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart File sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart (right): https://codereview.chromium.org/12049036/diff/10002/sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart#newcode41 sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart:41: const reservedNativeProperties = const <String>["x", "y", "z"]; According to ...
7 years, 11 months ago (2013-01-23 21:23:21 UTC) #8
erikcorry
LGTM if it does not regress swarm size. https://codereview.chromium.org/12049036/diff/10002/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart File sdk/lib/_internal/compiler/implementation/js_backend/namer.dart (right): https://codereview.chromium.org/12049036/diff/10002/sdk/lib/_internal/compiler/implementation/js_backend/namer.dart#newcode28 sdk/lib/_internal/compiler/implementation/js_backend/namer.dart:28: const ...
7 years, 11 months ago (2013-01-24 10:05:11 UTC) #9
ngeoffray
7 years, 11 months ago (2013-01-24 10:33:17 UTC) #10
Thanks Erik,

Swarm before: 849809k
Swarm after: 833141k

This is due to the fact that we don't encode the arity on the operators anymore,
and don't use operator as a prefix in the name.

https://codereview.chromium.org/12049036/diff/10002/sdk/lib/_internal/compile...
File sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart
(right):

https://codereview.chromium.org/12049036/diff/10002/sdk/lib/_internal/compile...
sdk/lib/_internal/compiler/implementation/js_backend/minify_namer.dart:41: const
reservedNativeProperties = const <String>["x", "y", "z"];
On 2013/01/23 21:23:21, sra1 wrote:
> According to Issue 7554:
> 
> Q a b c d e f r x y z
> ch cx cy db dx dy fr fx fy go id k1 k2 k3 k4 r1 r2 rx ry x1 x2 y1 y2  
> 
> The full list is ~3000 names.
> 
> These names are bad only if the object on which they appear can flow to the
same
> use site as the native object with a property of the same name.
> 
> There is no harm in having *fields* with these names since to generate a field
> access, the compiler needs to resolve the type of the receiver, which protects
> against conflicts.

I added the bug reference number to the TODO.

https://codereview.chromium.org/12049036/diff/10002/sdk/lib/_internal/compile...
File sdk/lib/_internal/compiler/implementation/js_backend/namer.dart (right):

https://codereview.chromium.org/12049036/diff/10002/sdk/lib/_internal/compile...
sdk/lib/_internal/compiler/implementation/js_backend/namer.dart:28: const
<String>["__PROTO__", "prototype", "constructor"];
On 2013/01/24 10:05:11, erikcorry wrote:
> This should surely be lower case __proto__, not upper case.  This was already
> broken before.

Done.

https://codereview.chromium.org/12049036/diff/10002/sdk/lib/_internal/compile...
sdk/lib/_internal/compiler/implementation/js_backend/namer.dart:175: if (name !=
elementName) return getMappedOperatorName(name.slowToString());
On 2013/01/24 10:05:11, erikcorry wrote:
> This still has the issue that Kasper pointed out that the != operator does not
> check the type of its arguments, so that a later type error here will go
> unnoticed.  Suggest a custom equality method that you call here that will fail
> in checked mode if both arguments are not SourceStrings.

The two assignments below will check that they are both SourceString.

https://codereview.chromium.org/12049036/diff/10002/sdk/lib/_internal/compile...
sdk/lib/_internal/compiler/implementation/js_backend/namer.dart:313: newName =
getFreshName(proposedName, usedGlobalNames, true);
On 2013/01/24 10:05:11, erikcorry wrote:
> Can't we name ensureSafe so that it is clear at the call site what the flag
> means?

Done.

https://codereview.chromium.org/12049036/diff/10002/sdk/lib/_internal/compile...
sdk/lib/_internal/compiler/implementation/js_backend/namer.dart:539: } else if
(identical(value, '==')) {
On 2013/01/24 10:05:11, erikcorry wrote:
> Why do you want object identity instead of characterwise comparison here?

I don't. It's due to me copy pasting the method from Elements.

I changed this new method to use == instead.

Powered by Google App Engine
This is Rietveld 408576698