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

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

Issue 2957693002: Merged changes to avoid OOM for large wasm modules. (Closed)
Patch Set: Created 3 years, 6 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 | « src/compiler/pipeline.cc ('k') | 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 f2c9a7f6b8af2dc0aa8b6066a8c2a0e9ffcafee5..f356f624d72e8dbf8fbccadfbc4cebc824501412 100644
--- a/src/compiler/wasm-compiler.h
+++ b/src/compiler/wasm-compiler.h
@@ -53,9 +53,9 @@ class WasmCompilationUnit final {
wasm::FunctionBody body, wasm::WasmName name, int index,
bool is_sync = true);
- Zone* graph_zone() { return graph_zone_.get(); }
int func_index() const { return func_index_; }
+ void ReopenCentryStub() { centry_stub_ = handle(*centry_stub_, isolate_); }
void InitializeHandles();
void ExecuteCompilation();
Handle<Code> FinishCompilation(wasm::ErrorThrower* thrower);
@@ -65,6 +65,9 @@ class WasmCompilationUnit final {
wasm::ModuleBytesEnv* module_env,
const wasm::WasmFunction* function);
+ void set_memory_cost(size_t memory_cost) { memory_cost_ = memory_cost; }
+ size_t memory_cost() const { return memory_cost_; }
+
private:
SourcePositionTable* BuildGraphForWasmFunction(double* decode_ms);
@@ -73,22 +76,20 @@ class WasmCompilationUnit final {
wasm::FunctionBody func_body_;
wasm::WasmName func_name_;
bool is_sync_;
- // The graph zone is deallocated at the end of ExecuteCompilation.
- std::unique_ptr<Zone> graph_zone_;
- JSGraph* jsgraph_;
- Zone compilation_zone_;
- CompilationInfo info_;
+ // The graph zone is deallocated at the end of ExecuteCompilation by virtue of
+ // it being zone allocated.
+ JSGraph* jsgraph_ = nullptr;
+ // the compilation_zone_, info_, and job_ fields need to survive past
+ // ExecuteCompilation, onto FinishCompilation (which happens on the main
+ // thread).
+ std::unique_ptr<Zone> compilation_zone_;
+ std::unique_ptr<CompilationInfo> info_;
std::unique_ptr<CompilationJob> job_;
+ Handle<Code> centry_stub_;
int func_index_;
wasm::Result<wasm::DecodeStruct*> graph_construction_result_;
bool ok_ = true;
-#if DEBUG
- bool handles_initialized_ = false;
-#endif // DEBUG
- ZoneVector<trap_handler::ProtectedInstructionData>
- protected_instructions_; // Instructions that are protected by the signal
- // handler.
-
+ size_t memory_cost_ = 0;
void ExecuteCompilationInternal();
DISALLOW_COPY_AND_ASSIGN(WasmCompilationUnit);
@@ -119,7 +120,8 @@ typedef ZoneVector<Node*> NodeVector;
class WasmGraphBuilder {
public:
WasmGraphBuilder(
- wasm::ModuleEnv* module_env, Zone* z, JSGraph* g, wasm::FunctionSig* sig,
+ wasm::ModuleEnv* module_env, Zone* z, JSGraph* g,
+ Handle<Code> centry_stub_, wasm::FunctionSig* sig,
compiler::SourcePositionTable* source_position_table = nullptr);
Node** Buffer(size_t count) {
@@ -269,6 +271,7 @@ class WasmGraphBuilder {
Zone* zone_;
JSGraph* jsgraph_;
+ Node* centry_stub_node_;
wasm::ModuleEnv* module_ = nullptr;
Node* mem_buffer_ = nullptr;
Node* mem_size_ = nullptr;
« no previous file with comments | « src/compiler/pipeline.cc ('k') | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698