diff options
| author | 2015-05-27 17:18:33 +0100 | |
|---|---|---|
| committer | 2015-05-28 10:44:36 +0100 | |
| commit | 76b1e1799a713a19218de26b171b0aef48a59e98 (patch) | |
| tree | 897d0d22d246367eb09d8b825b43c384074083f4 /compiler/optimizing/nodes.cc | |
| parent | 382f5c24eb663ca8fa39a94a038349138a00272a (diff) | |
Add a HCurrentMethod node.
This enables register allocation for the current method, so
that users of it don't always load it from the stack.
Currently only used by HLoadClass. Will make follow-up
CLs for the other users.
Change-Id: If73324d85643102faba47fabbbd2755eb258c59c
Diffstat (limited to 'compiler/optimizing/nodes.cc')
| -rw-r--r-- | compiler/optimizing/nodes.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index 483c09e5a9..80d4b4a863 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -295,6 +295,19 @@ HNullConstant* HGraph::GetNullConstant() { return cached_null_constant_; } +HCurrentMethod* HGraph::GetCurrentMethod() { + if (cached_current_method_ == nullptr) { + cached_current_method_ = new (arena_) HCurrentMethod(); + if (entry_block_->GetFirstInstruction() == nullptr) { + entry_block_->AddInstruction(cached_current_method_); + } else { + entry_block_->InsertInstructionBefore( + cached_current_method_, entry_block_->GetFirstInstruction()); + } + } + return cached_current_method_; +} + HConstant* HGraph::GetConstant(Primitive::Type type, int64_t value) { switch (type) { case Primitive::Type::kPrimBoolean: @@ -1461,6 +1474,8 @@ void HGraph::InlineInto(HGraph* outer_graph, HInvoke* invoke) { DCHECK(parameter_index != last_input_index); } current->ReplaceWith(invoke->InputAt(parameter_index++)); + } else if (current->IsCurrentMethod()) { + current->ReplaceWith(outer_graph->GetCurrentMethod()); } else { DCHECK(current->IsGoto() || current->IsSuspendCheck()); entry_block_->RemoveInstruction(current); |