Revert "Revert "Refactor HGraphBuilder and SsaBuilder to remove HLocals""
This patch merges the instruction-building phases from HGraphBuilder
and SsaBuilder into a single HInstructionBuilder class. As a result,
it is not necessary to generate HLocal, HLoadLocal and HStoreLocal
instructions any more, as the builder produces SSA form directly.
Saves 5-15% of arena-allocated memory (see bug for more data):
GMS 20.46MB => 19.26MB (-5.86%)
Maps 24.12MB => 21.47MB (-10.98%)
YouTube 28.60MB => 26.01MB (-9.05%)
This CL fixed an issue with parsing quickened instructions.
Bug: 27894376
Bug: 27998571
Bug: 27995065
Change-Id: I20dbe1bf2d0fe296377478db98cb86cba695e694
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index 9f448af..1086cbf 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -318,21 +318,11 @@
}
}
- // Place the suspend check at the beginning of the header, so that live registers
- // will be known when allocating registers. Note that code generation can still
- // generate the suspend check at the back edge, but needs to be careful with
- // loop phi spill slots (which are not written to at back edge).
HInstruction* first_instruction = header->GetFirstInstruction();
- if (first_instruction == nullptr) {
- HSuspendCheck* check = new (arena_) HSuspendCheck(header->GetDexPc());
- header->AddInstruction(check);
- first_instruction = check;
- } else if (!first_instruction->IsSuspendCheck()) {
- HSuspendCheck* check = new (arena_) HSuspendCheck(header->GetDexPc());
- header->InsertInstructionBefore(check, first_instruction);
- first_instruction = check;
+ if (first_instruction != nullptr && first_instruction->IsSuspendCheck()) {
+ // Called from DeadBlockElimination. Update SuspendCheck pointer.
+ info->SetSuspendCheck(first_instruction->AsSuspendCheck());
}
- info->SetSuspendCheck(first_instruction->AsSuspendCheck());
}
void HGraph::ComputeTryBlockInformation() {
@@ -1882,6 +1872,7 @@
instr_it.Advance()) {
HInstruction* current = instr_it.Current();
if (current->NeedsEnvironment()) {
+ DCHECK(current->HasEnvironment());
current->GetEnvironment()->SetAndCopyParentChain(
outer_graph->GetArena(), invoke->GetEnvironment());
}