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

Unified Diff: runtime/vm/flow_graph_optimizer.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/flow_graph_optimizer.cc
diff --git a/runtime/vm/flow_graph_optimizer.cc b/runtime/vm/flow_graph_optimizer.cc
index f5333546f2ed98d51cc45fded39181aab427b875..5245638206025c48cbe03efc44e68fc99a1f893c 100644
--- a/runtime/vm/flow_graph_optimizer.cc
+++ b/runtime/vm/flow_graph_optimizer.cc
@@ -4725,42 +4725,6 @@ bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr,
#if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_IA32)
// Smi widening pass is only meaningful on platforms where Smi
// is smaller than 32bit. For now only support it on ARM and ia32.
-
-class DefinitionWorklist : public ValueObject {
- public:
- DefinitionWorklist(FlowGraph* flow_graph,
- intptr_t initial_capacity)
- : defs_(initial_capacity),
- contains_vector_(new(flow_graph->isolate()) BitVector(
- flow_graph->isolate(), flow_graph->current_ssa_temp_index())) {
- }
-
- void Add(Definition* defn) {
- if (!Contains(defn)) {
- defs_.Add(defn);
- contains_vector_->Add(defn->ssa_temp_index());
- }
- }
-
- bool Contains(Definition* defn) const {
- return (defn->ssa_temp_index() >= 0) &&
- contains_vector_->Contains(defn->ssa_temp_index());
- }
-
- const GrowableArray<Definition*>& definitions() const { return defs_; }
- BitVector* contains_vector() const { return contains_vector_; }
-
- void Clear() {
- defs_.TruncateTo(0);
- contains_vector_->Clear();
- }
-
- private:
- GrowableArray<Definition*> defs_;
- BitVector* contains_vector_;
-};
-
-
static bool CanBeWidened(BinarySmiOpInstr* smi_op) {
return BinaryInt32OpInstr::IsSupported(smi_op->op_kind(),
smi_op->left(),
@@ -5059,17 +5023,6 @@ void TryCatchAnalyzer::Optimize(FlowGraph* flow_graph) {
}
-static BlockEntryInstr* FindPreHeader(BlockEntryInstr* header) {
- for (intptr_t j = 0; j < header->PredecessorCount(); ++j) {
- BlockEntryInstr* candidate = header->PredecessorAt(j);
- if (header->dominator() == candidate) {
- return candidate;
- }
- }
- return NULL;
-}
-
-
LICM::LICM(FlowGraph* flow_graph) : flow_graph_(flow_graph) {
ASSERT(flow_graph->is_licm_allowed());
}
@@ -5188,7 +5141,7 @@ void LICM::OptimisticallySpecializeSmiPhis() {
for (intptr_t i = 0; i < loop_headers.length(); ++i) {
JoinEntryInstr* header = loop_headers[i]->AsJoinEntry();
// Skip loop that don't have a pre-header block.
- BlockEntryInstr* pre_header = FindPreHeader(header);
+ BlockEntryInstr* pre_header = header->ImmediateDominator();
if (pre_header == NULL) continue;
for (PhiIterator it(header); !it.Done(); it.Advance()) {
@@ -5216,7 +5169,7 @@ void LICM::Optimize() {
for (intptr_t i = 0; i < loop_headers.length(); ++i) {
BlockEntryInstr* header = loop_headers[i];
// Skip loop that don't have a pre-header block.
- BlockEntryInstr* pre_header = FindPreHeader(header);
+ BlockEntryInstr* pre_header = header->ImmediateDominator();
if (pre_header == NULL) continue;
for (BitVector::Iterator loop_it(header->loop_info());
@@ -6742,7 +6695,7 @@ class LoadOptimizer : public ValueObject {
for (intptr_t i = 0; i < loop_headers.length(); i++) {
BlockEntryInstr* header = loop_headers[i];
- BlockEntryInstr* pre_header = FindPreHeader(header);
+ BlockEntryInstr* pre_header = header->ImmediateDominator();
if (pre_header == NULL) {
invariant_loads->Add(NULL);
continue;

Powered by Google App Engine
This is Rietveld 408576698