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

Unified Diff: runtime/vm/flow_graph.cc

Issue 299263005: More reduction of accessing TLS by caching/passing isolate value. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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') | runtime/vm/flow_graph_compiler.cc » ('j') | 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 36587)
+++ runtime/vm/flow_graph.cc (working copy)
@@ -87,7 +87,7 @@
}
}
// Otherwise, allocate and add it to the pool.
- ConstantInstr* constant = new ConstantInstr(object);
+ ConstantInstr* constant = new(isolate()) ConstantInstr(object);
constant->set_ssa_temp_index(alloc_ssa_temp_index());
AddToInitialDefinitions(constant);
return constant;
@@ -271,7 +271,8 @@
LivenessAnalysis::LivenessAnalysis(
intptr_t variable_count,
const GrowableArray<BlockEntryInstr*>& postorder)
- : variable_count_(variable_count),
+ : isolate_(Isolate::Current()),
+ variable_count_(variable_count),
postorder_(postorder),
live_out_(postorder.length()),
kill_(postorder.length()),
@@ -327,9 +328,9 @@
void LivenessAnalysis::Analyze() {
const intptr_t block_count = postorder_.length();
for (intptr_t i = 0; i < block_count; i++) {
- live_out_.Add(new BitVector(variable_count_));
- kill_.Add(new BitVector(variable_count_));
- live_in_.Add(new BitVector(variable_count_));
+ live_out_.Add(new(isolate()) BitVector(variable_count_));
+ kill_.Add(new(isolate()) BitVector(variable_count_));
+ live_in_.Add(new(isolate()) BitVector(variable_count_));
}
ComputeInitialSets();
@@ -440,7 +441,7 @@
void VariableLivenessAnalysis::ComputeInitialSets() {
const intptr_t block_count = postorder_.length();
- BitVector* last_loads = new BitVector(variable_count_);
+ BitVector* last_loads = new(isolate()) BitVector(variable_count_);
for (intptr_t i = 0; i < block_count; i++) {
BlockEntryInstr* block = postorder_[i];
@@ -564,7 +565,7 @@
idom.Add(parent_[i]);
semi.Add(i);
label.Add(i);
- dominance_frontier->Add(new BitVector(size));
+ dominance_frontier->Add(new(isolate()) BitVector(size));
}
// Loop over the blocks in reverse preorder (not including the graph
@@ -727,7 +728,7 @@
// are unknown and so treated like parameters.
intptr_t count = IsCompiledForOsr() ? variable_count() : parameter_count();
for (intptr_t i = 0; i < count; ++i) {
- ParameterInstr* param = new ParameterInstr(i, entry);
+ ParameterInstr* param = new(isolate()) ParameterInstr(i, entry);
param->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
AddToInitialDefinitions(param);
env.Add(param);
@@ -808,7 +809,7 @@
} else if (block_entry->IsCatchBlockEntry()) {
// Add real definitions for all locals and parameters.
for (intptr_t i = 0; i < env->length(); ++i) {
- ParameterInstr* param = new ParameterInstr(i, block_entry);
+ ParameterInstr* param = new(isolate()) ParameterInstr(i, block_entry);
param->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
(*env)[i] = param;
block_entry->AsCatchBlockEntry()->initial_definitions()->Add(param);
@@ -973,7 +974,7 @@
PhiInstr* phi = (*successor->phis())[i];
if (phi != NULL) {
// Rename input operand.
- Value* use = new Value((*env)[i]);
+ Value* use = new(isolate()) Value((*env)[i]);
phi->SetInputAt(pred_index, use);
}
}
@@ -1029,7 +1030,7 @@
// Design & Implementation" (Muchnick) p192.
BitVector* FlowGraph::FindLoop(BlockEntryInstr* m, BlockEntryInstr* n) {
GrowableArray<BlockEntryInstr*> stack;
- BitVector* loop = new BitVector(preorder_.length());
+ BitVector* loop = new(isolate()) BitVector(preorder_.length());
loop->Add(n->preorder_number());
if (n != m) {
@@ -1053,7 +1054,7 @@
ZoneGrowableArray<BlockEntryInstr*>* FlowGraph::ComputeLoops() {
ZoneGrowableArray<BlockEntryInstr*>* loop_headers =
- new ZoneGrowableArray<BlockEntryInstr*>();
+ new(isolate()) ZoneGrowableArray<BlockEntryInstr*>();
for (BlockIterator it = postorder_iterator();
!it.Done();
@@ -1129,7 +1130,7 @@
void FlowGraph::ComputeBlockEffects() {
- block_effects_ = new BlockEffects(this);
+ block_effects_ = new(isolate()) BlockEffects(this);
}
@@ -1137,11 +1138,11 @@
: available_at_(flow_graph->postorder().length()) {
// We are tracking a single effect.
ASSERT(EffectSet::kLastEffect == 1);
-
+ Isolate* isolate = flow_graph->isolate();
const intptr_t block_count = flow_graph->postorder().length();
// Set of blocks that contain side-effects.
- BitVector* kill = new BitVector(block_count);
+ BitVector* kill = new(isolate) BitVector(block_count);
// Per block available-after sets. Block A is available after the block B if
// and only if A is either equal to B or A is available at B and B contains no
@@ -1167,7 +1168,7 @@
}
}
- BitVector* temp = new BitVector(block_count);
+ BitVector* temp = new(isolate) BitVector(block_count);
// Recompute available-at based on predecessors' available-after until the fix
// point is reached.
@@ -1199,8 +1200,10 @@
if ((current == NULL) || !current->Equals(*temp)) {
// Available-at changed: update it and recompute available-after.
if (available_at_[block_num] == NULL) {
- current = available_at_[block_num] = new BitVector(block_count);
- available_after[block_num] = new BitVector(block_count);
+ current = available_at_[block_num] =
+ new(isolate) BitVector(block_count);
+ available_after[block_num] =
+ new(isolate) BitVector(block_count);
// Block is always available after itself.
available_after[block_num]->Add(block_num);
}
« no previous file with comments | « runtime/vm/flow_graph.h ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698