| 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 override [Element.computeType] because our | 9 * methods. We need to override [Element.computeType] because our |
| 10 * optimizers may look at its declared type. | 10 * optimizers may look at its declared type. |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 cls.computeType(compiler), 'receiver', element); | 308 cls.computeType(compiler), 'receiver', element); |
| 309 // Unlike `this`, receiver is nullable since direct calls to generative | 309 // Unlike `this`, receiver is nullable since direct calls to generative |
| 310 // constructor call the constructor with `null`. | 310 // constructor call the constructor with `null`. |
| 311 HParameterValue value = | 311 HParameterValue value = |
| 312 new HParameterValue(parameter, new TypeMask.exact(cls)); | 312 new HParameterValue(parameter, new TypeMask.exact(cls)); |
| 313 builder.graph.explicitReceiverParameter = value; | 313 builder.graph.explicitReceiverParameter = value; |
| 314 builder.graph.entry.addAtEntry(value); | 314 builder.graph.entry.addAtEntry(value); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| 318 bool hasValueForDirectLocal(Element element) { | |
| 319 assert(element != null); | |
| 320 assert(isAccessedDirectly(element)); | |
| 321 return directLocals[element] != null; | |
| 322 } | |
| 323 | |
| 324 /** | 318 /** |
| 325 * Returns true if the local can be accessed directly. Boxed variables or | 319 * Returns true if the local can be accessed directly. Boxed variables or |
| 326 * captured variables that are stored in the closure-field return [false]. | 320 * captured variables that are stored in the closure-field return [false]. |
| 327 */ | 321 */ |
| 328 bool isAccessedDirectly(Element element) { | 322 bool isAccessedDirectly(Element element) { |
| 329 assert(element != null); | 323 assert(element != null); |
| 330 return redirectionMapping[element] == null | 324 return redirectionMapping[element] == null |
| 331 && !closureData.usedVariablesInTry.contains(element); | 325 && !closureData.usedVariablesInTry.contains(element); |
| 332 } | 326 } |
| 333 | 327 |
| (...skipping 2644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2978 add(interceptor); | 2972 add(interceptor); |
| 2979 return interceptor; | 2973 return interceptor; |
| 2980 } | 2974 } |
| 2981 | 2975 |
| 2982 HForeign createForeign(js.Expression code, | 2976 HForeign createForeign(js.Expression code, |
| 2983 TypeMask type, | 2977 TypeMask type, |
| 2984 List<HInstruction> inputs) { | 2978 List<HInstruction> inputs) { |
| 2985 return new HForeign(code, type, inputs); | 2979 return new HForeign(code, type, inputs); |
| 2986 } | 2980 } |
| 2987 | 2981 |
| 2988 HInstruction getRuntimeTypeInfo(HInstruction target) { | |
| 2989 pushInvokeStatic(null, backend.getGetRuntimeTypeInfo(), [target]); | |
| 2990 return pop(); | |
| 2991 } | |
| 2992 | |
| 2993 HLiteralList buildLiteralList(List<HInstruction> inputs) { | 2982 HLiteralList buildLiteralList(List<HInstruction> inputs) { |
| 2994 return new HLiteralList(inputs, backend.extendableArrayType); | 2983 return new HLiteralList(inputs, backend.extendableArrayType); |
| 2995 } | 2984 } |
| 2996 | 2985 |
| 2997 // TODO(karlklose): change construction of the representations to be GVN'able | 2986 // TODO(karlklose): change construction of the representations to be GVN'able |
| 2998 // (dartbug.com/7182). | 2987 // (dartbug.com/7182). |
| 2999 HInstruction buildTypeArgumentRepresentations(DartType type) { | 2988 HInstruction buildTypeArgumentRepresentations(DartType type) { |
| 3000 // Compute the representation of the type arguments, including access | 2989 // Compute the representation of the type arguments, including access |
| 3001 // to the runtime type information for type variables as instructions. | 2990 // to the runtime type information for type variables as instructions. |
| 3002 if (type.kind == TypeKind.TYPE_VARIABLE) { | 2991 if (type.kind == TypeKind.TYPE_VARIABLE) { |
| (...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5307 expressionStart.setBlockFlow( | 5296 expressionStart.setBlockFlow( |
| 5308 new HSwitchBlockInformation(expressionInfo, | 5297 new HSwitchBlockInformation(expressionInfo, |
| 5309 statements, | 5298 statements, |
| 5310 jumpHandler.target, | 5299 jumpHandler.target, |
| 5311 jumpHandler.labels()), | 5300 jumpHandler.labels()), |
| 5312 joinBlock); | 5301 joinBlock); |
| 5313 | 5302 |
| 5314 jumpHandler.close(); | 5303 jumpHandler.close(); |
| 5315 } | 5304 } |
| 5316 | 5305 |
| 5317 Element lookupOperator(ClassElement classElement, String operatorName) { | |
| 5318 String dartMethodName = | |
| 5319 Elements.constructOperatorName(operatorName, false); | |
| 5320 return classElement.lookupMember(dartMethodName); | |
| 5321 } | |
| 5322 | |
| 5323 visitSwitchCase(SwitchCase node) { | 5306 visitSwitchCase(SwitchCase node) { |
| 5324 compiler.internalError('SsaBuilder.visitSwitchCase'); | 5307 compiler.internalError('SsaBuilder.visitSwitchCase'); |
| 5325 } | 5308 } |
| 5326 | 5309 |
| 5327 visitCaseMatch(CaseMatch node) { | 5310 visitCaseMatch(CaseMatch node) { |
| 5328 compiler.internalError('SsaBuilder.visitCaseMatch'); | 5311 compiler.internalError('SsaBuilder.visitCaseMatch'); |
| 5329 } | 5312 } |
| 5330 | 5313 |
| 5331 visitTryStatement(TryStatement node) { | 5314 visitTryStatement(TryStatement node) { |
| 5332 // Save the current locals. The catch block and the finally block | 5315 // Save the current locals. The catch block and the finally block |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5954 new HSubGraphBlockInformation(elseBranch.graph)); | 5937 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5955 | 5938 |
| 5956 HBasicBlock conditionStartBlock = conditionBranch.block; | 5939 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5957 conditionStartBlock.setBlockFlow(info, joinBlock); | 5940 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5958 SubGraph conditionGraph = conditionBranch.graph; | 5941 SubGraph conditionGraph = conditionBranch.graph; |
| 5959 HIf branch = conditionGraph.end.last; | 5942 HIf branch = conditionGraph.end.last; |
| 5960 assert(branch is HIf); | 5943 assert(branch is HIf); |
| 5961 branch.blockInformation = conditionStartBlock.blockFlow; | 5944 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5962 } | 5945 } |
| 5963 } | 5946 } |
| OLD | NEW |