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

Side by Side Diff: pkg/compiler/lib/src/js_backend/constant_emitter.dart

Issue 784843002: Move isolateStaticClosureAccess and isolateLazyInitializerAccess from namer to emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/namer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of js_backend; 5 part of js_backend;
6 6
7 class ConstantEmitter { 7 class ConstantEmitter {
8 ConstantReferenceEmitter _referenceEmitter; 8 ConstantReferenceEmitter _referenceEmitter;
9 ConstantLiteralEmitter _literalEmitter; 9 ConstantLiteralEmitter _literalEmitter;
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 */ 56 */
57 class ConstantReferenceEmitter 57 class ConstantReferenceEmitter
58 implements ConstantValueVisitor<jsAst.Expression> { 58 implements ConstantValueVisitor<jsAst.Expression> {
59 final Compiler compiler; 59 final Compiler compiler;
60 final Namer namer; 60 final Namer namer;
61 61
62 final ConstantEmitter constantEmitter; 62 final ConstantEmitter constantEmitter;
63 63
64 ConstantReferenceEmitter(this.compiler, this.namer, this.constantEmitter); 64 ConstantReferenceEmitter(this.compiler, this.namer, this.constantEmitter);
65 65
66 JavaScriptBackend get backend => compiler.backend;
67
66 jsAst.Expression generate(ConstantValue constant) { 68 jsAst.Expression generate(ConstantValue constant) {
67 return _visit(constant); 69 return _visit(constant);
68 } 70 }
69 71
70 jsAst.Expression _visit(ConstantValue constant) { 72 jsAst.Expression _visit(ConstantValue constant) {
71 return constant.accept(this); 73 return constant.accept(this);
72 } 74 }
73 75
74 jsAst.Expression emitCanonicalVersion(ConstantValue constant) { 76 jsAst.Expression emitCanonicalVersion(ConstantValue constant) {
75 String name = namer.constantName(constant); 77 String name = namer.constantName(constant);
76 return new jsAst.PropertyAccess.field( 78 return new jsAst.PropertyAccess.field(
77 new jsAst.VariableUse(namer.globalObjectForConstant(constant)), name); 79 new jsAst.VariableUse(namer.globalObjectForConstant(constant)), name);
78 } 80 }
79 81
80 jsAst.Expression literal(ConstantValue constant) { 82 jsAst.Expression literal(ConstantValue constant) {
81 return constantEmitter.literal(constant); 83 return constantEmitter.literal(constant);
82 } 84 }
83 85
84 jsAst.Expression visitFunction(FunctionConstantValue constant) { 86 jsAst.Expression visitFunction(FunctionConstantValue constant) {
85 return namer.isolateStaticClosureAccess(constant.element); 87 return backend.emitter.isolateStaticClosureAccess(constant.element);
86 } 88 }
87 89
88 jsAst.Expression visitNull(NullConstantValue constant) { 90 jsAst.Expression visitNull(NullConstantValue constant) {
89 return literal(constant); 91 return literal(constant);
90 } 92 }
91 93
92 jsAst.Expression visitInt(IntConstantValue constant) { 94 jsAst.Expression visitInt(IntConstantValue constant) {
93 return literal(constant); 95 return literal(constant);
94 } 96 }
95 97
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 return new jsAst.Call(getHelperProperty(backend.getSetRuntimeTypeInfo()), 382 return new jsAst.Call(getHelperProperty(backend.getSetRuntimeTypeInfo()),
381 [value, argumentList]); 383 [value, argumentList]);
382 } 384 }
383 return value; 385 return value;
384 } 386 }
385 387
386 jsAst.Expression visitDeferred(DeferredConstantValue constant) { 388 jsAst.Expression visitDeferred(DeferredConstantValue constant) {
387 return constantEmitter.reference(constant.referenced); 389 return constantEmitter.reference(constant.referenced);
388 } 390 }
389 } 391 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698