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 3439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3450 // TODO(sra): This is a fresh template each time. We can't let the | 3450 // TODO(sra): This is a fresh template each time. We can't let the |
3451 // template manager build them. | 3451 // template manager build them. |
3452 js.Template code = js.js.uncachedExpressionTemplate(template); | 3452 js.Template code = js.js.uncachedExpressionTemplate(template); |
3453 HInstruction representation = | 3453 HInstruction representation = |
3454 new HForeignCode(code, backend.readableArrayType, inputs, | 3454 new HForeignCode(code, backend.readableArrayType, inputs, |
3455 nativeBehavior: native.NativeBehavior.PURE_ALLOCATION); | 3455 nativeBehavior: native.NativeBehavior.PURE_ALLOCATION); |
3456 return representation; | 3456 return representation; |
3457 } | 3457 } |
3458 } | 3458 } |
3459 | 3459 |
3460 visitOperatorSend(ast.Send node) { | |
3461 internalError(node, 'Unexpected operator send: ${node}'); | |
3462 } | |
3463 | |
3464 @override | 3460 @override |
3465 void visitAs(ast.Send node, ast.Node expression, DartType type, _) { | 3461 void visitAs(ast.Send node, ast.Node expression, DartType type, _) { |
3466 HInstruction expressionInstruction = visitAndPop(expression); | 3462 HInstruction expressionInstruction = visitAndPop(expression); |
3467 if (type.isMalformed) { | 3463 if (type.isMalformed) { |
3468 ErroneousElement element = type.element; | 3464 ErroneousElement element = type.element; |
3469 generateTypeError(node, element.message); | 3465 generateTypeError(node, element.message); |
3470 } else { | 3466 } else { |
3471 HInstruction converted = buildTypeConversion( | 3467 HInstruction converted = buildTypeConversion( |
3472 expressionInstruction, | 3468 expressionInstruction, |
3473 localsHandler.substInContext(type), | 3469 localsHandler.substInContext(type), |
(...skipping 3746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7220 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 7216 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
7221 unaliased.accept(this, builder); | 7217 unaliased.accept(this, builder); |
7222 } | 7218 } |
7223 | 7219 |
7224 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 7220 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
7225 JavaScriptBackend backend = builder.compiler.backend; | 7221 JavaScriptBackend backend = builder.compiler.backend; |
7226 ClassElement cls = backend.findHelper('DynamicRuntimeType'); | 7222 ClassElement cls = backend.findHelper('DynamicRuntimeType'); |
7227 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); | 7223 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); |
7228 } | 7224 } |
7229 } | 7225 } |
OLD | NEW |