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