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

Unified Diff: src/hydrogen-instructions.cc

Issue 12079042: Base iDef update code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« src/hydrogen-instructions.h ('K') | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 4f8af2b0c041f429b1992213a8f4d7571dd5bea4..b1e3a943537f3602f83b188e9b08921a63fecc0f 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -364,6 +364,54 @@ HType HType::TypeFromValue(Handle<Object> value) {
}
+bool HValue::CheckDominanceFollowingDefinitionList(
+ HValue* dominator, HValue* dominated) {
+ if (dominator->block() != dominated->block()) {
+ // If they are in different blocks we can use the dominance relation
+ // between the blocks.
+ return dominator->block()->Dominates(dominated->block());
+ } else {
+ // Otherwise we must see which instruction comes first, considering
+ // that phis always precede regular instructions.
+ if (dominator->IsInstruction()) {
+ if (dominated->IsInstruction()) {
+ HInstruction* next = HInstruction::cast(dominator)->next();
+ while (next != NULL) {
Jakob Kummerow 2013/01/31 14:06:43 I don't like endless loops very much.
Massi 2013/01/31 17:16:19 Done (and it was actually an embarrassing bug...).
+ if (next == dominated) return true;
+ }
+ return false;
+ } else if (dominated->IsPhi()) {
+ return false;
+ } else {
+ UNREACHABLE();
+ }
+ } else if (dominator->IsPhi()) {
+ if (dominated->IsInstruction()) {
+ return true;
+ } else {
+ // We cannot compare which phi comes first.
+ UNREACHABLE();
+ }
+ } else {
+ UNREACHABLE();
+ }
+ return false;
+ }
+}
+
+
+bool HValue::CheckDominanceUsingProcessedFlag(
+ HValue* dominator, HValue* dominated) {
+ if (dominator->block() != dominated->block()) {
+ return dominator->block()->Dominates(dominated->block());
+ } else {
+ // If "dominated" is in the same block as the definition we check if is
+ // has already been processed or if it is a phi: if not it is dominated.
+ return dominated->CheckFlag(kIDefsProcessingDone) || dominated->IsPhi();
Jakob Kummerow 2013/01/31 14:06:43 I think this condition is the wrong way round: it'
Massi 2013/01/31 17:16:19 Done.
+ }
+}
+
+
bool HValue::IsDefinedAfter(HBasicBlock* other) const {
return block()->block_id() > other->block_id();
}
« src/hydrogen-instructions.h ('K') | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698