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 ssa; | 5 part of ssa; |
6 | 6 |
7 class SsaFunctionCompiler implements FunctionCompiler { | 7 class SsaFunctionCompiler implements FunctionCompiler { |
8 SsaCodeGeneratorTask generator; | 8 SsaCodeGeneratorTask generator; |
9 SsaBuilderTask builder; | 9 SsaBuilderTask builder; |
10 SsaOptimizerTask optimizer; | 10 SsaOptimizerTask optimizer; |
(...skipping 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3100 nestedClosureData.getLocalVariableForClosureField(field); | 3100 nestedClosureData.getLocalVariableForClosureField(field); |
3101 assert(capturedLocal != null); | 3101 assert(capturedLocal != null); |
3102 capturedVariables.add(localsHandler.readLocal(capturedLocal)); | 3102 capturedVariables.add(localsHandler.readLocal(capturedLocal)); |
3103 }); | 3103 }); |
3104 | 3104 |
3105 TypeMask type = | 3105 TypeMask type = |
3106 new TypeMask.nonNullExact(compiler.functionClass, compiler.world); | 3106 new TypeMask.nonNullExact(compiler.functionClass, compiler.world); |
3107 push(new HForeignNew(closureClassElement, type, capturedVariables)); | 3107 push(new HForeignNew(closureClassElement, type, capturedVariables)); |
3108 | 3108 |
3109 Element methodElement = nestedClosureData.closureElement; | 3109 Element methodElement = nestedClosureData.closureElement; |
3110 if (compiler.backend.methodNeedsRti(methodElement)) { | 3110 registry.registerInstantiatedClosure(methodElement); |
3111 registry.registerClosureWithFreeTypeVariables(methodElement); | |
3112 } | |
3113 } | 3111 } |
3114 | 3112 |
3115 visitFunctionDeclaration(ast.FunctionDeclaration node) { | 3113 visitFunctionDeclaration(ast.FunctionDeclaration node) { |
3116 assert(isReachable); | 3114 assert(isReachable); |
3117 visit(node.function); | 3115 visit(node.function); |
3118 LocalFunctionElement localFunction = | 3116 LocalFunctionElement localFunction = |
3119 elements.getFunctionDefinition(node.function); | 3117 elements.getFunctionDefinition(node.function); |
3120 localsHandler.updateLocal(localFunction, pop()); | 3118 localsHandler.updateLocal(localFunction, pop()); |
3121 } | 3119 } |
3122 | 3120 |
(...skipping 4988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8111 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 8109 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
8112 unaliased.accept(this, builder); | 8110 unaliased.accept(this, builder); |
8113 } | 8111 } |
8114 | 8112 |
8115 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 8113 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
8116 JavaScriptBackend backend = builder.compiler.backend; | 8114 JavaScriptBackend backend = builder.compiler.backend; |
8117 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 8115 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
8118 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 8116 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
8119 } | 8117 } |
8120 } | 8118 } |
OLD | NEW |