| 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 class Interceptors { | 5 class Interceptors { |
| 6 Compiler compiler; | 6 Compiler compiler; |
| 7 Interceptors(Compiler this.compiler); | 7 Interceptors(Compiler this.compiler); |
| 8 | 8 |
| 9 SourceString mapOperatorToMethodName(Operator op) { | 9 SourceString mapOperatorToMethodName(Operator op) { |
| 10 String name = op.source.stringValue; | 10 String name = op.source.stringValue; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 if (signature.optionalParameterCount > 0) { | 212 if (signature.optionalParameterCount > 0) { |
| 213 defaultValueTypes = | 213 defaultValueTypes = |
| 214 new OptionalParameterTypes(signature.optionalParameterCount); | 214 new OptionalParameterTypes(signature.optionalParameterCount); |
| 215 int index = 0; | 215 int index = 0; |
| 216 signature.forEachOptionalParameter((Element parameter) { | 216 signature.forEachOptionalParameter((Element parameter) { |
| 217 Constant defaultValue = compiler.compileVariable(parameter); | 217 Constant defaultValue = compiler.compileVariable(parameter); |
| 218 HType type = HGraph.mapConstantTypeToSsaType(defaultValue); | 218 HType type = HGraph.mapConstantTypeToSsaType(defaultValue); |
| 219 defaultValueTypes.update(index, parameter.name, type); | 219 defaultValueTypes.update(index, parameter.name, type); |
| 220 index++; | 220 index++; |
| 221 }); | 221 }); |
| 222 } else { |
| 223 // TODO(ahe): I have disabled type optimizations for |
| 224 // optional arguments as the types are stored in the wrong |
| 225 // order. |
| 226 HTypeList parameterTypes = |
| 227 backend.optimisticParameterTypes(element.declaration, |
| 228 defaultValueTypes); |
| 229 if (!parameterTypes.allUnknown) { |
| 230 int i = 0; |
| 231 signature.forEachParameter((Element param) { |
| 232 builder.parameters[param].guaranteedType = parameterTypes[i++]; |
| 233 }); |
| 234 } |
| 235 backend.registerParameterTypesOptimization( |
| 236 element.declaration, parameterTypes, defaultValueTypes); |
| 222 } | 237 } |
| 223 HTypeList parameterTypes = | |
| 224 backend.optimisticParameterTypes(element.declaration, | |
| 225 defaultValueTypes); | |
| 226 if (!parameterTypes.allUnknown) { | |
| 227 int i = 0; | |
| 228 signature.orderedForEachParameter((Element param) { | |
| 229 builder.parameters[param].guaranteedType = parameterTypes[i++]; | |
| 230 }); | |
| 231 } | |
| 232 backend.registerParameterTypesOptimization( | |
| 233 element.declaration, parameterTypes, defaultValueTypes); | |
| 234 } | 238 } |
| 235 | 239 |
| 236 if (compiler.tracer.enabled) { | 240 if (compiler.tracer.enabled) { |
| 237 String name; | 241 String name; |
| 238 if (element.isMember()) { | 242 if (element.isMember()) { |
| 239 String className = element.getEnclosingClass().name.slowToString(); | 243 String className = element.getEnclosingClass().name.slowToString(); |
| 240 String memberName = element.name.slowToString(); | 244 String memberName = element.name.slowToString(); |
| 241 name = "$className.$memberName"; | 245 name = "$className.$memberName"; |
| 242 if (element.isGenerativeConstructorBody()) { | 246 if (element.isGenerativeConstructorBody()) { |
| 243 name = "$name (body)"; | 247 name = "$name (body)"; |
| (...skipping 4238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4482 new HSubGraphBlockInformation(elseBranch.graph)); | 4486 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4483 | 4487 |
| 4484 HBasicBlock conditionStartBlock = conditionBranch.block; | 4488 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4485 conditionStartBlock.setBlockFlow(info, joinBlock); | 4489 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4486 SubGraph conditionGraph = conditionBranch.graph; | 4490 SubGraph conditionGraph = conditionBranch.graph; |
| 4487 HIf branch = conditionGraph.end.last; | 4491 HIf branch = conditionGraph.end.last; |
| 4488 assert(branch is HIf); | 4492 assert(branch is HIf); |
| 4489 branch.blockInformation = conditionStartBlock.blockFlow; | 4493 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4490 } | 4494 } |
| 4491 } | 4495 } |
| OLD | NEW |