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

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

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 | « no previous file | src/compiler/code-assembler.cc » ('j') | src/compiler/code-assembler.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/code-assembler.h
diff --git a/src/compiler/code-assembler.h b/src/compiler/code-assembler.h
index 98192330b62f238cfb9a1692d37204f1fee69bc6..ed3d451b99e69772b564d935b0bcca62dbc50135 100644
--- a/src/compiler/code-assembler.h
+++ b/src/compiler/code-assembler.h
@@ -40,6 +40,8 @@ class RawMachineLabel;
typedef ZoneList<CodeAssemblerVariable*> CodeAssemblerVariableList;
+typedef std::function<void()> CodeAssemblerCallback;
+
#define CODE_ASSEMBLER_COMPARE_BINARY_OP_LIST(V) \
V(Float32Equal) \
V(Float32LessThan) \
@@ -189,8 +191,7 @@ typedef ZoneList<CodeAssemblerVariable*> CodeAssemblerVariableList;
class V8_EXPORT_PRIVATE CodeAssembler {
public:
explicit CodeAssembler(CodeAssemblerState* state) : state_(state) {}
-
- virtual ~CodeAssembler();
+ ~CodeAssembler();
static Handle<Code> GenerateCode(CodeAssemblerState* state);
@@ -374,13 +375,18 @@ class V8_EXPORT_PRIVATE CodeAssembler {
void BreakOnNode(int node_id);
protected:
- // Enables subclasses to perform operations before and after a call.
- virtual void CallPrologue();
- virtual void CallEpilogue();
+ void RegisterCallGenerationCallbacks(
+ const CodeAssemblerCallback& call_prologue,
+ const CodeAssemblerCallback& call_epilogue);
+ void UnregisterCallGenerationCallbacks();
private:
RawMachineAssembler* raw_assembler() const;
+ // Calls respective callback registered in the state.
+ void CallPrologue();
+ void CallEpilogue();
+
CodeAssemblerState* state_;
DISALLOW_COPY_AND_ASSIGN(CodeAssembler);
@@ -477,6 +483,8 @@ class V8_EXPORT_PRIVATE CodeAssemblerState {
const char* name_;
bool code_generated_;
ZoneSet<CodeAssemblerVariable::Impl*> variables_;
+ CodeAssemblerCallback call_prologue_;
+ CodeAssemblerCallback call_epilogue_;
DISALLOW_COPY_AND_ASSIGN(CodeAssemblerState);
};
« no previous file with comments | « no previous file | src/compiler/code-assembler.cc » ('j') | src/compiler/code-assembler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698