Index: src/compiler/code-assembler.cc |
diff --git a/src/compiler/code-assembler.cc b/src/compiler/code-assembler.cc |
index 4844355abb08e61a694f9ae669e201477a21cf67..e6624e8653bc2002f328a3939c3c4c8307a92823 100644 |
--- a/src/compiler/code-assembler.cc |
+++ b/src/compiler/code-assembler.cc |
@@ -96,9 +96,32 @@ void CodeAssembler::BreakOnNode(int node_id) { |
graph->AddDecorator(decorator); |
} |
-void CodeAssembler::CallPrologue() {} |
+void CodeAssembler::RegisterCallGenerationCallbacks( |
+ const CodeAssemblerCallback& call_prologue, |
+ const CodeAssemblerCallback& call_epilogue) { |
+ // The callback can be registered only once. |
+ DCHECK(!state_->call_prologue_); |
+ DCHECK(!state_->call_epilogue_); |
+ state_->call_prologue_ = call_prologue; |
+ state_->call_epilogue_ = call_epilogue; |
+} |
+ |
+void CodeAssembler::UnregisterCallGenerationCallbacks() { |
+ state_->call_prologue_ = nullptr; |
+ state_->call_epilogue_ = nullptr; |
+} |
+ |
+void CodeAssembler::CallPrologue() { |
+ if (state_->call_prologue_) { |
+ state_->call_prologue_(); |
+ } |
+} |
-void CodeAssembler::CallEpilogue() {} |
+void CodeAssembler::CallEpilogue() { |
+ if (state_->call_epilogue_) { |
+ state_->call_epilogue_(); |
+ } |
+} |
// static |
Handle<Code> CodeAssembler::GenerateCode(CodeAssemblerState* state) { |
@@ -450,11 +473,7 @@ Node* CodeAssembler::TailCallRuntime(Runtime::FunctionId function, |
Node* nodes[] = {centry, args..., ref, arity, context}; |
- CallPrologue(); |
Igor Sheludko
2016/12/28 15:22:38
Drive-by fix.
rmcilroy
2017/01/03 09:37:50
Thanks!
|
- Node* return_value = |
- raw_assembler()->TailCallN(desc, arraysize(nodes), nodes); |
- CallEpilogue(); |
- return return_value; |
+ return raw_assembler()->TailCallN(desc, arraysize(nodes), nodes); |
} |
// Instantiate TailCallRuntime() with up to 6 arguments. |