Chromium Code Reviews| Index: pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart |
| diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart |
| index a33b9c6e7312f41f923d95b50b40598027c8ed77..455e3a9cbc354e4215c74846c1640773a7f16fae 100644 |
| --- a/pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart |
| +++ b/pkg/compiler/lib/src/js_emitter/old_emitter/interceptor_emitter.dart |
| @@ -62,31 +62,25 @@ class InterceptorEmitter extends CodeEmitterHelper { |
| /** |
| * If [JSInvocationMirror._invokeOn] has been compiled, emit all the |
| * possible selector names that are intercepted into the |
| - * [interceptedNames] top-level variable. The implementation of |
| + * [interceptedNames] embedded global. The implementation of |
| * [_invokeOn] will use it to determine whether it should call the |
| * method with an extra parameter. |
| */ |
| - void emitInterceptedNames(CodeBuffer buffer) { |
| + jsAst.ObjectInitializer generateInterceptedNamesSet() { |
| // TODO(ahe): We should not generate the list of intercepted names at |
|
ahe
2015/01/07 15:31:32
You may also want to put this on you to-do list, o
floitsch
2015/01/07 15:48:12
Changed to a comment.
|
| // compile time, it can be generated automatically at runtime given |
| // subclasses of Interceptor (which can easily be identified). |
| - if (!compiler.enabledInvokeOn) return; |
| - |
| - // TODO(ahe): We should roll this into |
| - // [emitStaticNonFinalFieldInitializations]. |
| - String name = backend.namer.getNameOfGlobalField(backend.interceptedNames); |
| + if (!compiler.enabledInvokeOn) return null; |
|
ahe
2015/01/07 15:31:32
Or mirrors enabled?
floitsch
2015/01/07 15:48:12
invokeOn is the only one using the data structure.
|
| int index = 0; |
| - var invocationNames = interceptorInvocationNames.toList()..sort(); |
| - List<jsAst.Expression> elements = invocationNames.map(js.string).toList(); |
| - jsAst.ArrayInitializer array = |
| - new jsAst.ArrayInitializer(elements); |
| - |
| - jsAst.Expression assignment = |
| - js('${emitter.isolateProperties}.# = #', [name, array]); |
| - |
| - buffer.write(jsAst.prettyPrint(assignment, compiler)); |
| - buffer.write(N); |
| + List<String> invocationNames = interceptorInvocationNames.toList()..sort(); |
| + List<jsAst.Property> properties = |
| + new List<jsAst.Property>(invocationNames.length); |
| + for (int i = 0; i < invocationNames.length; i++) { |
| + String name = invocationNames[i]; |
| + properties[i] = new jsAst.Property(js.string(name), js.number(1)); |
|
ahe
2015/01/07 15:31:32
Random thought about a potential optimization:
Fo
floitsch
2015/01/07 15:48:12
I thought about it. Here I went for simple and siz
|
| + } |
| + return new jsAst.ObjectInitializer(properties, isOneLiner: true); |
| } |
| /** |