summaryrefslogtreecommitdiff
path: root/compiler/optimizing/builder.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2015-10-01 20:57:57 +0100
committer Vladimir Marko <vmarko@google.com> 2015-10-08 11:10:18 +0100
commitec7802a102d49ab5c17495118d4fe0bcc7287beb (patch)
tree08649609604b9c96bc48ca071c48b0af5abb1a3f /compiler/optimizing/builder.cc
parentb2e436ffcda1d7a87e7bf9133d8ed878388c73c2 (diff)
Add DCHECKs to ArenaVector and ScopedArenaVector.
Implement dchecked_vector<> template that DCHECK()s element access and insert()/emplace()/erase() positions. Change the ArenaVector<> and ScopedArenaVector<> aliases to use the new template instead of std::vector<>. Remove DCHECK()s that have now become unnecessary from the Optimizing compiler. Change-Id: Ib8506bd30d223f68f52bd4476c76d9991acacadc
Diffstat (limited to 'compiler/optimizing/builder.cc')
-rw-r--r--compiler/optimizing/builder.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc
index 5acc5fda71..503d08f6f5 100644
--- a/compiler/optimizing/builder.cc
+++ b/compiler/optimizing/builder.cc
@@ -375,7 +375,7 @@ void HGraphBuilder::InsertTryBoundaryBlocks(const DexFile::CodeItem& code_item)
// We do not split each edge separately, but rather create one boundary block
// that all predecessors are relinked to. This preserves loop headers (b/23895756).
for (auto entry : try_block_info) {
- HBasicBlock* try_block = graph_->GetBlock(entry.first);
+ HBasicBlock* try_block = graph_->GetBlocks()[entry.first];
for (HBasicBlock* predecessor : try_block->GetPredecessors()) {
if (GetTryItem(predecessor, try_block_info) != entry.second) {
// Found a predecessor not covered by the same TryItem. Insert entering
@@ -392,10 +392,10 @@ void HGraphBuilder::InsertTryBoundaryBlocks(const DexFile::CodeItem& code_item)
// Do a second pass over the try blocks and insert exit TryBoundaries where
// the successor is not in the same TryItem.
for (auto entry : try_block_info) {
- HBasicBlock* try_block = graph_->GetBlock(entry.first);
+ HBasicBlock* try_block = graph_->GetBlocks()[entry.first];
// NOTE: Do not use iterators because SplitEdge would invalidate them.
for (size_t i = 0, e = try_block->GetSuccessors().size(); i < e; ++i) {
- HBasicBlock* successor = try_block->GetSuccessor(i);
+ HBasicBlock* successor = try_block->GetSuccessors()[i];
// If the successor is a try block, all of its predecessors must be
// covered by the same TryItem. Otherwise the previous pass would have
@@ -581,7 +581,6 @@ bool HGraphBuilder::ComputeBranchTargets(const uint16_t* code_ptr,
HBasicBlock* HGraphBuilder::FindBlockStartingAt(int32_t dex_pc) const {
DCHECK_GE(dex_pc, 0);
- DCHECK_LT(static_cast<size_t>(dex_pc), branch_targets_.size());
return branch_targets_[dex_pc];
}
@@ -2877,7 +2876,6 @@ bool HGraphBuilder::AnalyzeDexInstruction(const Instruction& instruction, uint32
} // NOLINT(readability/fn_size)
HLocal* HGraphBuilder::GetLocalAt(uint32_t register_index) const {
- DCHECK_LT(register_index, locals_.size());
return locals_[register_index];
}