Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 class EnqueueTask extends CompilerTask { | 7 class EnqueueTask extends CompilerTask { |
| 8 final ResolutionEnqueuer resolution; | 8 final ResolutionEnqueuer resolution; |
| 9 final CodegenEnqueuer codegen; | 9 final CodegenEnqueuer codegen; |
| 10 | 10 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 void registerGetOfStaticFunction(FunctionElement element) { | 312 void registerGetOfStaticFunction(FunctionElement element) { |
| 313 registerStaticUse(element); | 313 registerStaticUse(element); |
| 314 universe.staticFunctionsNeedingGetter.add(element); | 314 universe.staticFunctionsNeedingGetter.add(element); |
| 315 } | 315 } |
| 316 | 316 |
| 317 void registerDynamicInvocation(SourceString methodName, Selector selector) { | 317 void registerDynamicInvocation(SourceString methodName, Selector selector) { |
| 318 assert(selector != null); | 318 assert(selector != null); |
| 319 registerInvocation(methodName, selector); | 319 registerInvocation(methodName, selector); |
| 320 } | 320 } |
| 321 | 321 |
| 322 void registerDynamicInvocationOf(Element element) { | 322 void registerDynamicInvocationOf(Element element, Selector selector) { |
|
kasperl
2013/02/06 07:24:03
So the selector here is always a call here? If so,
ngeoffray
2013/02/06 08:11:55
Yes, it's only a call selector. I added an assert
| |
| 323 addToWorkList(element); | 323 if (element.isFunction()) { |
| 324 addToWorkList(element); | |
| 325 } else { | |
| 326 assert(element.isAbstractField()); | |
| 327 AbstractFieldElement field = element; | |
| 328 addToWorkList(field.getter); | |
| 329 } | |
| 330 // We also need to add the selector to the invoked names map, | |
| 331 // because the emitter uses that map to generate parameter stubs. | |
| 332 Set<Selector> selectors = universe.invokedNames.putIfAbsent( | |
| 333 element.name, () => new Set<Selector>()); | |
| 334 selectors.add(selector); | |
| 324 } | 335 } |
| 325 | 336 |
| 326 void registerDynamicGetter(SourceString methodName, Selector selector) { | 337 void registerDynamicGetter(SourceString methodName, Selector selector) { |
| 327 registerInvokedGetter(methodName, selector); | 338 registerInvokedGetter(methodName, selector); |
| 328 } | 339 } |
| 329 | 340 |
| 330 void registerDynamicSetter(SourceString methodName, Selector selector) { | 341 void registerDynamicSetter(SourceString methodName, Selector selector) { |
| 331 registerInvokedSetter(methodName, selector); | 342 registerInvokedSetter(methodName, selector); |
| 332 } | 343 } |
| 333 | 344 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 addToWorkList( | 449 addToWorkList( |
| 439 compiler.isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE)); | 450 compiler.isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE)); |
| 440 addToWorkList(compiler.isolateHelperLibrary.find( | 451 addToWorkList(compiler.isolateHelperLibrary.find( |
| 441 const SourceString('_currentIsolate'))); | 452 const SourceString('_currentIsolate'))); |
| 442 addToWorkList(compiler.isolateHelperLibrary.find( | 453 addToWorkList(compiler.isolateHelperLibrary.find( |
| 443 const SourceString('_callInIsolate'))); | 454 const SourceString('_callInIsolate'))); |
| 444 } | 455 } |
| 445 | 456 |
| 446 void enableNoSuchMethod(Element element) { | 457 void enableNoSuchMethod(Element element) { |
| 447 if (compiler.enabledNoSuchMethod) return; | 458 if (compiler.enabledNoSuchMethod) return; |
| 459 Selector selector = new Selector.noSuchMethod(); | |
| 448 if (identical(element.getEnclosingClass(), compiler.objectClass)) { | 460 if (identical(element.getEnclosingClass(), compiler.objectClass)) { |
| 449 registerDynamicInvocationOf(element); | 461 registerDynamicInvocationOf(element, selector); |
| 450 return; | 462 return; |
| 451 } | 463 } |
| 452 compiler.enabledNoSuchMethod = true; | 464 compiler.enabledNoSuchMethod = true; |
| 453 Selector selector = new Selector.noSuchMethod(); | |
| 454 registerInvocation(Compiler.NO_SUCH_METHOD, selector); | 465 registerInvocation(Compiler.NO_SUCH_METHOD, selector); |
| 455 | 466 |
| 456 compiler.createInvocationMirrorElement = | 467 compiler.createInvocationMirrorElement = |
| 457 compiler.findHelper(Compiler.CREATE_INVOCATION_MIRROR); | 468 compiler.findHelper(Compiler.CREATE_INVOCATION_MIRROR); |
| 458 addToWorkList(compiler.createInvocationMirrorElement); | 469 addToWorkList(compiler.createInvocationMirrorElement); |
| 459 } | 470 } |
| 460 | 471 |
| 461 void forEach(f(WorkItem work)) { | 472 void forEach(f(WorkItem work)) { |
| 462 while (!queue.isEmpty) { | 473 while (!queue.isEmpty) { |
| 463 // TODO(johnniwinther): Find an optimal process order for resolution. | 474 // TODO(johnniwinther): Find an optimal process order for resolution. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 while(!queue.isEmpty) { | 563 while(!queue.isEmpty) { |
| 553 // TODO(johnniwinther): Find an optimal process order for codegen. | 564 // TODO(johnniwinther): Find an optimal process order for codegen. |
| 554 f(queue.removeLast()); | 565 f(queue.removeLast()); |
| 555 } | 566 } |
| 556 } | 567 } |
| 557 | 568 |
| 558 void _logSpecificSummary(log(message)) { | 569 void _logSpecificSummary(log(message)) { |
| 559 log('Compiled ${universe.generatedCode.length} methods.'); | 570 log('Compiled ${universe.generatedCode.length} methods.'); |
| 560 } | 571 } |
| 561 } | 572 } |
| OLD | NEW |