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

Unified Diff: src/compiler/wasm-compiler.h

Issue 1994963002: [wasm] Move WasmCompilationUnit to .h file. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months 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/wasm-compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/wasm-compiler.h
diff --git a/src/compiler/wasm-compiler.h b/src/compiler/wasm-compiler.h
index 93c2ae91d10168e573ac8f0178bb261e74d5ca8e..f52e559d52930dc089ef5217459b3236100fe9ae 100644
--- a/src/compiler/wasm-compiler.h
+++ b/src/compiler/wasm-compiler.h
@@ -7,6 +7,7 @@
// Clients of this interface shouldn't depend on lots of compiler internals.
// Do not include anything from src/compiler here!
+#include "src/compiler.h"
#include "src/wasm/wasm-opcodes.h"
#include "src/zone.h"
@@ -20,7 +21,6 @@ class JSGraph;
class Graph;
class Operator;
class SourcePositionTable;
-class WasmCompilationUnit;
}
namespace wasm {
@@ -35,10 +35,41 @@ typedef compiler::JSGraph TFGraph;
}
namespace compiler {
-// Compiles a single function, producing a code object.
-Handle<Code> CompileWasmFunction(wasm::ErrorThrower* thrower, Isolate* isolate,
- wasm::ModuleEnv* module_env,
- const wasm::WasmFunction* function);
+class WasmCompilationUnit final {
+ public:
+ WasmCompilationUnit(wasm::ErrorThrower* thrower, Isolate* isolate,
+ wasm::ModuleEnv* module_env,
+ const wasm::WasmFunction* function, uint32_t index);
+
+ Zone* graph_zone() { return graph_zone_.get(); }
+ int index() const { return index_; }
+
+ void ExecuteCompilation();
+ Handle<Code> FinishCompilation();
+
+ static Handle<Code> CompileWasmFunction(wasm::ErrorThrower* thrower,
+ Isolate* isolate,
+ wasm::ModuleEnv* module_env,
+ const wasm::WasmFunction* function) {
+ WasmCompilationUnit unit(thrower, isolate, module_env, function, 0);
+ unit.ExecuteCompilation();
+ return unit.FinishCompilation();
+ }
+
+ private:
+ wasm::ErrorThrower* thrower_;
+ Isolate* isolate_;
+ wasm::ModuleEnv* module_env_;
+ const wasm::WasmFunction* function_;
+ // The graph zone is deallocated at the end of ExecuteCompilation.
+ base::SmartPointer<Zone> graph_zone_;
+ JSGraph* jsgraph_;
+ Zone compilation_zone_;
+ CompilationInfo info_;
+ base::SmartPointer<CompilationJob> job_;
+ uint32_t index_;
+ bool ok_;
+};
// Wraps a JS function, producing a code object that can be called from WASM.
Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
@@ -53,16 +84,6 @@ Handle<JSFunction> CompileJSToWasmWrapper(
Isolate* isolate, wasm::ModuleEnv* module, Handle<String> name,
Handle<Code> wasm_code, Handle<JSObject> module_object, uint32_t index);
-WasmCompilationUnit* CreateWasmCompilationUnit(
- wasm::ErrorThrower* thrower, Isolate* isolate, wasm::ModuleEnv* module_env,
- const wasm::WasmFunction* function, uint32_t index);
-
-void ExecuteCompilation(WasmCompilationUnit* unit);
-
-Handle<Code> FinishCompilation(WasmCompilationUnit* unit);
-
-uint32_t GetIndexOfWasmCompilationUnit(WasmCompilationUnit* unit);
-
// Abstracts details of building TurboFan graph nodes for WASM to separate
// the WASM decoder from the internal details of TurboFan.
class WasmTrapHelper;
« no previous file with comments | « no previous file | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698