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

Unified Diff: src/compiler/code-assembler.cc

Issue 2600183004: [turbofan] Remove virtual methods from CodeAssembler. (Closed)
Patch Set: Created 4 years 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 | « src/compiler/code-assembler.h ('k') | src/interpreter/interpreter-assembler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « src/compiler/code-assembler.h ('k') | src/interpreter/interpreter-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698