summaryrefslogtreecommitdiff
path: root/src/compiler/Frontend.cc
diff options
context:
space:
mode:
author Elliott Hughes <enh@google.com> 2012-04-13 15:59:59 -0700
committer Elliott Hughes <enh@google.com> 2012-04-14 11:44:21 -0700
commita0e180632411f7fe0edf454e571c42209ee7b540 (patch)
tree97dc85e76c5449ec1a901226c44e0f68fec89870 /src/compiler/Frontend.cc
parente5eb1914de86129d78e965fb9f2e1bfb2aa68640 (diff)
Add a SafeMap equivalent to std::map but without the error-prone operator[].
Change-Id: Iae5ba2091c55a34dbd1005cf3d25fce2a8d5c1f9
Diffstat (limited to 'src/compiler/Frontend.cc')
-rw-r--r--src/compiler/Frontend.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/compiler/Frontend.cc b/src/compiler/Frontend.cc
index 309bcf82d8..dbaf323a2d 100644
--- a/src/compiler/Frontend.cc
+++ b/src/compiler/Frontend.cc
@@ -136,8 +136,7 @@ BasicBlock *splitBlock(CompilationUnit* cUnit, unsigned int codeOffset,
bottomBlock->lastMIRInsn = origBlock->lastMIRInsn;
/* Add it to the quick lookup cache */
- cUnit->blockMap.insert(std::make_pair(bottomBlock->startOffset,
- bottomBlock));
+ cUnit->blockMap.Put(bottomBlock->startOffset, bottomBlock);
/* Handle the taken path */
bottomBlock->taken = origBlock->taken;
@@ -211,7 +210,7 @@ BasicBlock *findBlock(CompilationUnit* cUnit, unsigned int codeOffset,
GrowableList* blockList = &cUnit->blockList;
BasicBlock* bb;
unsigned int i;
- std::map<unsigned int, BasicBlock*>::iterator it;
+ SafeMap<unsigned int, BasicBlock*>::iterator it;
it = cUnit->blockMap.find(codeOffset);
if (it != cUnit->blockMap.end()) {
@@ -239,7 +238,7 @@ BasicBlock *findBlock(CompilationUnit* cUnit, unsigned int codeOffset,
bb = oatNewBB(cUnit, kDalvikByteCode, cUnit->numBlocks++);
oatInsertGrowableList(cUnit, &cUnit->blockList, (intptr_t) bb);
bb->startOffset = codeOffset;
- cUnit->blockMap.insert(std::make_pair(bb->startOffset, bb));
+ cUnit->blockMap.Put(bb->startOffset, bb);
return bb;
}
@@ -853,7 +852,7 @@ CompiledMethod* oatCompileMethod(Compiler& compiler,
curBlock->startOffset = 0;
oatInsertGrowableList(cUnit.get(), &cUnit->blockList, (intptr_t) curBlock);
/* Add first block to the fast lookup cache */
- cUnit->blockMap.insert(std::make_pair(curBlock->startOffset, curBlock));
+ cUnit->blockMap.Put(curBlock->startOffset, curBlock);
entryBlock->fallThrough = curBlock;
oatInsertGrowableList(cUnit.get(), curBlock->predecessors,
(intptr_t)entryBlock);