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 abstract class HVisitor<R> { | 7 abstract class HVisitor<R> { |
8 R visitAdd(HAdd node); | 8 R visitAdd(HAdd node); |
9 R visitBailoutTarget(HBailoutTarget node); | 9 R visitBailoutTarget(HBailoutTarget node); |
10 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1302 List<HInstruction> inputs, | 1302 List<HInstruction> inputs, |
1303 [bool isIntercepted = false]) | 1303 [bool isIntercepted = false]) |
1304 : super(inputs), | 1304 : super(inputs), |
1305 this.selector = selector, | 1305 this.selector = selector, |
1306 specializer = isIntercepted | 1306 specializer = isIntercepted |
1307 ? InvokeDynamicSpecializer.lookupSpecializer(selector) | 1307 ? InvokeDynamicSpecializer.lookupSpecializer(selector) |
1308 : const InvokeDynamicSpecializer(); | 1308 : const InvokeDynamicSpecializer(); |
1309 toString() => 'invoke dynamic: $selector'; | 1309 toString() => 'invoke dynamic: $selector'; |
1310 HInstruction get receiver => inputs[0]; | 1310 HInstruction get receiver => inputs[0]; |
1311 | 1311 |
1312 /** | |
1313 * Returns whether this call is on an intercepted method. | |
1314 */ | |
1312 bool get isInterceptorCall { | 1315 bool get isInterceptorCall { |
1313 // We know it's a selector call if it follows the interceptor | 1316 // We know it's a selector call if it follows the interceptor |
1314 // calling convention, which adds the actual receiver as a | 1317 // calling convention, which adds the actual receiver as a |
1315 // parameter to the call. | 1318 // parameter to the call. |
1316 return inputs.length - 2 == selector.argumentCount; | 1319 return inputs.length - 2 == selector.argumentCount; |
1317 } | 1320 } |
1318 | 1321 |
1322 /** | |
1323 * Returns whether this call is on an interceptor object. | |
1324 */ | |
1325 bool get isCallOnInterceptor { | |
1326 // When the optimizers know this call does not need an | |
1327 // interceptor, they udpate the receiver of the call to be the | |
1328 // actual receiver. | |
1329 return isInterceptorCall && inputs[0] != inputs[1]; | |
sra1
2013/02/27 05:13:28
Consider a.sb.add(123)
The optimization you mentio
ngeoffray
2013/02/28 10:39:42
inputs[0] can either be a call to getInterceptor o
| |
1330 } | |
1331 | |
1319 int typeCode() => HInstruction.INVOKE_DYNAMIC_TYPECODE; | 1332 int typeCode() => HInstruction.INVOKE_DYNAMIC_TYPECODE; |
1320 bool typeEquals(other) => other is HInvokeDynamic; | 1333 bool typeEquals(other) => other is HInvokeDynamic; |
1321 bool dataEquals(HInvokeDynamic other) { | 1334 bool dataEquals(HInvokeDynamic other) { |
1322 return selector == other.selector && element == other.element; | 1335 return selector == other.selector && element == other.element; |
1323 } | 1336 } |
1324 } | 1337 } |
1325 | 1338 |
1326 class HInvokeClosure extends HInvokeDynamic { | 1339 class HInvokeClosure extends HInvokeDynamic { |
1327 HInvokeClosure(Selector selector, List<HInstruction> inputs) | 1340 HInvokeClosure(Selector selector, List<HInstruction> inputs) |
1328 : super(selector, null, inputs) { | 1341 : super(selector, null, inputs) { |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2556 HBasicBlock get start => expression.start; | 2569 HBasicBlock get start => expression.start; |
2557 HBasicBlock get end { | 2570 HBasicBlock get end { |
2558 // We don't create a switch block if there are no cases. | 2571 // We don't create a switch block if there are no cases. |
2559 assert(!statements.isEmpty); | 2572 assert(!statements.isEmpty); |
2560 return statements.last.end; | 2573 return statements.last.end; |
2561 } | 2574 } |
2562 | 2575 |
2563 bool accept(HStatementInformationVisitor visitor) => | 2576 bool accept(HStatementInformationVisitor visitor) => |
2564 visitor.visitSwitchInfo(this); | 2577 visitor.visitSwitchInfo(this); |
2565 } | 2578 } |
OLD | NEW |