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

Unified Diff: runtime/vm/flow_graph.cc

Issue 344883009: Use hash map for the SSA builder constant pool. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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
« no previous file with comments | « runtime/vm/flow_graph.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph.cc
===================================================================
--- runtime/vm/flow_graph.cc (revision 37814)
+++ runtime/vm/flow_graph.cc (working copy)
@@ -93,18 +93,14 @@
ConstantInstr* FlowGraph::GetConstant(const Object& object) {
- // Check if the constant is already in the pool.
- GrowableArray<Definition*>* pool = graph_entry_->initial_definitions();
- for (intptr_t i = 0; i < pool->length(); ++i) {
- ConstantInstr* constant = (*pool)[i]->AsConstant();
- if ((constant != NULL) && (constant->value().raw() == object.raw())) {
- return constant;
- }
+ ConstantInstr* constant = constant_instr_pool_.Lookup(object);
+ if (constant == NULL) {
+ // Otherwise, allocate and add it to the pool.
+ constant = new(isolate()) ConstantInstr(object);
+ constant->set_ssa_temp_index(alloc_ssa_temp_index());
+ AddToInitialDefinitions(constant);
+ constant_instr_pool_.Insert(constant);
}
- // Otherwise, allocate and add it to the pool.
- ConstantInstr* constant = new(isolate()) ConstantInstr(object);
- constant->set_ssa_temp_index(alloc_ssa_temp_index());
- AddToInitialDefinitions(constant);
return constant;
}
« no previous file with comments | « runtime/vm/flow_graph.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698