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 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 | 1145 |
1146 void addWithPosition(HInstruction instruction, ast.Node node) { | 1146 void addWithPosition(HInstruction instruction, ast.Node node) { |
1147 add(attachPosition(instruction, node)); | 1147 add(attachPosition(instruction, node)); |
1148 } | 1148 } |
1149 | 1149 |
1150 SourceFile currentSourceFile() { | 1150 SourceFile currentSourceFile() { |
1151 return sourceElement.implementation.compilationUnit.script.file; | 1151 return sourceElement.implementation.compilationUnit.script.file; |
1152 } | 1152 } |
1153 | 1153 |
1154 void checkValidSourceFileLocation( | 1154 void checkValidSourceFileLocation( |
1155 SourceFileLocation location, SourceFile sourceFile, int offset) { | 1155 SourceLocation location, SourceFile sourceFile, int offset) { |
1156 if (!location.isValid()) { | 1156 if (!location.isValid) { |
1157 throw MessageKind.INVALID_SOURCE_FILE_LOCATION.message( | 1157 throw MessageKind.INVALID_SOURCE_FILE_LOCATION.message( |
1158 {'offset': offset, | 1158 {'offset': offset, |
1159 'fileName': sourceFile.filename, | 1159 'fileName': sourceFile.filename, |
1160 'length': sourceFile.length}); | 1160 'length': sourceFile.length}); |
1161 } | 1161 } |
1162 } | 1162 } |
1163 | 1163 |
1164 /** | 1164 /** |
1165 * Returns a complete argument list for a call of [function]. | 1165 * Returns a complete argument list for a call of [function]. |
1166 */ | 1166 */ |
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2508 SourceInformation sourceInformationForBeginToken(ast.Node node) { | 2508 SourceInformation sourceInformationForBeginToken(ast.Node node) { |
2509 return new StartEndSourceInformation(sourceFileLocationForBeginToken(node)); | 2509 return new StartEndSourceInformation(sourceFileLocationForBeginToken(node)); |
2510 } | 2510 } |
2511 | 2511 |
2512 SourceInformation sourceInformationForBeginEndToken(ast.Node node) { | 2512 SourceInformation sourceInformationForBeginEndToken(ast.Node node) { |
2513 return new StartEndSourceInformation( | 2513 return new StartEndSourceInformation( |
2514 sourceFileLocationForBeginToken(node), | 2514 sourceFileLocationForBeginToken(node), |
2515 sourceFileLocationForEndToken(node)); | 2515 sourceFileLocationForEndToken(node)); |
2516 } | 2516 } |
2517 | 2517 |
2518 SourceFileLocation sourceFileLocationForBeginToken(ast.Node node) => | 2518 SourceLocation sourceFileLocationForBeginToken(ast.Node node) => |
2519 sourceFileLocationForToken(node, node.getBeginToken()); | 2519 sourceFileLocationForToken(node, node.getBeginToken()); |
2520 | 2520 |
2521 SourceFileLocation sourceFileLocationForEndToken(ast.Node node) => | 2521 SourceLocation sourceFileLocationForEndToken(ast.Node node) => |
2522 sourceFileLocationForToken(node, node.getEndToken()); | 2522 sourceFileLocationForToken(node, node.getEndToken()); |
2523 | 2523 |
2524 SourceFileLocation sourceFileLocationForToken(ast.Node node, Token token) { | 2524 SourceLocation sourceFileLocationForToken(ast.Node node, Token token) { |
2525 SourceFile sourceFile = currentSourceFile(); | 2525 SourceFile sourceFile = currentSourceFile(); |
2526 SourceFileLocation location = | 2526 SourceLocation location = |
2527 new TokenSourceFileLocation(sourceFile, token, sourceElement.name); | 2527 new TokenSourceLocation(sourceFile, token, sourceElement.name); |
2528 checkValidSourceFileLocation(location, sourceFile, token.charOffset); | 2528 checkValidSourceFileLocation(location, sourceFile, token.charOffset); |
2529 return location; | 2529 return location; |
2530 } | 2530 } |
2531 | 2531 |
2532 void visit(ast.Node node) { | 2532 void visit(ast.Node node) { |
2533 if (node != null) node.accept(this); | 2533 if (node != null) node.accept(this); |
2534 } | 2534 } |
2535 | 2535 |
2536 visitBlock(ast.Block node) { | 2536 visitBlock(ast.Block node) { |
2537 assert(!isAborted()); | 2537 assert(!isAborted()); |
(...skipping 4377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6915 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6915 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
6916 unaliased.accept(this, builder); | 6916 unaliased.accept(this, builder); |
6917 } | 6917 } |
6918 | 6918 |
6919 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6919 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
6920 JavaScriptBackend backend = builder.compiler.backend; | 6920 JavaScriptBackend backend = builder.compiler.backend; |
6921 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 6921 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
6922 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 6922 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
6923 } | 6923 } |
6924 } | 6924 } |
OLD | NEW |