Chromium Code Reviews| 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 3235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3246 member = closureClass.methodElement; | 3246 member = closureClass.methodElement; |
| 3247 member = member.getOutermostEnclosingMemberOrTopLevel(); | 3247 member = member.getOutermostEnclosingMemberOrTopLevel(); |
| 3248 } | 3248 } |
| 3249 if (isClosure && member.isFactoryConstructor()) { | 3249 if (isClosure && member.isFactoryConstructor()) { |
| 3250 // The type variable is used from a closure in a factory constructor. The | 3250 // The type variable is used from a closure in a factory constructor. The |
| 3251 // value of the type argument is stored as a local on the closure itself. | 3251 // value of the type argument is stored as a local on the closure itself. |
| 3252 return localsHandler.readLocal(type.element); | 3252 return localsHandler.readLocal(type.element); |
| 3253 } else if (member.isConstructor() || | 3253 } else if (member.isConstructor() || |
| 3254 member.isGenerativeConstructorBody() || | 3254 member.isGenerativeConstructorBody() || |
| 3255 member.isField()) { | 3255 member.isField()) { |
| 3256 // The type variable is stored in a parameter of the method. | 3256 if (isClosure && !member.isField()) { |
| 3257 return localsHandler.readLocal(type.element); | 3257 // The type variable is stored on the object and needs to be accessed |
|
ngeoffray
2013/06/18 08:00:43
which object? The real "this" object?
karlklose
2013/06/18 11:05:00
Yes.
| |
| 3258 // using the this-reference in the closure. | |
| 3259 return readTypeVariable(member.getEnclosingClass(), | |
|
ngeoffray
2013/06/18 08:00:43
I would move this code in a if (isClosure) test li
karlklose
2013/06/18 11:05:00
Done.
| |
| 3260 type.element); | |
|
ngeoffray
2013/06/18 08:00:43
Fits in one line?
karlklose
2013/06/18 11:05:00
Done.
| |
| 3261 } else { | |
| 3262 // The type variable is stored in a parameter of the method. | |
| 3263 return localsHandler.readLocal(type.element); | |
| 3264 } | |
| 3258 } else if (member.isInstanceMember()) { | 3265 } else if (member.isInstanceMember()) { |
| 3259 // The type variable is stored on the object. | 3266 // The type variable is stored on the object. |
| 3260 return readTypeVariable(member.getEnclosingClass(), | 3267 return readTypeVariable(member.getEnclosingClass(), |
| 3261 type.element); | 3268 type.element); |
| 3262 } else { | 3269 } else { |
| 3263 // TODO(ngeoffray): Match the VM behavior and throw an | 3270 // TODO(ngeoffray): Match the VM behavior and throw an |
| 3264 // exception at runtime. | 3271 // exception at runtime. |
| 3265 compiler.cancel('Unimplemented unresolved type variable', | 3272 compiler.cancel('Unimplemented unresolved type variable', |
| 3266 element: type.element); | 3273 element: type.element); |
| 3267 } | 3274 } |
| (...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5388 new HSubGraphBlockInformation(elseBranch.graph)); | 5395 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5389 | 5396 |
| 5390 HBasicBlock conditionStartBlock = conditionBranch.block; | 5397 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5391 conditionStartBlock.setBlockFlow(info, joinBlock); | 5398 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5392 SubGraph conditionGraph = conditionBranch.graph; | 5399 SubGraph conditionGraph = conditionBranch.graph; |
| 5393 HIf branch = conditionGraph.end.last; | 5400 HIf branch = conditionGraph.end.last; |
| 5394 assert(branch is HIf); | 5401 assert(branch is HIf); |
| 5395 branch.blockInformation = conditionStartBlock.blockFlow; | 5402 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5396 } | 5403 } |
| 5397 } | 5404 } |
| OLD | NEW |