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 abstract class HVisitor<R> { | 5 abstract class HVisitor<R> { |
6 R visitAdd(HAdd node); | 6 R visitAdd(HAdd node); |
7 R visitBailoutTarget(HBailoutTarget node); | 7 R visitBailoutTarget(HBailoutTarget node); |
8 R visitBitAnd(HBitAnd node); | 8 R visitBitAnd(HBitAnd node); |
9 R visitBitNot(HBitNot node); | 9 R visitBitNot(HBitNot node); |
10 R visitBitOr(HBitOr node); | 10 R visitBitOr(HBitOr node); |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 final List<HBasicBlock> dominatedBlocks; | 458 final List<HBasicBlock> dominatedBlocks; |
459 | 459 |
460 HBasicBlock() : this.withId(null); | 460 HBasicBlock() : this.withId(null); |
461 HBasicBlock.withId(this.id) | 461 HBasicBlock.withId(this.id) |
462 : phis = new HInstructionList(), | 462 : phis = new HInstructionList(), |
463 predecessors = <HBasicBlock>[], | 463 predecessors = <HBasicBlock>[], |
464 successors = const <HBasicBlock>[], | 464 successors = const <HBasicBlock>[], |
465 dominatedBlocks = <HBasicBlock>[], | 465 dominatedBlocks = <HBasicBlock>[], |
466 bailoutTargets = <HBailoutTarget>[]; | 466 bailoutTargets = <HBailoutTarget>[]; |
467 | 467 |
468 int hashCode() => id; | 468 int get hashCode => id; |
469 | 469 |
470 bool isNew() => status == STATUS_NEW; | 470 bool isNew() => status == STATUS_NEW; |
471 bool isOpen() => status == STATUS_OPEN; | 471 bool isOpen() => status == STATUS_OPEN; |
472 bool isClosed() => status == STATUS_CLOSED; | 472 bool isClosed() => status == STATUS_CLOSED; |
473 | 473 |
474 bool isLoopHeader() { | 474 bool isLoopHeader() { |
475 return loopInformation != null; | 475 return loopInformation != null; |
476 } | 476 } |
477 | 477 |
478 void setBlockFlow(HBlockInformation blockInfo, HBasicBlock continuation) { | 478 void setBlockFlow(HBlockInformation blockInfo, HBasicBlock continuation) { |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 static const int TYPE_CONVERSION_TYPECODE = 28; | 809 static const int TYPE_CONVERSION_TYPECODE = 28; |
810 static const int BAILOUT_TARGET_TYPECODE = 29; | 810 static const int BAILOUT_TARGET_TYPECODE = 29; |
811 static const int INVOKE_STATIC_TYPECODE = 30; | 811 static const int INVOKE_STATIC_TYPECODE = 30; |
812 static const int INVOKE_DYNAMIC_GETTER_TYPECODE = 31; | 812 static const int INVOKE_DYNAMIC_GETTER_TYPECODE = 31; |
813 static const int INDEX_TYPECODE = 32; | 813 static const int INDEX_TYPECODE = 32; |
814 | 814 |
815 HInstruction(this.inputs) | 815 HInstruction(this.inputs) |
816 : id = idCounter++, | 816 : id = idCounter++, |
817 usedBy = <HInstruction>[]; | 817 usedBy = <HInstruction>[]; |
818 | 818 |
819 int hashCode() => id; | 819 int get hashCode => id; |
820 | 820 |
821 bool getFlag(int position) => (flags & (1 << position)) != 0; | 821 bool getFlag(int position) => (flags & (1 << position)) != 0; |
822 void setFlag(int position) { flags |= (1 << position); } | 822 void setFlag(int position) { flags |= (1 << position); } |
823 void clearFlag(int position) { flags &= ~(1 << position); } | 823 void clearFlag(int position) { flags &= ~(1 << position); } |
824 | 824 |
825 static int computeDependsOnFlags(int flags) => flags << FLAG_CHANGES_COUNT; | 825 static int computeDependsOnFlags(int flags) => flags << FLAG_CHANGES_COUNT; |
826 | 826 |
827 int getChangesFlags() => flags & ((1 << FLAG_CHANGES_COUNT) - 1); | 827 int getChangesFlags() => flags & ((1 << FLAG_CHANGES_COUNT) - 1); |
828 bool hasSideEffects(HTypeMap types) => getChangesFlags() != 0; | 828 bool hasSideEffects(HTypeMap types) => getChangesFlags() != 0; |
829 void prepareGvn(HTypeMap types) { setAllSideEffects(); } | 829 void prepareGvn(HTypeMap types) { setAllSideEffects(); } |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2414 void prepareGvn(HTypeMap types) { | 2414 void prepareGvn(HTypeMap types) { |
2415 clearAllSideEffects(); | 2415 clearAllSideEffects(); |
2416 if (element.isAssignable()) { | 2416 if (element.isAssignable()) { |
2417 setDependsOnStaticPropertyStore(); | 2417 setDependsOnStaticPropertyStore(); |
2418 } | 2418 } |
2419 setUseGvn(); | 2419 setUseGvn(); |
2420 } | 2420 } |
2421 toString() => 'static ${element.name}'; | 2421 toString() => 'static ${element.name}'; |
2422 accept(HVisitor visitor) => visitor.visitStatic(this); | 2422 accept(HVisitor visitor) => visitor.visitStatic(this); |
2423 | 2423 |
2424 int gvnHashCode() => super.gvnHashCode() ^ element.hashCode(); | 2424 int gvnHashCode() => super.gvnHashCode() ^ element.hashCode; |
2425 int typeCode() => HInstruction.STATIC_TYPECODE; | 2425 int typeCode() => HInstruction.STATIC_TYPECODE; |
2426 bool typeEquals(other) => other is HStatic; | 2426 bool typeEquals(other) => other is HStatic; |
2427 bool dataEquals(HStatic other) => element == other.element; | 2427 bool dataEquals(HStatic other) => element == other.element; |
2428 bool isCodeMotionInvariant() => !element.isAssignable(); | 2428 bool isCodeMotionInvariant() => !element.isAssignable(); |
2429 } | 2429 } |
2430 | 2430 |
2431 /** An [HLazyStatic] is a static that is initialized lazily at first read. */ | 2431 /** An [HLazyStatic] is a static that is initialized lazily at first read. */ |
2432 class HLazyStatic extends HStatic { | 2432 class HLazyStatic extends HStatic { |
2433 HLazyStatic(Element element) : super(element); | 2433 HLazyStatic(Element element) : super(element); |
2434 | 2434 |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2974 HBasicBlock get start => expression.start; | 2974 HBasicBlock get start => expression.start; |
2975 HBasicBlock get end { | 2975 HBasicBlock get end { |
2976 // We don't create a switch block if there are no cases. | 2976 // We don't create a switch block if there are no cases. |
2977 assert(!statements.isEmpty()); | 2977 assert(!statements.isEmpty()); |
2978 return statements.last().end; | 2978 return statements.last().end; |
2979 } | 2979 } |
2980 | 2980 |
2981 bool accept(HStatementInformationVisitor visitor) => | 2981 bool accept(HStatementInformationVisitor visitor) => |
2982 visitor.visitSwitchInfo(this); | 2982 visitor.visitSwitchInfo(this); |
2983 } | 2983 } |
OLD | NEW |