| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_COMPILER_WASM_COMPILER_H_ | 5 #ifndef V8_COMPILER_WASM_COMPILER_H_ |
| 6 #define V8_COMPILER_WASM_COMPILER_H_ | 6 #define V8_COMPILER_WASM_COMPILER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 // Clients of this interface shouldn't depend on lots of compiler internals. | 10 // Clients of this interface shouldn't depend on lots of compiler internals. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 // Expose {Node} and {Graph} opaquely as {wasm::TFNode} and {wasm::TFGraph}. | 42 // Expose {Node} and {Graph} opaquely as {wasm::TFNode} and {wasm::TFGraph}. |
| 43 typedef compiler::Node TFNode; | 43 typedef compiler::Node TFNode; |
| 44 typedef compiler::JSGraph TFGraph; | 44 typedef compiler::JSGraph TFGraph; |
| 45 } // namespace wasm | 45 } // namespace wasm |
| 46 | 46 |
| 47 namespace compiler { | 47 namespace compiler { |
| 48 class WasmCompilationUnit final { | 48 class WasmCompilationUnit final { |
| 49 public: | 49 public: |
| 50 WasmCompilationUnit(Isolate* isolate, wasm::ModuleBytesEnv* module_env, | 50 WasmCompilationUnit(Isolate* isolate, wasm::ModuleBytesEnv* module_env, |
| 51 const wasm::WasmFunction* function, bool is_sync = true); | 51 const wasm::WasmFunction* function); |
| 52 WasmCompilationUnit(Isolate* isolate, wasm::ModuleEnv* module_env, | 52 WasmCompilationUnit(Isolate* isolate, wasm::ModuleEnv* module_env, |
| 53 wasm::FunctionBody body, wasm::WasmName name, int index, | 53 wasm::FunctionBody body, wasm::WasmName name, int index); |
| 54 bool is_sync = true); | |
| 55 | 54 |
| 56 int func_index() const { return func_index_; } | 55 int func_index() const { return func_index_; } |
| 57 | 56 |
| 58 void ReopenCentryStub() { centry_stub_ = handle(*centry_stub_, isolate_); } | 57 void ReopenCentryStub() { centry_stub_ = handle(*centry_stub_, isolate_); } |
| 59 void ExecuteCompilation(); | 58 void ExecuteCompilation(); |
| 60 Handle<Code> FinishCompilation(wasm::ErrorThrower* thrower); | 59 Handle<Code> FinishCompilation(wasm::ErrorThrower* thrower); |
| 61 | 60 |
| 62 static Handle<Code> CompileWasmFunction(wasm::ErrorThrower* thrower, | 61 static Handle<Code> CompileWasmFunction(wasm::ErrorThrower* thrower, |
| 63 Isolate* isolate, | 62 Isolate* isolate, |
| 64 wasm::ModuleBytesEnv* module_env, | 63 wasm::ModuleBytesEnv* module_env, |
| 65 const wasm::WasmFunction* function); | 64 const wasm::WasmFunction* function); |
| 66 | 65 |
| 67 void set_memory_cost(size_t memory_cost) { memory_cost_ = memory_cost; } | 66 void set_memory_cost(size_t memory_cost) { memory_cost_ = memory_cost; } |
| 68 size_t memory_cost() const { return memory_cost_; } | 67 size_t memory_cost() const { return memory_cost_; } |
| 69 | 68 |
| 70 private: | 69 private: |
| 71 SourcePositionTable* BuildGraphForWasmFunction(double* decode_ms); | 70 SourcePositionTable* BuildGraphForWasmFunction(double* decode_ms); |
| 72 | 71 |
| 73 Isolate* isolate_; | 72 Isolate* isolate_; |
| 74 wasm::ModuleEnv* module_env_; | 73 wasm::ModuleEnv* module_env_; |
| 75 wasm::FunctionBody func_body_; | 74 wasm::FunctionBody func_body_; |
| 76 wasm::WasmName func_name_; | 75 wasm::WasmName func_name_; |
| 77 bool is_sync_; | |
| 78 // The graph zone is deallocated at the end of ExecuteCompilation by virtue of | 76 // The graph zone is deallocated at the end of ExecuteCompilation by virtue of |
| 79 // it being zone allocated. | 77 // it being zone allocated. |
| 80 JSGraph* jsgraph_ = nullptr; | 78 JSGraph* jsgraph_ = nullptr; |
| 81 // the compilation_zone_, info_, and job_ fields need to survive past | 79 // the compilation_zone_, info_, and job_ fields need to survive past |
| 82 // ExecuteCompilation, onto FinishCompilation (which happens on the main | 80 // ExecuteCompilation, onto FinishCompilation (which happens on the main |
| 83 // thread). | 81 // thread). |
| 84 std::unique_ptr<Zone> compilation_zone_; | 82 std::unique_ptr<Zone> compilation_zone_; |
| 85 std::unique_ptr<CompilationInfo> info_; | 83 std::unique_ptr<CompilationInfo> info_; |
| 86 std::unique_ptr<CompilationJob> job_; | 84 std::unique_ptr<CompilationJob> job_; |
| 87 Handle<Code> centry_stub_; | 85 Handle<Code> centry_stub_; |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 wasm::FunctionSig* sig); | 409 wasm::FunctionSig* sig); |
| 412 | 410 |
| 413 void SetNeedsStackCheck() { needs_stack_check_ = true; } | 411 void SetNeedsStackCheck() { needs_stack_check_ = true; } |
| 414 }; | 412 }; |
| 415 | 413 |
| 416 } // namespace compiler | 414 } // namespace compiler |
| 417 } // namespace internal | 415 } // namespace internal |
| 418 } // namespace v8 | 416 } // namespace v8 |
| 419 | 417 |
| 420 #endif // V8_COMPILER_WASM_COMPILER_H_ | 418 #endif // V8_COMPILER_WASM_COMPILER_H_ |
| OLD | NEW |