| 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 /** | 7 /** |
| 8 * A special element for the extra parameter taken by intercepted | 8 * A special element for the extra parameter taken by intercepted |
| 9 * methods. We need to implement [TypedElement.type] because our | 9 * methods. We need to implement [TypedElement.type] because our |
| 10 * optimizers may look at its declared type. | 10 * optimizers may look at its declared type. |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 builder.jumpTargets.remove(target); | 878 builder.jumpTargets.remove(target); |
| 879 } | 879 } |
| 880 super.close(); | 880 super.close(); |
| 881 } | 881 } |
| 882 } | 882 } |
| 883 | 883 |
| 884 /** | 884 /** |
| 885 * This class builds SSA nodes for functions represented in AST. | 885 * This class builds SSA nodes for functions represented in AST. |
| 886 */ | 886 */ |
| 887 class SsaBuilder extends ResolvedVisitor { | 887 class SsaBuilder extends ResolvedVisitor { |
| 888 final Compiler compiler; | |
| 889 final JavaScriptBackend backend; | 888 final JavaScriptBackend backend; |
| 890 final ConstantSystem constantSystem; | 889 final ConstantSystem constantSystem; |
| 891 final CodegenWorkItem work; | 890 final CodegenWorkItem work; |
| 892 final RuntimeTypes rti; | 891 final RuntimeTypes rti; |
| 893 | 892 |
| 894 /* This field is used by the native handler. */ | 893 /* This field is used by the native handler. */ |
| 895 final NativeEmitter nativeEmitter; | 894 final NativeEmitter nativeEmitter; |
| 896 | 895 |
| 897 final HGraph graph = new HGraph(); | 896 final HGraph graph = new HGraph(); |
| 898 | 897 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 * Variables stored in the current activation. These variables are | 956 * Variables stored in the current activation. These variables are |
| 958 * being updated in try/catch blocks, and should be | 957 * being updated in try/catch blocks, and should be |
| 959 * accessed indirectly through [HLocalGet] and [HLocalSet]. | 958 * accessed indirectly through [HLocalGet] and [HLocalSet]. |
| 960 */ | 959 */ |
| 961 Map<Element, HLocalValue> activationVariables = <Element, HLocalValue>{}; | 960 Map<Element, HLocalValue> activationVariables = <Element, HLocalValue>{}; |
| 962 | 961 |
| 963 // We build the Ssa graph by simulating a stack machine. | 962 // We build the Ssa graph by simulating a stack machine. |
| 964 List<HInstruction> stack = <HInstruction>[]; | 963 List<HInstruction> stack = <HInstruction>[]; |
| 965 | 964 |
| 966 SsaBuilder(JavaScriptBackend backend, | 965 SsaBuilder(JavaScriptBackend backend, |
| 967 CodegenWorkItem work, | 966 CodegenWorkItem work, |
| 968 this.nativeEmitter) | 967 this.nativeEmitter) |
| 969 : this.backend = backend, | 968 : this.backend = backend, |
| 970 this.compiler = backend.compiler, | |
| 971 this.constantSystem = backend.constantSystem, | 969 this.constantSystem = backend.constantSystem, |
| 972 this.work = work, | 970 this.work = work, |
| 973 this.rti = backend.rti, | 971 this.rti = backend.rti, |
| 974 super(work.resolutionTree, backend.compiler) { | 972 super(work.resolutionTree, backend.compiler) { |
| 975 localsHandler = new LocalsHandler(this); | 973 localsHandler = new LocalsHandler(this); |
| 976 sourceElementStack.add(work.element); | 974 sourceElementStack.add(work.element); |
| 977 } | 975 } |
| 978 | 976 |
| 979 Element get sourceElement => sourceElementStack.last; | 977 Element get sourceElement => sourceElementStack.last; |
| 980 | 978 |
| (...skipping 5135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6116 DartType unaliased = type.unalias(builder.compiler); | 6114 DartType unaliased = type.unalias(builder.compiler); |
| 6117 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6115 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 6118 unaliased.accept(this, builder); | 6116 unaliased.accept(this, builder); |
| 6119 } | 6117 } |
| 6120 | 6118 |
| 6121 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6119 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 6122 ClassElement cls = builder.compiler.findHelper('DynamicRuntimeType'); | 6120 ClassElement cls = builder.compiler.findHelper('DynamicRuntimeType'); |
| 6123 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); | 6121 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); |
| 6124 } | 6122 } |
| 6125 } | 6123 } |
| OLD | NEW |