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 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 List<HInstruction> inputs, | 1308 List<HInstruction> inputs, |
1309 [bool isIntercepted = false]) | 1309 [bool isIntercepted = false]) |
1310 : super(inputs), | 1310 : super(inputs), |
1311 this.selector = selector, | 1311 this.selector = selector, |
1312 specializer = isIntercepted | 1312 specializer = isIntercepted |
1313 ? InvokeDynamicSpecializer.lookupSpecializer(selector) | 1313 ? InvokeDynamicSpecializer.lookupSpecializer(selector) |
1314 : const InvokeDynamicSpecializer(); | 1314 : const InvokeDynamicSpecializer(); |
1315 toString() => 'invoke dynamic: $selector'; | 1315 toString() => 'invoke dynamic: $selector'; |
1316 HInstruction get receiver => inputs[0]; | 1316 HInstruction get receiver => inputs[0]; |
1317 | 1317 |
| 1318 /** |
| 1319 * Returns whether this call is on an intercepted method. |
| 1320 */ |
1318 bool get isInterceptorCall { | 1321 bool get isInterceptorCall { |
1319 // We know it's a selector call if it follows the interceptor | 1322 // We know it's a selector call if it follows the interceptor |
1320 // calling convention, which adds the actual receiver as a | 1323 // calling convention, which adds the actual receiver as a |
1321 // parameter to the call. | 1324 // parameter to the call. |
1322 return inputs.length - 2 == selector.argumentCount; | 1325 return inputs.length - 2 == selector.argumentCount; |
1323 } | 1326 } |
1324 | 1327 |
| 1328 /** |
| 1329 * Returns whether this call is on an interceptor object. |
| 1330 */ |
| 1331 bool get isCallOnInterceptor { |
| 1332 // When the optimizers know this call does not need an |
| 1333 // interceptor, they udpate the receiver of the call to be the |
| 1334 // actual receiver. |
| 1335 // TODO(ngeoffray): This is very fragile and we should inspect the |
| 1336 // receiver instead. |
| 1337 return isInterceptorCall && inputs[0] != inputs[1]; |
| 1338 } |
| 1339 |
1325 int typeCode() => HInstruction.INVOKE_DYNAMIC_TYPECODE; | 1340 int typeCode() => HInstruction.INVOKE_DYNAMIC_TYPECODE; |
1326 bool typeEquals(other) => other is HInvokeDynamic; | 1341 bool typeEquals(other) => other is HInvokeDynamic; |
1327 bool dataEquals(HInvokeDynamic other) { | 1342 bool dataEquals(HInvokeDynamic other) { |
1328 return selector == other.selector && element == other.element; | 1343 return selector == other.selector && element == other.element; |
1329 } | 1344 } |
1330 } | 1345 } |
1331 | 1346 |
1332 class HInvokeClosure extends HInvokeDynamic { | 1347 class HInvokeClosure extends HInvokeDynamic { |
1333 HInvokeClosure(Selector selector, List<HInstruction> inputs) | 1348 HInvokeClosure(Selector selector, List<HInstruction> inputs) |
1334 : super(selector, null, inputs) { | 1349 : super(selector, null, inputs) { |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 HBasicBlock get start => expression.start; | 2577 HBasicBlock get start => expression.start; |
2563 HBasicBlock get end { | 2578 HBasicBlock get end { |
2564 // We don't create a switch block if there are no cases. | 2579 // We don't create a switch block if there are no cases. |
2565 assert(!statements.isEmpty); | 2580 assert(!statements.isEmpty); |
2566 return statements.last.end; | 2581 return statements.last.end; |
2567 } | 2582 } |
2568 | 2583 |
2569 bool accept(HStatementInformationVisitor visitor) => | 2584 bool accept(HStatementInformationVisitor visitor) => |
2570 visitor.visitSwitchInfo(this); | 2585 visitor.visitSwitchInfo(this); |
2571 } | 2586 } |
OLD | NEW |