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

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

Issue 1890803002: [wasm] Generate source position information (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-throw-error
Patch Set: avoid using std::tie Created 4 years, 8 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 | « src/compiler/source-position.cc ('k') | 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 // Clients of this interface shouldn't depend on lots of compiler internals. 8 // Clients of this interface shouldn't depend on lots of compiler internals.
9 // Do not include anything from src/compiler here! 9 // Do not include anything from src/compiler here!
10 #include "src/wasm/wasm-opcodes.h" 10 #include "src/wasm/wasm-opcodes.h"
11 #include "src/zone.h" 11 #include "src/zone.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 namespace compiler { 16 namespace compiler {
17 // Forward declarations for some compiler data structures. 17 // Forward declarations for some compiler data structures.
18 class Node; 18 class Node;
19 class JSGraph; 19 class JSGraph;
20 class Graph; 20 class Graph;
21 class Operator; 21 class Operator;
22 class SourcePositionTable;
22 } 23 }
23 24
24 namespace wasm { 25 namespace wasm {
25 // Forward declarations for some WASM data structures. 26 // Forward declarations for some WASM data structures.
26 struct ModuleEnv; 27 struct ModuleEnv;
27 struct WasmFunction; 28 struct WasmFunction;
28 class ErrorThrower; 29 class ErrorThrower;
29 30
30 // Expose {Node} and {Graph} opaquely as {wasm::TFNode} and {wasm::TFGraph}. 31 // Expose {Node} and {Graph} opaquely as {wasm::TFNode} and {wasm::TFGraph}.
31 typedef compiler::Node TFNode; 32 typedef compiler::Node TFNode;
(...skipping 17 matching lines...) Expand all
49 // from JavaScript. 50 // from JavaScript.
50 Handle<JSFunction> CompileJSToWasmWrapper( 51 Handle<JSFunction> CompileJSToWasmWrapper(
51 Isolate* isolate, wasm::ModuleEnv* module, Handle<String> name, 52 Isolate* isolate, wasm::ModuleEnv* module, Handle<String> name,
52 Handle<Code> wasm_code, Handle<JSObject> module_object, uint32_t index); 53 Handle<Code> wasm_code, Handle<JSObject> module_object, uint32_t index);
53 54
54 // Abstracts details of building TurboFan graph nodes for WASM to separate 55 // Abstracts details of building TurboFan graph nodes for WASM to separate
55 // the WASM decoder from the internal details of TurboFan. 56 // the WASM decoder from the internal details of TurboFan.
56 class WasmTrapHelper; 57 class WasmTrapHelper;
57 class WasmGraphBuilder { 58 class WasmGraphBuilder {
58 public: 59 public:
59 WasmGraphBuilder(Zone* z, JSGraph* g, wasm::FunctionSig* function_signature); 60 WasmGraphBuilder(
61 Zone* z, JSGraph* g, wasm::FunctionSig* function_signature,
62 compiler::SourcePositionTable* source_position_table = nullptr);
60 63
61 Node** Buffer(size_t count) { 64 Node** Buffer(size_t count) {
62 if (count > cur_bufsize_) { 65 if (count > cur_bufsize_) {
63 size_t new_size = count + cur_bufsize_ + 5; 66 size_t new_size = count + cur_bufsize_ + 5;
64 cur_buffer_ = 67 cur_buffer_ =
65 reinterpret_cast<Node**>(zone_->New(new_size * sizeof(Node*))); 68 reinterpret_cast<Node**>(zone_->New(new_size * sizeof(Node*)));
66 cur_bufsize_ = new_size; 69 cur_bufsize_ = new_size;
67 } 70 }
68 return cur_buffer_; 71 return cur_buffer_;
69 } 72 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 void set_module(wasm::ModuleEnv* module) { this->module_ = module; } 136 void set_module(wasm::ModuleEnv* module) { this->module_ = module; }
134 137
135 void set_control_ptr(Node** control) { this->control_ = control; } 138 void set_control_ptr(Node** control) { this->control_ = control; }
136 139
137 void set_effect_ptr(Node** effect) { this->effect_ = effect; } 140 void set_effect_ptr(Node** effect) { this->effect_ = effect; }
138 141
139 wasm::FunctionSig* GetFunctionSignature() { return function_signature_; } 142 wasm::FunctionSig* GetFunctionSignature() { return function_signature_; }
140 143
141 void Int64LoweringForTesting(); 144 void Int64LoweringForTesting();
142 145
146 void SetSourcePosition(Node* node, int position);
147
143 private: 148 private:
144 static const int kDefaultBufferSize = 16; 149 static const int kDefaultBufferSize = 16;
145 friend class WasmTrapHelper; 150 friend class WasmTrapHelper;
146 151
147 Zone* zone_; 152 Zone* zone_;
148 JSGraph* jsgraph_; 153 JSGraph* jsgraph_;
149 wasm::ModuleEnv* module_; 154 wasm::ModuleEnv* module_;
150 Node* mem_buffer_; 155 Node* mem_buffer_;
151 Node* mem_size_; 156 Node* mem_size_;
152 Node* function_table_; 157 Node* function_table_;
153 Node** control_; 158 Node** control_;
154 Node** effect_; 159 Node** effect_;
155 Node** cur_buffer_; 160 Node** cur_buffer_;
156 size_t cur_bufsize_; 161 size_t cur_bufsize_;
157 Node* def_buffer_[kDefaultBufferSize]; 162 Node* def_buffer_[kDefaultBufferSize];
158 163
159 WasmTrapHelper* trap_; 164 WasmTrapHelper* trap_;
160 wasm::FunctionSig* function_signature_; 165 wasm::FunctionSig* function_signature_;
161 SetOncePointer<const Operator> allocate_heap_number_operator_; 166 SetOncePointer<const Operator> allocate_heap_number_operator_;
162 167
168 compiler::SourcePositionTable* source_position_table_ = nullptr;
169
163 // Internal helper methods. 170 // Internal helper methods.
164 JSGraph* jsgraph() { return jsgraph_; } 171 JSGraph* jsgraph() { return jsgraph_; }
165 Graph* graph(); 172 Graph* graph();
166 173
167 Node* String(const char* string); 174 Node* String(const char* string);
168 Node* MemBuffer(uint32_t offset); 175 Node* MemBuffer(uint32_t offset);
169 void BoundsCheckMem(MachineType memtype, Node* index, uint32_t offset); 176 void BoundsCheckMem(MachineType memtype, Node* index, uint32_t offset);
170 177
171 Node* MaskShiftCount32(Node* node); 178 Node* MaskShiftCount32(Node* node);
172 Node* MaskShiftCount64(Node* node); 179 Node* MaskShiftCount64(Node* node);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 Node** buf = Buffer(new_count); 275 Node** buf = Buffer(new_count);
269 if (buf != buffer) memcpy(buf, buffer, old_count * sizeof(Node*)); 276 if (buf != buffer) memcpy(buf, buffer, old_count * sizeof(Node*));
270 return buf; 277 return buf;
271 } 278 }
272 }; 279 };
273 } // namespace compiler 280 } // namespace compiler
274 } // namespace internal 281 } // namespace internal
275 } // namespace v8 282 } // namespace v8
276 283
277 #endif // V8_COMPILER_WASM_COMPILER_H_ 284 #endif // V8_COMPILER_WASM_COMPILER_H_
OLDNEW
« no previous file with comments | « src/compiler/source-position.cc ('k') | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698