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

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

Issue 10824371: Add an optional parameter to the dominatedUsers function in case we want to analyze the whole block, (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 if (oldInputUsers[i] == this) { 925 if (oldInputUsers[i] == this) {
926 oldInputUsers[i] = oldInputUsers[oldInput.usedBy.length - 1]; 926 oldInputUsers[i] = oldInputUsers[oldInput.usedBy.length - 1];
927 oldInputUsers.length--; 927 oldInputUsers.length--;
928 } else { 928 } else {
929 i++; 929 i++;
930 } 930 }
931 } 931 }
932 } 932 }
933 933
934 // Compute the set of users of this instruction that is dominated by 934 // Compute the set of users of this instruction that is dominated by
935 // [other]. 935 // [other], [other] included.
kasperl 2012/08/20 12:58:35 Maybe explain this a bit better. Like: If [other]
ngeoffray 2012/08/20 13:01:32 Done.
936 Set<HInstruction> dominatedUsers(HInstruction other) { 936 Set<HInstruction> dominatedUsers(HInstruction other) {
937 // Keep track of all instructions that we have to deal with later 937 // Keep track of all instructions that we have to deal with later
938 // and count the number of them that are in the current block. 938 // and count the number of them that are in the current block.
939 Set<HInstruction> users = new Set<HInstruction>(); 939 Set<HInstruction> users = new Set<HInstruction>();
940 int usersInCurrentBlock = 0; 940 int usersInCurrentBlock = 0;
941 941
942 // Run through all the users and see if they are dominated or 942 // Run through all the users and see if they are dominated or
943 // potentially dominated by [other]. 943 // potentially dominated by [other].
944 HBasicBlock otherBlock = other.block; 944 HBasicBlock otherBlock = other.block;
945 for (int i = 0, length = usedBy.length; i < length; i++) { 945 for (int i = 0, length = usedBy.length; i < length; i++) {
946 HInstruction current = usedBy[i]; 946 HInstruction current = usedBy[i];
947 if (current !== other && otherBlock.dominates(current.block)) { 947 if (otherBlock.dominates(current.block)) {
948 if (current.block === otherBlock) usersInCurrentBlock++; 948 if (current.block === otherBlock) usersInCurrentBlock++;
949 users.add(current); 949 users.add(current);
950 } 950 }
951 } 951 }
952 952
953 // Run through all the phis in the same block as [other] and remove them 953 // Run through all the phis in the same block as [other] and remove them
954 // from the users set. 954 // from the users set.
955 if (usersInCurrentBlock > 0) { 955 if (usersInCurrentBlock > 0) {
956 for (HPhi phi = otherBlock.phis.first; phi !== null; phi = phi.next) { 956 for (HPhi phi = otherBlock.phis.first; phi !== null; phi = phi.next) {
957 if (users.contains(phi)) { 957 if (users.contains(phi)) {
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after
2742 HBasicBlock get start() => expression.start; 2742 HBasicBlock get start() => expression.start;
2743 HBasicBlock get end() { 2743 HBasicBlock get end() {
2744 // We don't create a switch block if there are no cases. 2744 // We don't create a switch block if there are no cases.
2745 assert(!statements.isEmpty()); 2745 assert(!statements.isEmpty());
2746 return statements.last().end; 2746 return statements.last().end;
2747 } 2747 }
2748 2748
2749 bool accept(HStatementInformationVisitor visitor) => 2749 bool accept(HStatementInformationVisitor visitor) =>
2750 visitor.visitSwitchInfo(this); 2750 visitor.visitSwitchInfo(this);
2751 } 2751 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/optimize.dart » ('j') | lib/compiler/implementation/ssa/optimize.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698