| 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 typedef void Recompile(Element element); | 5 typedef void Recompile(Element element); |
| 6 | 6 |
| 7 class ReturnInfo { | 7 class ReturnInfo { |
| 8 HType returnType; | 8 HType returnType; |
| 9 List<Element> compiledFunctions; | 9 List<Element> compiledFunctions; |
| 10 | 10 |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 394 |
| 395 JavaScriptItemCompilationContext() : types = new HTypeMap(); | 395 JavaScriptItemCompilationContext() : types = new HTypeMap(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 class JavaScriptBackend extends Backend { | 398 class JavaScriptBackend extends Backend { |
| 399 SsaBuilderTask builder; | 399 SsaBuilderTask builder; |
| 400 SsaOptimizerTask optimizer; | 400 SsaOptimizerTask optimizer; |
| 401 SsaCodeGeneratorTask generator; | 401 SsaCodeGeneratorTask generator; |
| 402 CodeEmitterTask emitter; | 402 CodeEmitterTask emitter; |
| 403 | 403 |
| 404 /** |
| 405 * Interface used to determine if an object has the JavaScript |
| 406 * indexing behavior. The interface is only visible to specific |
| 407 * libraries. |
| 408 */ |
| 409 ClassElement jsIndexingBehaviorInterface; |
| 410 |
| 404 final Map<Element, Map<Element, HType>> fieldInitializers; | 411 final Map<Element, Map<Element, HType>> fieldInitializers; |
| 405 final Map<Element, Map<Element, HType>> fieldConstructorSetters; | 412 final Map<Element, Map<Element, HType>> fieldConstructorSetters; |
| 406 final Map<Element, Map<Element, HType>> fieldSettersType; | 413 final Map<Element, Map<Element, HType>> fieldSettersType; |
| 407 | 414 |
| 408 final Map<Element, ReturnInfo> returnInfo; | 415 final Map<Element, ReturnInfo> returnInfo; |
| 409 | 416 |
| 410 final List<Element> invalidateAfterCodegen; | 417 final List<Element> invalidateAfterCodegen; |
| 411 ArgumentTypesRegistry argumentTypes; | 418 ArgumentTypesRegistry argumentTypes; |
| 412 | 419 |
| 413 List<CompilerTask> get tasks { | 420 List<CompilerTask> get tasks { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 432 return compiler.findHelper(const SourceString("throwCyclicInit")); | 439 return compiler.findHelper(const SourceString("throwCyclicInit")); |
| 433 } | 440 } |
| 434 | 441 |
| 435 JavaScriptItemCompilationContext createItemCompilationContext() { | 442 JavaScriptItemCompilationContext createItemCompilationContext() { |
| 436 return new JavaScriptItemCompilationContext(); | 443 return new JavaScriptItemCompilationContext(); |
| 437 } | 444 } |
| 438 | 445 |
| 439 void enqueueHelpers(Enqueuer world) { | 446 void enqueueHelpers(Enqueuer world) { |
| 440 enqueueAllTopLevelFunctions(compiler.jsHelperLibrary, world); | 447 enqueueAllTopLevelFunctions(compiler.jsHelperLibrary, world); |
| 441 enqueueAllTopLevelFunctions(compiler.interceptorsLibrary, world); | 448 enqueueAllTopLevelFunctions(compiler.interceptorsLibrary, world); |
| 449 |
| 450 jsIndexingBehaviorInterface = |
| 451 compiler.findHelper(const SourceString('JavaScriptIndexingBehavior')); |
| 452 if (jsIndexingBehaviorInterface != null) { |
| 453 world.registerIsCheck(jsIndexingBehaviorInterface.computeType(compiler)); |
| 454 } |
| 455 |
| 442 for (var helper in [const SourceString('Closure'), | 456 for (var helper in [const SourceString('Closure'), |
| 443 const SourceString('ConstantMap'), | 457 const SourceString('ConstantMap'), |
| 444 const SourceString('ConstantProtoMap')]) { | 458 const SourceString('ConstantProtoMap')]) { |
| 445 var e = compiler.findHelper(helper); | 459 var e = compiler.findHelper(helper); |
| 446 if (e !== null) world.registerInstantiatedClass(e); | 460 if (e !== null) world.registerInstantiatedClass(e); |
| 447 } | 461 } |
| 448 } | 462 } |
| 449 | 463 |
| 450 void codegen(WorkItem work) { | 464 void codegen(WorkItem work) { |
| 451 if (work.element.kind.category == ElementCategory.VARIABLE) { | 465 if (work.element.kind.category == ElementCategory.VARIABLE) { |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 return const SourceString('listSuperTypeCheck'); | 715 return const SourceString('listSuperTypeCheck'); |
| 702 } | 716 } |
| 703 } else if (nativeCheck) { | 717 } else if (nativeCheck) { |
| 704 return const SourceString('callTypeCheck'); | 718 return const SourceString('callTypeCheck'); |
| 705 } else { | 719 } else { |
| 706 return const SourceString('propertyTypeCheck'); | 720 return const SourceString('propertyTypeCheck'); |
| 707 } | 721 } |
| 708 } | 722 } |
| 709 } | 723 } |
| 710 } | 724 } |
| OLD | NEW |