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

Unified Diff: runtime/vm/intermediate_language.cc

Issue 619903002: Generalize bounds checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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
Index: runtime/vm/intermediate_language.cc
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 80b0f870ee6f463ac03ef525ffd89fec6ad29878..ec9d0cdd5dbb3d60f07560763b5512a97d30cda7 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -771,6 +771,34 @@ void BranchInstr::InheritDeoptTarget(Isolate* isolate, Instruction* other) {
}
+bool Instruction::IsDominatedBy(Instruction* dom) {
+ BlockEntryInstr* block = GetBlock();
+ BlockEntryInstr* dom_block = dom->GetBlock();
+
+ if (dom->IsPhi()) {
+ dom = dom_block;
+ }
+
+ if (block == dom_block) {
+ if ((block == dom) || (this == block->last_instruction())) {
+ return true;
+ }
+
+ if (IsPhi()) {
+ return false;
+ }
+
+ for (Instruction* curr = dom->next(); curr != NULL; curr = curr->next()) {
+ if (curr == this) return true;
+ }
+
+ return false;
+ }
+
+ return dom_block->Dominates(block);
+}
+
+
void Definition::ReplaceWith(Definition* other,
ForwardInstructionIterator* iterator) {
// Record other's input uses.
@@ -963,6 +991,15 @@ bool BlockEntryInstr::Dominates(BlockEntryInstr* other) const {
}
+BlockEntryInstr* BlockEntryInstr::ImmediateDominator() const {
+ Instruction* last = dominator()->last_instruction();
+ if ((last->SuccessorCount() == 1) && (last->SuccessorAt(0) == this)) {
+ return dominator();
+ }
+ return NULL;
+}
+
+
// Helper to mutate the graph during inlining. This block should be
// replaced with new_block as a predecessor of all of this block's
// successors. For each successor, the predecessors will be reordered

Powered by Google App Engine
This is Rietveld 408576698