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

Side by Side Diff: src/compiler/wasm-compiler.h

Issue 2612643002: [wasm] simplify dependencies between graph builder and function decoder (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 const wasm::WasmModule* module, 102 const wasm::WasmModule* module,
103 Handle<Code> wasm_code, uint32_t index); 103 Handle<Code> wasm_code, uint32_t index);
104 104
105 // Abstracts details of building TurboFan graph nodes for WASM to separate 105 // Abstracts details of building TurboFan graph nodes for WASM to separate
106 // the WASM decoder from the internal details of TurboFan. 106 // the WASM decoder from the internal details of TurboFan.
107 class WasmTrapHelper; 107 class WasmTrapHelper;
108 typedef ZoneVector<Node*> NodeVector; 108 typedef ZoneVector<Node*> NodeVector;
109 class WasmGraphBuilder { 109 class WasmGraphBuilder {
110 public: 110 public:
111 WasmGraphBuilder( 111 WasmGraphBuilder(
112 Zone* z, JSGraph* g, wasm::FunctionSig* sig, 112 wasm::ModuleEnv* module_env, Zone* z, JSGraph* g, wasm::FunctionSig* sig,
113 compiler::SourcePositionTable* source_position_table = nullptr); 113 compiler::SourcePositionTable* source_position_table = nullptr);
114 114
115 Node** Buffer(size_t count) { 115 Node** Buffer(size_t count) {
116 if (count > cur_bufsize_) { 116 if (count > cur_bufsize_) {
117 size_t new_size = count + cur_bufsize_ + 5; 117 size_t new_size = count + cur_bufsize_ + 5;
118 cur_buffer_ = 118 cur_buffer_ =
119 reinterpret_cast<Node**>(zone_->New(new_size * sizeof(Node*))); 119 reinterpret_cast<Node**>(zone_->New(new_size * sizeof(Node*)));
120 cur_bufsize_ = new_size; 120 cur_bufsize_ = new_size;
121 } 121 }
122 return cur_buffer_; 122 return cur_buffer_;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 wasm::WasmCodePosition position); 199 wasm::WasmCodePosition position);
200 Node* StoreMem(MachineType type, Node* index, uint32_t offset, 200 Node* StoreMem(MachineType type, Node* index, uint32_t offset,
201 uint32_t alignment, Node* val, 201 uint32_t alignment, Node* val,
202 wasm::WasmCodePosition position); 202 wasm::WasmCodePosition position);
203 203
204 static void PrintDebugName(Node* node); 204 static void PrintDebugName(Node* node);
205 205
206 Node* Control() { return *control_; } 206 Node* Control() { return *control_; }
207 Node* Effect() { return *effect_; } 207 Node* Effect() { return *effect_; }
208 208
209 void set_module(wasm::ModuleEnv* module) { this->module_ = module; }
210
211 void set_control_ptr(Node** control) { this->control_ = control; } 209 void set_control_ptr(Node** control) { this->control_ = control; }
212 210
213 void set_effect_ptr(Node** effect) { this->effect_ = effect; } 211 void set_effect_ptr(Node** effect) { this->effect_ = effect; }
214 212
215 wasm::FunctionSig* GetFunctionSignature() { return sig_; } 213 wasm::FunctionSig* GetFunctionSignature() { return sig_; }
216 214
217 void Int64LoweringForTesting(); 215 void Int64LoweringForTesting();
218 216
219 void SimdScalarLoweringForTesting(); 217 void SimdScalarLoweringForTesting();
220 218
221 void SetSourcePosition(Node* node, wasm::WasmCodePosition position); 219 void SetSourcePosition(Node* node, wasm::WasmCodePosition position);
222 220
223 Node* CreateS128Value(int32_t value); 221 Node* CreateS128Value(int32_t value);
224 222
225 Node* SimdOp(wasm::WasmOpcode opcode, const NodeVector& inputs); 223 Node* SimdOp(wasm::WasmOpcode opcode, const NodeVector& inputs);
226 224
227 Node* SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane, 225 Node* SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane,
228 const NodeVector& inputs); 226 const NodeVector& inputs);
229 227
230 bool has_simd() const { return has_simd_; } 228 bool has_simd() const { return has_simd_; }
231 229
230 wasm::ModuleEnv* module_env() const { return module_; }
231
232 private: 232 private:
233 static const int kDefaultBufferSize = 16; 233 static const int kDefaultBufferSize = 16;
234 friend class WasmTrapHelper; 234 friend class WasmTrapHelper;
235 235
236 Zone* zone_; 236 Zone* zone_;
237 JSGraph* jsgraph_; 237 JSGraph* jsgraph_;
238 wasm::ModuleEnv* module_ = nullptr; 238 wasm::ModuleEnv* module_ = nullptr;
239 Node* mem_buffer_ = nullptr; 239 Node* mem_buffer_ = nullptr;
240 Node* mem_size_ = nullptr; 240 Node* mem_size_ = nullptr;
241 NodeVector function_tables_; 241 NodeVector function_tables_;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 371 }
372 372
373 int AddParameterNodes(Node** args, int pos, int param_count, 373 int AddParameterNodes(Node** args, int pos, int param_count,
374 wasm::FunctionSig* sig); 374 wasm::FunctionSig* sig);
375 }; 375 };
376 } // namespace compiler 376 } // namespace compiler
377 } // namespace internal 377 } // namespace internal
378 } // namespace v8 378 } // namespace v8
379 379
380 #endif // V8_COMPILER_WASM_COMPILER_H_ 380 #endif // V8_COMPILER_WASM_COMPILER_H_
OLDNEW
« 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