1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import * as o from './output/output_ast';
|
---|
9 | const CONSTANT_PREFIX = '_c';
|
---|
10 | /**
|
---|
11 | * `ConstantPool` tries to reuse literal factories when two or more literals are identical.
|
---|
12 | * We determine whether literals are identical by creating a key out of their AST using the
|
---|
13 | * `KeyVisitor`. This constant is used to replace dynamic expressions which can't be safely
|
---|
14 | * converted into a key. E.g. given an expression `{foo: bar()}`, since we don't know what
|
---|
15 | * the result of `bar` will be, we create a key that looks like `{foo: <unknown>}`. Note
|
---|
16 | * that we use a variable, rather than something like `null` in order to avoid collisions.
|
---|
17 | */
|
---|
18 | const UNKNOWN_VALUE_KEY = o.variable('<unknown>');
|
---|
19 | /**
|
---|
20 | * Context to use when producing a key.
|
---|
21 | *
|
---|
22 | * This ensures we see the constant not the reference variable when producing
|
---|
23 | * a key.
|
---|
24 | */
|
---|
25 | const KEY_CONTEXT = {};
|
---|
26 | /**
|
---|
27 | * Generally all primitive values are excluded from the `ConstantPool`, but there is an exclusion
|
---|
28 | * for strings that reach a certain length threshold. This constant defines the length threshold for
|
---|
29 | * strings.
|
---|
30 | */
|
---|
31 | const POOL_INCLUSION_LENGTH_THRESHOLD_FOR_STRINGS = 50;
|
---|
32 | /**
|
---|
33 | * A node that is a place-holder that allows the node to be replaced when the actual
|
---|
34 | * node is known.
|
---|
35 | *
|
---|
36 | * This allows the constant pool to change an expression from a direct reference to
|
---|
37 | * a constant to a shared constant. It returns a fix-up node that is later allowed to
|
---|
38 | * change the referenced expression.
|
---|
39 | */
|
---|
40 | class FixupExpression extends o.Expression {
|
---|
41 | constructor(resolved) {
|
---|
42 | super(resolved.type);
|
---|
43 | this.resolved = resolved;
|
---|
44 | this.original = resolved;
|
---|
45 | }
|
---|
46 | visitExpression(visitor, context) {
|
---|
47 | if (context === KEY_CONTEXT) {
|
---|
48 | // When producing a key we want to traverse the constant not the
|
---|
49 | // variable used to refer to it.
|
---|
50 | return this.original.visitExpression(visitor, context);
|
---|
51 | }
|
---|
52 | else {
|
---|
53 | return this.resolved.visitExpression(visitor, context);
|
---|
54 | }
|
---|
55 | }
|
---|
56 | isEquivalent(e) {
|
---|
57 | return e instanceof FixupExpression && this.resolved.isEquivalent(e.resolved);
|
---|
58 | }
|
---|
59 | isConstant() {
|
---|
60 | return true;
|
---|
61 | }
|
---|
62 | fixup(expression) {
|
---|
63 | this.resolved = expression;
|
---|
64 | this.shared = true;
|
---|
65 | }
|
---|
66 | }
|
---|
67 | /**
|
---|
68 | * A constant pool allows a code emitter to share constant in an output context.
|
---|
69 | *
|
---|
70 | * The constant pool also supports sharing access to ivy definitions references.
|
---|
71 | */
|
---|
72 | export class ConstantPool {
|
---|
73 | constructor(isClosureCompilerEnabled = false) {
|
---|
74 | this.isClosureCompilerEnabled = isClosureCompilerEnabled;
|
---|
75 | this.statements = [];
|
---|
76 | this.literals = new Map();
|
---|
77 | this.literalFactories = new Map();
|
---|
78 | this.injectorDefinitions = new Map();
|
---|
79 | this.directiveDefinitions = new Map();
|
---|
80 | this.componentDefinitions = new Map();
|
---|
81 | this.pipeDefinitions = new Map();
|
---|
82 | this.nextNameIndex = 0;
|
---|
83 | }
|
---|
84 | getConstLiteral(literal, forceShared) {
|
---|
85 | if ((literal instanceof o.LiteralExpr && !isLongStringLiteral(literal)) ||
|
---|
86 | literal instanceof FixupExpression) {
|
---|
87 | // Do no put simple literals into the constant pool or try to produce a constant for a
|
---|
88 | // reference to a constant.
|
---|
89 | return literal;
|
---|
90 | }
|
---|
91 | const key = this.keyOf(literal);
|
---|
92 | let fixup = this.literals.get(key);
|
---|
93 | let newValue = false;
|
---|
94 | if (!fixup) {
|
---|
95 | fixup = new FixupExpression(literal);
|
---|
96 | this.literals.set(key, fixup);
|
---|
97 | newValue = true;
|
---|
98 | }
|
---|
99 | if ((!newValue && !fixup.shared) || (newValue && forceShared)) {
|
---|
100 | // Replace the expression with a variable
|
---|
101 | const name = this.freshName();
|
---|
102 | let definition;
|
---|
103 | let usage;
|
---|
104 | if (this.isClosureCompilerEnabled && isLongStringLiteral(literal)) {
|
---|
105 | // For string literals, Closure will **always** inline the string at
|
---|
106 | // **all** usages, duplicating it each time. For large strings, this
|
---|
107 | // unnecessarily bloats bundle size. To work around this restriction, we
|
---|
108 | // wrap the string in a function, and call that function for each usage.
|
---|
109 | // This tricks Closure into using inline logic for functions instead of
|
---|
110 | // string literals. Function calls are only inlined if the body is small
|
---|
111 | // enough to be worth it. By doing this, very large strings will be
|
---|
112 | // shared across multiple usages, rather than duplicating the string at
|
---|
113 | // each usage site.
|
---|
114 | //
|
---|
115 | // const myStr = function() { return "very very very long string"; };
|
---|
116 | // const usage1 = myStr();
|
---|
117 | // const usage2 = myStr();
|
---|
118 | definition = o.variable(name).set(new o.FunctionExpr([], // Params.
|
---|
119 | [
|
---|
120 | // Statements.
|
---|
121 | new o.ReturnStatement(literal),
|
---|
122 | ]));
|
---|
123 | usage = o.variable(name).callFn([]);
|
---|
124 | }
|
---|
125 | else {
|
---|
126 | // Just declare and use the variable directly, without a function call
|
---|
127 | // indirection. This saves a few bytes and avoids an unncessary call.
|
---|
128 | definition = o.variable(name).set(literal);
|
---|
129 | usage = o.variable(name);
|
---|
130 | }
|
---|
131 | this.statements.push(definition.toDeclStmt(o.INFERRED_TYPE, [o.StmtModifier.Final]));
|
---|
132 | fixup.fixup(usage);
|
---|
133 | }
|
---|
134 | return fixup;
|
---|
135 | }
|
---|
136 | getDefinition(type, kind, ctx, forceShared = false) {
|
---|
137 | const definitions = this.definitionsOf(kind);
|
---|
138 | let fixup = definitions.get(type);
|
---|
139 | let newValue = false;
|
---|
140 | if (!fixup) {
|
---|
141 | const property = this.propertyNameOf(kind);
|
---|
142 | fixup = new FixupExpression(ctx.importExpr(type).prop(property));
|
---|
143 | definitions.set(type, fixup);
|
---|
144 | newValue = true;
|
---|
145 | }
|
---|
146 | if ((!newValue && !fixup.shared) || (newValue && forceShared)) {
|
---|
147 | const name = this.freshName();
|
---|
148 | this.statements.push(o.variable(name).set(fixup.resolved).toDeclStmt(o.INFERRED_TYPE, [o.StmtModifier.Final]));
|
---|
149 | fixup.fixup(o.variable(name));
|
---|
150 | }
|
---|
151 | return fixup;
|
---|
152 | }
|
---|
153 | getLiteralFactory(literal) {
|
---|
154 | // Create a pure function that builds an array of a mix of constant and variable expressions
|
---|
155 | if (literal instanceof o.LiteralArrayExpr) {
|
---|
156 | const argumentsForKey = literal.entries.map(e => e.isConstant() ? e : UNKNOWN_VALUE_KEY);
|
---|
157 | const key = this.keyOf(o.literalArr(argumentsForKey));
|
---|
158 | return this._getLiteralFactory(key, literal.entries, entries => o.literalArr(entries));
|
---|
159 | }
|
---|
160 | else {
|
---|
161 | const expressionForKey = o.literalMap(literal.entries.map(e => ({
|
---|
162 | key: e.key,
|
---|
163 | value: e.value.isConstant() ? e.value : UNKNOWN_VALUE_KEY,
|
---|
164 | quoted: e.quoted
|
---|
165 | })));
|
---|
166 | const key = this.keyOf(expressionForKey);
|
---|
167 | return this._getLiteralFactory(key, literal.entries.map(e => e.value), entries => o.literalMap(entries.map((value, index) => ({
|
---|
168 | key: literal.entries[index].key,
|
---|
169 | value,
|
---|
170 | quoted: literal.entries[index].quoted
|
---|
171 | }))));
|
---|
172 | }
|
---|
173 | }
|
---|
174 | _getLiteralFactory(key, values, resultMap) {
|
---|
175 | let literalFactory = this.literalFactories.get(key);
|
---|
176 | const literalFactoryArguments = values.filter((e => !e.isConstant()));
|
---|
177 | if (!literalFactory) {
|
---|
178 | const resultExpressions = values.map((e, index) => e.isConstant() ? this.getConstLiteral(e, true) : o.variable(`a${index}`));
|
---|
179 | const parameters = resultExpressions.filter(isVariable).map(e => new o.FnParam(e.name, o.DYNAMIC_TYPE));
|
---|
180 | const pureFunctionDeclaration = o.fn(parameters, [new o.ReturnStatement(resultMap(resultExpressions))], o.INFERRED_TYPE);
|
---|
181 | const name = this.freshName();
|
---|
182 | this.statements.push(o.variable(name).set(pureFunctionDeclaration).toDeclStmt(o.INFERRED_TYPE, [
|
---|
183 | o.StmtModifier.Final
|
---|
184 | ]));
|
---|
185 | literalFactory = o.variable(name);
|
---|
186 | this.literalFactories.set(key, literalFactory);
|
---|
187 | }
|
---|
188 | return { literalFactory, literalFactoryArguments };
|
---|
189 | }
|
---|
190 | /**
|
---|
191 | * Produce a unique name.
|
---|
192 | *
|
---|
193 | * The name might be unique among different prefixes if any of the prefixes end in
|
---|
194 | * a digit so the prefix should be a constant string (not based on user input) and
|
---|
195 | * must not end in a digit.
|
---|
196 | */
|
---|
197 | uniqueName(prefix) {
|
---|
198 | return `${prefix}${this.nextNameIndex++}`;
|
---|
199 | }
|
---|
200 | definitionsOf(kind) {
|
---|
201 | switch (kind) {
|
---|
202 | case 2 /* Component */:
|
---|
203 | return this.componentDefinitions;
|
---|
204 | case 1 /* Directive */:
|
---|
205 | return this.directiveDefinitions;
|
---|
206 | case 0 /* Injector */:
|
---|
207 | return this.injectorDefinitions;
|
---|
208 | case 3 /* Pipe */:
|
---|
209 | return this.pipeDefinitions;
|
---|
210 | }
|
---|
211 | }
|
---|
212 | propertyNameOf(kind) {
|
---|
213 | switch (kind) {
|
---|
214 | case 2 /* Component */:
|
---|
215 | return 'ɵcmp';
|
---|
216 | case 1 /* Directive */:
|
---|
217 | return 'ɵdir';
|
---|
218 | case 0 /* Injector */:
|
---|
219 | return 'ɵinj';
|
---|
220 | case 3 /* Pipe */:
|
---|
221 | return 'ɵpipe';
|
---|
222 | }
|
---|
223 | }
|
---|
224 | freshName() {
|
---|
225 | return this.uniqueName(CONSTANT_PREFIX);
|
---|
226 | }
|
---|
227 | keyOf(expression) {
|
---|
228 | return expression.visitExpression(new KeyVisitor(), KEY_CONTEXT);
|
---|
229 | }
|
---|
230 | }
|
---|
231 | /**
|
---|
232 | * Visitor used to determine if 2 expressions are equivalent and can be shared in the
|
---|
233 | * `ConstantPool`.
|
---|
234 | *
|
---|
235 | * When the id (string) generated by the visitor is equal, expressions are considered equivalent.
|
---|
236 | */
|
---|
237 | class KeyVisitor {
|
---|
238 | constructor() {
|
---|
239 | this.visitWrappedNodeExpr = invalid;
|
---|
240 | this.visitWriteVarExpr = invalid;
|
---|
241 | this.visitWriteKeyExpr = invalid;
|
---|
242 | this.visitWritePropExpr = invalid;
|
---|
243 | this.visitInvokeMethodExpr = invalid;
|
---|
244 | this.visitInvokeFunctionExpr = invalid;
|
---|
245 | this.visitTaggedTemplateExpr = invalid;
|
---|
246 | this.visitInstantiateExpr = invalid;
|
---|
247 | this.visitConditionalExpr = invalid;
|
---|
248 | this.visitNotExpr = invalid;
|
---|
249 | this.visitAssertNotNullExpr = invalid;
|
---|
250 | this.visitCastExpr = invalid;
|
---|
251 | this.visitFunctionExpr = invalid;
|
---|
252 | this.visitUnaryOperatorExpr = invalid;
|
---|
253 | this.visitBinaryOperatorExpr = invalid;
|
---|
254 | this.visitReadPropExpr = invalid;
|
---|
255 | this.visitReadKeyExpr = invalid;
|
---|
256 | this.visitCommaExpr = invalid;
|
---|
257 | this.visitLocalizedString = invalid;
|
---|
258 | }
|
---|
259 | visitLiteralExpr(ast) {
|
---|
260 | return `${typeof ast.value === 'string' ? '"' + ast.value + '"' : ast.value}`;
|
---|
261 | }
|
---|
262 | visitLiteralArrayExpr(ast, context) {
|
---|
263 | return `[${ast.entries.map(entry => entry.visitExpression(this, context)).join(',')}]`;
|
---|
264 | }
|
---|
265 | visitLiteralMapExpr(ast, context) {
|
---|
266 | const mapKey = (entry) => {
|
---|
267 | const quote = entry.quoted ? '"' : '';
|
---|
268 | return `${quote}${entry.key}${quote}`;
|
---|
269 | };
|
---|
270 | const mapEntry = (entry) => `${mapKey(entry)}:${entry.value.visitExpression(this, context)}`;
|
---|
271 | return `{${ast.entries.map(mapEntry).join(',')}`;
|
---|
272 | }
|
---|
273 | visitExternalExpr(ast) {
|
---|
274 | return ast.value.moduleName ? `EX:${ast.value.moduleName}:${ast.value.name}` :
|
---|
275 | `EX:${ast.value.runtime.name}`;
|
---|
276 | }
|
---|
277 | visitReadVarExpr(node) {
|
---|
278 | return `VAR:${node.name}`;
|
---|
279 | }
|
---|
280 | visitTypeofExpr(node, context) {
|
---|
281 | return `TYPEOF:${node.expr.visitExpression(this, context)}`;
|
---|
282 | }
|
---|
283 | }
|
---|
284 | function invalid(arg) {
|
---|
285 | throw new Error(`Invalid state: Visitor ${this.constructor.name} doesn't handle ${arg.constructor.name}`);
|
---|
286 | }
|
---|
287 | function isVariable(e) {
|
---|
288 | return e instanceof o.ReadVarExpr;
|
---|
289 | }
|
---|
290 | function isLongStringLiteral(expr) {
|
---|
291 | return expr instanceof o.LiteralExpr && typeof expr.value === 'string' &&
|
---|
292 | expr.value.length >= POOL_INCLUSION_LENGTH_THRESHOLD_FOR_STRINGS;
|
---|
293 | }
|
---|
294 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRfcG9vbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9jb25zdGFudF9wb29sLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sS0FBSyxDQUFDLE1BQU0scUJBQXFCLENBQUM7QUFFekMsTUFBTSxlQUFlLEdBQUcsSUFBSSxDQUFDO0FBRTdCOzs7Ozs7O0dBT0c7QUFDSCxNQUFNLGlCQUFpQixHQUFHLENBQUMsQ0FBQyxRQUFRLENBQUMsV0FBVyxDQUFDLENBQUM7QUFTbEQ7Ozs7O0dBS0c7QUFDSCxNQUFNLFdBQVcsR0FBRyxFQUFFLENBQUM7QUFFdkI7Ozs7R0FJRztBQUNILE1BQU0sMkNBQTJDLEdBQUcsRUFBRSxDQUFDO0FBRXZ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aXMuX2dldExpdGVyYWxGYWN0b3J5KGtleSwgbGl0ZXJhbC5lbnRyaWVzLCBlbnRyaWVzID0+IG8ubGl0ZXJhbEFycihlbnRyaWVzKSk7XG4gICAgfSBlbHNlIHtcbiAgICAgIGNvbnN0IGV4cHJlc3Npb25Gb3JLZXkgPSBvLmxpdGVyYWxNYXAoXG4gICAgICAgICAgbGl0ZXJhbC5lbnRyaWVzLm1hcChlID0+ICh7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogZS5rZXksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlOiBlLnZhbHVlLmlzQ29uc3RhbnQoKSA/IGUudmFsdWUgOiBVTktOT1dOX1ZBTFVFX0tFWSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVvdGVkOiBlLnF1b3RlZFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSkpKTtcbiAgICAgIGNvbnN0IGtleSA9IHRoaXMua2V5T2YoZXhwcmVzc2lvbkZvcktleSk7XG4gICAgICByZXR1cm4gdGhpcy5fZ2V0TGl0ZXJhbEZhY3RvcnkoXG4gICAgICAgICAga2V5LCBsaXRlcmFsLmVudHJpZXMubWFwKGUgPT4gZS52YWx1ZSksXG4gICAgICAgICAgZW50cmllcyA9PiBvLmxpdGVyYWxNYXAoZW50cmllcy5tYXAoKHZhbHVlLCBpbmRleCkgPT4gKHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGtleTogbGl0ZXJhbC5lbnRyaWVzW2luZGV4XS5rZXksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1b3RlZDogbGl0ZXJhbC5lbnRyaWVzW2luZGV4XS5xdW90ZWRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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