Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1187)

Side by Side Diff: lib/compiler/implementation/ssa/nodes.dart

Issue 10880068: - Change "static final" to "static const" in the lib/ directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 interface HVisitor<R> { 5 interface 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 } 424 }
425 return false; 425 return false;
426 } 426 }
427 } 427 }
428 428
429 class HBasicBlock extends HInstructionList implements Hashable { 429 class HBasicBlock extends HInstructionList implements Hashable {
430 // The [id] must be such that any successor's id is greater than 430 // The [id] must be such that any successor's id is greater than
431 // this [id]. The exception are back-edges. 431 // this [id]. The exception are back-edges.
432 int id; 432 int id;
433 433
434 static final int STATUS_NEW = 0; 434 static const int STATUS_NEW = 0;
435 static final int STATUS_OPEN = 1; 435 static const int STATUS_OPEN = 1;
436 static final int STATUS_CLOSED = 2; 436 static const int STATUS_CLOSED = 2;
437 int status = STATUS_NEW; 437 int status = STATUS_NEW;
438 438
439 HInstructionList phis; 439 HInstructionList phis;
440 440
441 HLoopInformation loopInformation = null; 441 HLoopInformation loopInformation = null;
442 HBlockFlow blockFlow = null; 442 HBlockFlow blockFlow = null;
443 HBasicBlock parentLoopHeader = null; 443 HBasicBlock parentLoopHeader = null;
444 List<HBailoutTarget> bailoutTargets; 444 List<HBailoutTarget> bailoutTargets;
445 445
446 final List<HBasicBlock> predecessors; 446 final List<HBasicBlock> predecessors;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 742
743 final List<HInstruction> inputs; 743 final List<HInstruction> inputs;
744 final List<HInstruction> usedBy; 744 final List<HInstruction> usedBy;
745 745
746 HBasicBlock block; 746 HBasicBlock block;
747 HInstruction previous = null; 747 HInstruction previous = null;
748 HInstruction next = null; 748 HInstruction next = null;
749 int flags = 0; 749 int flags = 0;
750 750
751 // Changes flags. 751 // Changes flags.
752 static final int FLAG_CHANGES_SOMETHING = 0; 752 static const int FLAG_CHANGES_SOMETHING = 0;
753 static final int FLAG_CHANGES_COUNT = FLAG_CHANGES_SOMETHING + 1; 753 static const int FLAG_CHANGES_COUNT = FLAG_CHANGES_SOMETHING + 1;
754 754
755 // Depends flags (one for each changes flag). 755 // Depends flags (one for each changes flag).
756 static final int FLAG_DEPENDS_ON_SOMETHING = FLAG_CHANGES_COUNT; 756 static const int FLAG_DEPENDS_ON_SOMETHING = FLAG_CHANGES_COUNT;
757 757
758 // Other flags. 758 // Other flags.
759 static final int FLAG_USE_GVN = FLAG_DEPENDS_ON_SOMETHING + 1; 759 static const int FLAG_USE_GVN = FLAG_DEPENDS_ON_SOMETHING + 1;
760 760
761 // Type codes. 761 // Type codes.
762 static final int UNDEFINED_TYPECODE = -1; 762 static const int UNDEFINED_TYPECODE = -1;
763 static final int BOOLIFY_TYPECODE = 0; 763 static const int BOOLIFY_TYPECODE = 0;
764 static final int TYPE_GUARD_TYPECODE = 1; 764 static const int TYPE_GUARD_TYPECODE = 1;
765 static final int BOUNDS_CHECK_TYPECODE = 2; 765 static const int BOUNDS_CHECK_TYPECODE = 2;
766 static final int INTEGER_CHECK_TYPECODE = 3; 766 static const int INTEGER_CHECK_TYPECODE = 3;
767 static final int INVOKE_INTERCEPTOR_TYPECODE = 4; 767 static const int INVOKE_INTERCEPTOR_TYPECODE = 4;
768 static final int ADD_TYPECODE = 5; 768 static const int ADD_TYPECODE = 5;
769 static final int DIVIDE_TYPECODE = 6; 769 static const int DIVIDE_TYPECODE = 6;
770 static final int MODULO_TYPECODE = 7; 770 static const int MODULO_TYPECODE = 7;
771 static final int MULTIPLY_TYPECODE = 8; 771 static const int MULTIPLY_TYPECODE = 8;
772 static final int SUBTRACT_TYPECODE = 9; 772 static const int SUBTRACT_TYPECODE = 9;
773 static final int TRUNCATING_DIVIDE_TYPECODE = 10; 773 static const int TRUNCATING_DIVIDE_TYPECODE = 10;
774 static final int SHIFT_LEFT_TYPECODE = 11; 774 static const int SHIFT_LEFT_TYPECODE = 11;
775 static final int SHIFT_RIGHT_TYPECODE = 12; 775 static const int SHIFT_RIGHT_TYPECODE = 12;
776 static final int BIT_OR_TYPECODE = 13; 776 static const int BIT_OR_TYPECODE = 13;
777 static final int BIT_AND_TYPECODE = 14; 777 static const int BIT_AND_TYPECODE = 14;
778 static final int BIT_XOR_TYPECODE = 15; 778 static const int BIT_XOR_TYPECODE = 15;
779 static final int NEGATE_TYPECODE = 16; 779 static const int NEGATE_TYPECODE = 16;
780 static final int BIT_NOT_TYPECODE = 17; 780 static const int BIT_NOT_TYPECODE = 17;
781 static final int NOT_TYPECODE = 18; 781 static const int NOT_TYPECODE = 18;
782 static final int EQUALS_TYPECODE = 19; 782 static const int EQUALS_TYPECODE = 19;
783 static final int IDENTITY_TYPECODE = 20; 783 static const int IDENTITY_TYPECODE = 20;
784 static final int GREATER_TYPECODE = 21; 784 static const int GREATER_TYPECODE = 21;
785 static final int GREATER_EQUAL_TYPECODE = 22; 785 static const int GREATER_EQUAL_TYPECODE = 22;
786 static final int LESS_TYPECODE = 23; 786 static const int LESS_TYPECODE = 23;
787 static final int LESS_EQUAL_TYPECODE = 24; 787 static const int LESS_EQUAL_TYPECODE = 24;
788 static final int STATIC_TYPECODE = 25; 788 static const int STATIC_TYPECODE = 25;
789 static final int STATIC_STORE_TYPECODE = 26; 789 static const int STATIC_STORE_TYPECODE = 26;
790 static final int FIELD_GET_TYPECODE = 27; 790 static const int FIELD_GET_TYPECODE = 27;
791 static final int TYPE_CONVERSION_TYPECODE = 28; 791 static const int TYPE_CONVERSION_TYPECODE = 28;
792 static final int BAILOUT_TARGET_TYPECODE = 29; 792 static const int BAILOUT_TARGET_TYPECODE = 29;
793 static final int INVOKE_STATIC_TYPECODE = 30; 793 static const int INVOKE_STATIC_TYPECODE = 30;
794 794
795 HInstruction(this.inputs) 795 HInstruction(this.inputs)
796 : id = idCounter++, 796 : id = idCounter++,
797 usedBy = <HInstruction>[]; 797 usedBy = <HInstruction>[];
798 798
799 int hashCode() => id; 799 int hashCode() => id;
800 800
801 bool getFlag(int position) => (flags & (1 << position)) != 0; 801 bool getFlag(int position) => (flags & (1 << position)) != 0;
802 void setFlag(int position) { flags |= (1 << position); } 802 void setFlag(int position) { flags |= (1 << position); }
803 void clearFlag(int position) { flags &= ~(1 << position); } 803 void clearFlag(int position) { flags &= ~(1 << position); }
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 1152
1153 bool isStatement(HTypeMap types) => isEnabled; 1153 bool isStatement(HTypeMap types) => isEnabled;
1154 1154
1155 accept(HVisitor visitor) => visitor.visitTypeGuard(this); 1155 accept(HVisitor visitor) => visitor.visitTypeGuard(this);
1156 int typeCode() => HInstruction.TYPE_GUARD_TYPECODE; 1156 int typeCode() => HInstruction.TYPE_GUARD_TYPECODE;
1157 bool typeEquals(other) => other is HTypeGuard; 1157 bool typeEquals(other) => other is HTypeGuard;
1158 bool dataEquals(HTypeGuard other) => guardedType == other.guardedType; 1158 bool dataEquals(HTypeGuard other) => guardedType == other.guardedType;
1159 } 1159 }
1160 1160
1161 class HBoundsCheck extends HCheck { 1161 class HBoundsCheck extends HCheck {
1162 static final int ALWAYS_FALSE = 0; 1162 static const int ALWAYS_FALSE = 0;
1163 static final int FULL_CHECK = 1; 1163 static const int FULL_CHECK = 1;
1164 static final int ALWAYS_ABOVE_ZERO = 2; 1164 static const int ALWAYS_ABOVE_ZERO = 2;
1165 static final int ALWAYS_TRUE = 3; 1165 static const int ALWAYS_TRUE = 3;
1166 /** 1166 /**
1167 * Details which tests have been done statically during compilation. 1167 * Details which tests have been done statically during compilation.
1168 * Default is that all checks must be performed dynamically. 1168 * Default is that all checks must be performed dynamically.
1169 */ 1169 */
1170 int staticChecks = FULL_CHECK; 1170 int staticChecks = FULL_CHECK;
1171 1171
1172 HBoundsCheck(length, index) : super(<HInstruction>[length, index]); 1172 HBoundsCheck(length, index) : super(<HInstruction>[length, index]);
1173 1173
1174 HInstruction get length => inputs[1]; 1174 HInstruction get length => inputs[1];
1175 HInstruction get index => inputs[0]; 1175 HInstruction get index => inputs[0];
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 bool isStatement(HTypeMap types) => true; 1225 bool isStatement(HTypeMap types) => true;
1226 } 1226 }
1227 1227
1228 class HInvoke extends HInstruction { 1228 class HInvoke extends HInstruction {
1229 /** 1229 /**
1230 * The first argument must be the target: either an [HStatic] node, or 1230 * The first argument must be the target: either an [HStatic] node, or
1231 * the receiver of a method-call. The remaining inputs are the arguments 1231 * the receiver of a method-call. The remaining inputs are the arguments
1232 * to the invocation. 1232 * to the invocation.
1233 */ 1233 */
1234 HInvoke(List<HInstruction> inputs) : super(inputs); 1234 HInvoke(List<HInstruction> inputs) : super(inputs);
1235 static final int ARGUMENTS_OFFSET = 1; 1235 static const int ARGUMENTS_OFFSET = 1;
1236 1236
1237 // TODO(floitsch): make class abstract instead of adding an abstract method. 1237 // TODO(floitsch): make class abstract instead of adding an abstract method.
1238 abstract accept(HVisitor visitor); 1238 abstract accept(HVisitor visitor);
1239 } 1239 }
1240 1240
1241 class HInvokeDynamic extends HInvoke { 1241 class HInvokeDynamic extends HInvoke {
1242 final Selector selector; 1242 final Selector selector;
1243 Element element; 1243 Element element;
1244 1244
1245 HInvokeDynamic(this.selector, this.element, List<HInstruction> inputs) 1245 HInvokeDynamic(this.selector, this.element, List<HInstruction> inputs)
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 1920
1921 HBasicBlock get elseBlock { 1921 HBasicBlock get elseBlock {
1922 assert(block.dominatedBlocks[1] === block.successors[1]); 1922 assert(block.dominatedBlocks[1] === block.successors[1]);
1923 return block.successors[1]; 1923 return block.successors[1];
1924 } 1924 }
1925 1925
1926 HBasicBlock get joinBlock => blockInformation.continuation; 1926 HBasicBlock get joinBlock => blockInformation.continuation;
1927 } 1927 }
1928 1928
1929 class HLoopBranch extends HConditionalBranch { 1929 class HLoopBranch extends HConditionalBranch {
1930 static final int CONDITION_FIRST_LOOP = 0; 1930 static const int CONDITION_FIRST_LOOP = 0;
1931 static final int DO_WHILE_LOOP = 1; 1931 static const int DO_WHILE_LOOP = 1;
1932 1932
1933 final int kind; 1933 final int kind;
1934 HLoopBranch(HInstruction condition, [this.kind = CONDITION_FIRST_LOOP]) 1934 HLoopBranch(HInstruction condition, [this.kind = CONDITION_FIRST_LOOP])
1935 : super(<HInstruction>[condition]); 1935 : super(<HInstruction>[condition]);
1936 toString() => 'loop-branch'; 1936 toString() => 'loop-branch';
1937 accept(HVisitor visitor) => visitor.visitLoopBranch(this); 1937 accept(HVisitor visitor) => visitor.visitLoopBranch(this);
1938 1938
1939 bool isDoWhile() { 1939 bool isDoWhile() {
1940 return kind === DO_WHILE_LOOP; 1940 return kind === DO_WHILE_LOOP;
1941 } 1941 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 2018
2019 class HThis extends HParameterValue { 2019 class HThis extends HParameterValue {
2020 HThis([HType type = HType.UNKNOWN]) : super(null) { 2020 HThis([HType type = HType.UNKNOWN]) : super(null) {
2021 guaranteedType = type; 2021 guaranteedType = type;
2022 } 2022 }
2023 toString() => 'this'; 2023 toString() => 'this';
2024 accept(HVisitor visitor) => visitor.visitThis(this); 2024 accept(HVisitor visitor) => visitor.visitThis(this);
2025 } 2025 }
2026 2026
2027 class HPhi extends HInstruction { 2027 class HPhi extends HInstruction {
2028 static final IS_NOT_LOGICAL_OPERATOR = 0; 2028 static const IS_NOT_LOGICAL_OPERATOR = 0;
2029 static final IS_AND = 1; 2029 static const IS_AND = 1;
2030 static final IS_OR = 2; 2030 static const IS_OR = 2;
2031 2031
2032 int logicalOperatorType = IS_NOT_LOGICAL_OPERATOR; 2032 int logicalOperatorType = IS_NOT_LOGICAL_OPERATOR;
2033 2033
2034 // The order of the [inputs] must correspond to the order of the 2034 // The order of the [inputs] must correspond to the order of the
2035 // predecessor-edges. That is if an input comes from the first predecessor 2035 // predecessor-edges. That is if an input comes from the first predecessor
2036 // of the surrounding block, then the input must be the first in the [HPhi]. 2036 // of the surrounding block, then the input must be the first in the [HPhi].
2037 HPhi(Element element, List<HInstruction> inputs) : super(inputs) { 2037 HPhi(Element element, List<HInstruction> inputs) : super(inputs) {
2038 sourceElement = element; 2038 sourceElement = element;
2039 } 2039 }
2040 HPhi.noInputs(Element element) : this(element, <HInstruction>[]); 2040 HPhi.noInputs(Element element) : this(element, <HInstruction>[]);
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
2419 2419
2420 accept(HVisitor visitor) => visitor.visitIs(this); 2420 accept(HVisitor visitor) => visitor.visitIs(this);
2421 2421
2422 toString() => "$expression is $typeExpression"; 2422 toString() => "$expression is $typeExpression";
2423 } 2423 }
2424 2424
2425 class HTypeConversion extends HCheck { 2425 class HTypeConversion extends HCheck {
2426 HType type; 2426 HType type;
2427 final int kind; 2427 final int kind;
2428 2428
2429 static final int NO_CHECK = 0; 2429 static const int NO_CHECK = 0;
2430 static final int CHECKED_MODE_CHECK = 1; 2430 static const int CHECKED_MODE_CHECK = 1;
2431 static final int ARGUMENT_TYPE_CHECK = 2; 2431 static const int ARGUMENT_TYPE_CHECK = 2;
2432 static final int CAST_TYPE_CHECK = 3; 2432 static const int CAST_TYPE_CHECK = 3;
2433 2433
2434 HTypeConversion(this.type, HInstruction input, [this.kind = NO_CHECK]) 2434 HTypeConversion(this.type, HInstruction input, [this.kind = NO_CHECK])
2435 : super(<HInstruction>[input]) { 2435 : super(<HInstruction>[input]) {
2436 sourceElement = input.sourceElement; 2436 sourceElement = input.sourceElement;
2437 } 2437 }
2438 HTypeConversion.checkedModeCheck(HType type, HInstruction input) 2438 HTypeConversion.checkedModeCheck(HType type, HInstruction input)
2439 : this(type, input, CHECKED_MODE_CHECK); 2439 : this(type, input, CHECKED_MODE_CHECK);
2440 HTypeConversion.argumentTypeCheck(HType type, HInstruction input) 2440 HTypeConversion.argumentTypeCheck(HType type, HInstruction input)
2441 : this(type, input, ARGUMENT_TYPE_CHECK); 2441 : this(type, input, ARGUMENT_TYPE_CHECK);
2442 HTypeConversion.castCheck(HType type, HInstruction input) 2442 HTypeConversion.castCheck(HType type, HInstruction input)
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2665 class LoopTypeVisitor extends AbstractVisitor { 2665 class LoopTypeVisitor extends AbstractVisitor {
2666 const LoopTypeVisitor(); 2666 const LoopTypeVisitor();
2667 int visitNode(Node node) => HLoopBlockInformation.NOT_A_LOOP; 2667 int visitNode(Node node) => HLoopBlockInformation.NOT_A_LOOP;
2668 int visitWhile(While node) => HLoopBlockInformation.WHILE_LOOP; 2668 int visitWhile(While node) => HLoopBlockInformation.WHILE_LOOP;
2669 int visitFor(For node) => HLoopBlockInformation.FOR_LOOP; 2669 int visitFor(For node) => HLoopBlockInformation.FOR_LOOP;
2670 int visitDoWhile(DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; 2670 int visitDoWhile(DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP;
2671 int visitForIn(ForIn node) => HLoopBlockInformation.FOR_IN_LOOP; 2671 int visitForIn(ForIn node) => HLoopBlockInformation.FOR_IN_LOOP;
2672 } 2672 }
2673 2673
2674 class HLoopBlockInformation implements HStatementInformation { 2674 class HLoopBlockInformation implements HStatementInformation {
2675 static final int WHILE_LOOP = 0; 2675 static const int WHILE_LOOP = 0;
2676 static final int FOR_LOOP = 1; 2676 static const int FOR_LOOP = 1;
2677 static final int DO_WHILE_LOOP = 2; 2677 static const int DO_WHILE_LOOP = 2;
2678 static final int FOR_IN_LOOP = 3; 2678 static const int FOR_IN_LOOP = 3;
2679 static final int NOT_A_LOOP = -1; 2679 static const int NOT_A_LOOP = -1;
2680 2680
2681 final int kind; 2681 final int kind;
2682 final HExpressionInformation initializer; 2682 final HExpressionInformation initializer;
2683 final HExpressionInformation condition; 2683 final HExpressionInformation condition;
2684 final HStatementInformation body; 2684 final HStatementInformation body;
2685 final HExpressionInformation updates; 2685 final HExpressionInformation updates;
2686 final TargetElement target; 2686 final TargetElement target;
2687 final List<LabelElement> labels; 2687 final List<LabelElement> labels;
2688 final Node sourcePosition; 2688 final Node sourcePosition;
2689 2689
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
2798 HBasicBlock get start => expression.start; 2798 HBasicBlock get start => expression.start;
2799 HBasicBlock get end { 2799 HBasicBlock get end {
2800 // We don't create a switch block if there are no cases. 2800 // We don't create a switch block if there are no cases.
2801 assert(!statements.isEmpty()); 2801 assert(!statements.isEmpty());
2802 return statements.last().end; 2802 return statements.last().end;
2803 } 2803 }
2804 2804
2805 bool accept(HStatementInformationVisitor visitor) => 2805 bool accept(HStatementInformationVisitor visitor) =>
2806 visitor.visitSwitchInfo(this); 2806 visitor.visitSwitchInfo(this);
2807 } 2807 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698