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

Issue 256453004: Avoid inlining constants that are used via a deferred import. (Closed)

Created:
6 years, 8 months ago by sigurdm
Modified:
6 years, 7 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Avoid inlining constants that are used via a deferred import. In order to avoid values from a deferred library to leak into the source code, we create an intermediate constant and refer via that. This is also done for non-primitive constants, so that for a case like: main.dart: import "lib.dart" deferred as lib; class C { const C(); } main() { print(const C()); print(lib.C1); } lib.dart: import "main.dart" as main; const C1 = const main.C(); The main output file will not reveal that we are printing the same constant twice. This CL also changes the constant emitter to be split between a literal emitter and a reference emitter, instead of a initializer emitter and a reference emitter. R=johnniwinther@google.com Committed: https://code.google.com/p/dart/source/detail?r=36286

Patch Set 1 : #

Patch Set 2 : Use intermediate constants. #

Total comments: 4

Patch Set 3 : #

Patch Set 4 : Rebase #

Messages

Total messages: 6 (0 generated)
sigurdm
6 years, 8 months ago (2014-04-24 14:31:36 UTC) #1
sigurdm
After discussing with Johnni it is clear that this is way to simpleminded - stand ...
6 years, 8 months ago (2014-04-25 11:12:34 UTC) #2
sigurdm
Now it should also work if you use the same constant in several output units.
6 years, 7 months ago (2014-04-28 09:11:28 UTC) #3
Johnni Winther
lgtm https://codereview.chromium.org/256453004/diff/40001/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart File sdk/lib/_internal/compiler/implementation/ssa/nodes.dart (right): https://codereview.chromium.org/256453004/diff/40001/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart#newcode187 sdk/lib/_internal/compiler/implementation/ssa/nodes.dart:187: HConstant addDeferredConstant(Constant constant, PrefixElement prefix, Compiler compiler) { ...
6 years, 7 months ago (2014-04-28 11:58:31 UTC) #4
sigurdm
https://codereview.chromium.org/256453004/diff/40001/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart File sdk/lib/_internal/compiler/implementation/ssa/nodes.dart (right): https://codereview.chromium.org/256453004/diff/40001/sdk/lib/_internal/compiler/implementation/ssa/nodes.dart#newcode187 sdk/lib/_internal/compiler/implementation/ssa/nodes.dart:187: HConstant addDeferredConstant(Constant constant, PrefixElement prefix, Compiler compiler) { On ...
6 years, 7 months ago (2014-04-28 12:07:47 UTC) #5
sigurdm
6 years, 7 months ago (2014-05-19 08:20:04 UTC) #6
Message was sent while issue was closed.
Committed patchset #4 manually as r36286 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698