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 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 } else { | 1347 } else { |
1348 sideEffects.setAllSideEffects(); | 1348 sideEffects.setAllSideEffects(); |
1349 sideEffects.setDependsOnSomething(); | 1349 sideEffects.setDependsOnSomething(); |
1350 } | 1350 } |
1351 } | 1351 } |
1352 toString() => 'invoke dynamic setter: $selector'; | 1352 toString() => 'invoke dynamic setter: $selector'; |
1353 accept(HVisitor visitor) => visitor.visitInvokeDynamicSetter(this); | 1353 accept(HVisitor visitor) => visitor.visitInvokeDynamicSetter(this); |
1354 } | 1354 } |
1355 | 1355 |
1356 class HInvokeStatic extends HInvoke { | 1356 class HInvokeStatic extends HInvoke { |
| 1357 final Element element; |
1357 /** The first input must be the target. */ | 1358 /** The first input must be the target. */ |
1358 HInvokeStatic(inputs, HType type) : super(inputs) { | 1359 HInvokeStatic(this.element, inputs, HType type) : super(inputs) { |
1359 instructionType = type; | 1360 instructionType = type; |
1360 } | 1361 } |
1361 | 1362 |
1362 toString() => 'invoke static: ${element.name}'; | 1363 toString() => 'invoke static: ${element.name}'; |
1363 accept(HVisitor visitor) => visitor.visitInvokeStatic(this); | 1364 accept(HVisitor visitor) => visitor.visitInvokeStatic(this); |
1364 int typeCode() => HInstruction.INVOKE_STATIC_TYPECODE; | 1365 int typeCode() => HInstruction.INVOKE_STATIC_TYPECODE; |
1365 Element get element => target.element; | |
1366 HStatic get target => inputs[0]; | |
1367 } | 1366 } |
1368 | 1367 |
1369 class HInvokeSuper extends HInvokeStatic { | 1368 class HInvokeSuper extends HInvokeStatic { |
1370 /** The class where the call to super is being done. */ | 1369 /** The class where the call to super is being done. */ |
1371 final ClassElement caller; | 1370 final ClassElement caller; |
1372 final bool isSetter; | 1371 final bool isSetter; |
1373 | 1372 |
1374 HInvokeSuper(this.caller, inputs, {this.isSetter}) | 1373 HInvokeSuper(Element element, this.caller, inputs, {this.isSetter}) |
1375 : super(inputs, HType.UNKNOWN); | 1374 : super(element, inputs, HType.UNKNOWN); |
1376 toString() => 'invoke super: ${element.name}'; | 1375 toString() => 'invoke super: ${element.name}'; |
1377 accept(HVisitor visitor) => visitor.visitInvokeSuper(this); | 1376 accept(HVisitor visitor) => visitor.visitInvokeSuper(this); |
1378 | 1377 |
1379 HInstruction get value { | 1378 HInstruction get value { |
1380 assert(isSetter); | 1379 assert(isSetter); |
1381 // Index 0: the element, index 1: 'this'. | 1380 // Index 0: 'this'. |
1382 return inputs[2]; | 1381 return inputs[1]; |
1383 } | 1382 } |
1384 } | 1383 } |
1385 | 1384 |
1386 abstract class HFieldAccess extends HInstruction { | 1385 abstract class HFieldAccess extends HInstruction { |
1387 final Element element; | 1386 final Element element; |
1388 | 1387 |
1389 HFieldAccess(Element element, List<HInstruction> inputs) | 1388 HFieldAccess(Element element, List<HInstruction> inputs) |
1390 : this.element = element, super(inputs); | 1389 : this.element = element, super(inputs); |
1391 | 1390 |
1392 HInstruction get receiver => inputs[0]; | 1391 HInstruction get receiver => inputs[0]; |
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2599 HBasicBlock get start => expression.start; | 2598 HBasicBlock get start => expression.start; |
2600 HBasicBlock get end { | 2599 HBasicBlock get end { |
2601 // We don't create a switch block if there are no cases. | 2600 // We don't create a switch block if there are no cases. |
2602 assert(!statements.isEmpty); | 2601 assert(!statements.isEmpty); |
2603 return statements.last.end; | 2602 return statements.last.end; |
2604 } | 2603 } |
2605 | 2604 |
2606 bool accept(HStatementInformationVisitor visitor) => | 2605 bool accept(HStatementInformationVisitor visitor) => |
2607 visitor.visitSwitchInfo(this); | 2606 visitor.visitSwitchInfo(this); |
2608 } | 2607 } |
OLD | NEW |