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

Side by Side Diff: lib/compiler/implementation/enqueue.dart

Issue 11264005: InvocationMirror implemented in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Optimization + updated cf comments. Created 8 years, 1 month 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
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 class EnqueueTask extends CompilerTask { 5 class EnqueueTask extends CompilerTask {
6 final Enqueuer codegen; 6 final Enqueuer codegen;
7 final Enqueuer resolution; 7 final Enqueuer resolution;
8 8
9 String get name => 'Enqueue'; 9 String get name => 'Enqueue';
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 queue.add(new WorkItem(element, elements, itemCompilationContextCreator())); 96 queue.add(new WorkItem(element, elements, itemCompilationContextCreator()));
97 97
98 // Enable runtime type support if we discover a getter called runtimeType. 98 // Enable runtime type support if we discover a getter called runtimeType.
99 // We have to enable runtime type before hitting the codegen, so 99 // We have to enable runtime type before hitting the codegen, so
100 // that constructors know whether they need to generate code for 100 // that constructors know whether they need to generate code for
101 // runtime type. 101 // runtime type.
102 if (element.isGetter() && element.name == Compiler.RUNTIME_TYPE) { 102 if (element.isGetter() && element.name == Compiler.RUNTIME_TYPE) {
103 compiler.enabledRuntimeType = true; 103 compiler.enabledRuntimeType = true;
104 } else if (element == compiler.functionApplyMethod) { 104 } else if (element == compiler.functionApplyMethod) {
105 compiler.enabledFunctionApply = true; 105 compiler.enabledFunctionApply = true;
106 } else if (element == compiler.invokeOnMethod) {
107 compiler.enabledInvokeOn = true;
106 } 108 }
107 109
108 // Enable isolate support if we start using something from the 110 // Enable isolate support if we start using something from the
109 // isolate library. 111 // isolate library.
110 LibraryElement library = element.getLibrary(); 112 LibraryElement library = element.getLibrary();
111 if (!compiler.hasIsolateSupport() 113 if (!compiler.hasIsolateSupport()
112 && library.uri.toString() == 'dart:isolate') { 114 && library.uri.toString() == 'dart:isolate') {
113 compiler.enableIsolateSupport(library); 115 compiler.enableIsolateSupport(library);
114 } 116 }
115 } 117 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 }); 242 });
241 } 243 }
242 244
243 void registerNewSelector(SourceString name, 245 void registerNewSelector(SourceString name,
244 Selector selector, 246 Selector selector,
245 Map<SourceString, Set<Selector>> selectorsMap) { 247 Map<SourceString, Set<Selector>> selectorsMap) {
246 if (name != selector.name) { 248 if (name != selector.name) {
247 String message = "$name != ${selector.name} (${selector.kind})"; 249 String message = "$name != ${selector.name} (${selector.kind})";
248 compiler.internalError("Wrong selector name: $message."); 250 compiler.internalError("Wrong selector name: $message.");
249 } 251 }
252 /*if (!compiler.enabledInvokeOn && name == Compiler.INVOKE_ON) {
ngeoffray 2012/10/26 08:34:55 Remove comment.
Johnni Winther 2012/10/26 10:18:01 Done.
253 if (selector.applies(compiler.invokeOnMethod, compiler)) {
254 compiler.enabledInvokeOn = true;
255 }
256 }*/
250 Set<Selector> selectors = 257 Set<Selector> selectors =
251 selectorsMap.putIfAbsent(name, () => new Set<Selector>()); 258 selectorsMap.putIfAbsent(name, () => new Set<Selector>());
252 if (!selectors.contains(selector)) { 259 if (!selectors.contains(selector)) {
253 selectors.add(selector); 260 selectors.add(selector);
254 handleUnseenSelector(name, selector); 261 handleUnseenSelector(name, selector);
255 } 262 }
256 } 263 }
257 264
258 void registerInvocation(SourceString methodName, Selector selector) { 265 void registerInvocation(SourceString methodName, Selector selector) {
259 task.measure(() { 266 task.measure(() {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 369
363 String toString() => 'Enqueuer($name)'; 370 String toString() => 'Enqueuer($name)';
364 371
365 registerUsedSelector(Selector selector) { 372 registerUsedSelector(Selector selector) {
366 Element interceptor = compiler.backend.getInterceptor(selector); 373 Element interceptor = compiler.backend.getInterceptor(selector);
367 if (interceptor != null) { 374 if (interceptor != null) {
368 registerStaticUse(interceptor); 375 registerStaticUse(interceptor);
369 } 376 }
370 } 377 }
371 } 378 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698