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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart

Issue 602663002: Split interceptor emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
index 32844bf2fd452c68d0c5fe994dc7f504cf64ca8d..855c3c23053777cac82523effa2e101ed52a815f 100644
--- a/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
@@ -16,7 +16,6 @@ class CodeEmitterTask extends CompilerTask {
// TODO(floitsch): the code-emitter task should not need a namer.
final Namer namer;
final TypeTestEmitter typeTestEmitter = new TypeTestEmitter();
- final InterceptorEmitter interceptorEmitter = new InterceptorEmitter();
NativeEmitter nativeEmitter;
OldEmitter oldEmitter;
Emitter emitter;
@@ -47,7 +46,6 @@ class CodeEmitterTask extends CompilerTask {
: oldEmitter;
nativeEmitter = new NativeEmitter(this);
typeTestEmitter.emitter = this.oldEmitter;
- interceptorEmitter.emitter = this.oldEmitter;
// TODO(18886): Remove this call (and the show in the import) once the
// memory-leak in the VM is fixed.
templateManager.clear();
@@ -62,6 +60,19 @@ class CodeEmitterTask extends CompilerTask {
return emitter.constantReference(value);
}
+ Set<ClassElement> interceptorsReferencedFromConstants() {
floitsch 2014/09/24 14:02:06 Straight copy from `interceptor_emitter.dart`.
+ Set<ClassElement> classes = new Set<ClassElement>();
+ JavaScriptConstantCompiler handler = backend.constants;
+ List<Constant> constants = handler.getConstantsForEmission();
+ for (Constant constant in constants) {
+ if (constant is InterceptorConstant) {
+ InterceptorConstant interceptorConstant = constant;
+ classes.add(interceptorConstant.dispatchedType.element);
+ }
+ }
+ return classes;
+ }
+
/**
* Return a function that returns true if its argument is a class
* that needs to be emitted.
@@ -84,7 +95,7 @@ class CodeEmitterTask extends CompilerTask {
);
// Add interceptors referenced by constants.
- needed.addAll(interceptorEmitter.interceptorsReferencedFromConstants());
+ needed.addAll(interceptorsReferencedFromConstants());
// Add unneeded interceptors to the [unneededClasses] set.
for (ClassElement interceptor in backend.interceptedClasses) {
@@ -281,7 +292,7 @@ class OldEmitter implements Emitter {
final ClassEmitter classEmitter = new ClassEmitter();
final NsmEmitter nsmEmitter = new NsmEmitter();
TypeTestEmitter get typeTestEmitter => task.typeTestEmitter;
- InterceptorEmitter get interceptorEmitter => task.interceptorEmitter;
+ final InterceptorEmitter interceptorEmitter = new InterceptorEmitter();
final MetadataEmitter metadataEmitter = new MetadataEmitter();
final Set<Constant> cachedEmittedConstants;

Powered by Google App Engine
This is Rietveld 408576698