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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // Operations that read and/or write {control} and {effect}. | 146 // Operations that read and/or write {control} and {effect}. |
147 //----------------------------------------------------------------------- | 147 //----------------------------------------------------------------------- |
148 Node* Branch(Node* cond, Node** true_node, Node** false_node); | 148 Node* Branch(Node* cond, Node** true_node, Node** false_node); |
149 Node* Switch(unsigned count, Node* key); | 149 Node* Switch(unsigned count, Node* key); |
150 Node* IfValue(int32_t value, Node* sw); | 150 Node* IfValue(int32_t value, Node* sw); |
151 Node* IfDefault(Node* sw); | 151 Node* IfDefault(Node* sw); |
152 Node* Return(unsigned count, Node** vals); | 152 Node* Return(unsigned count, Node** vals); |
153 Node* ReturnVoid(); | 153 Node* ReturnVoid(); |
154 Node* Unreachable(wasm::WasmCodePosition position); | 154 Node* Unreachable(wasm::WasmCodePosition position); |
155 | 155 |
156 Node** CallDirect(uint32_t index, Node** args, | 156 Node* CallDirect(uint32_t index, Node** args, |
157 wasm::WasmCodePosition position); | 157 wasm::WasmCodePosition position); |
158 Node** CallIndirect(uint32_t index, Node** args, | 158 Node* CallImport(uint32_t index, Node** args, |
159 wasm::WasmCodePosition position); | 159 wasm::WasmCodePosition position); |
160 | 160 Node* CallIndirect(uint32_t index, Node** args, |
| 161 wasm::WasmCodePosition position); |
161 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); | 162 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); |
162 void BuildWasmToJSWrapper(Handle<JSReceiver> target, wasm::FunctionSig* sig); | 163 void BuildWasmToJSWrapper(Handle<JSReceiver> target, wasm::FunctionSig* sig); |
163 | 164 |
164 Node* ToJS(Node* node, wasm::LocalType type); | 165 Node* ToJS(Node* node, wasm::LocalType type); |
165 Node* FromJS(Node* node, Node* context, wasm::LocalType type); | 166 Node* FromJS(Node* node, Node* context, wasm::LocalType type); |
166 Node* Invert(Node* node); | 167 Node* Invert(Node* node); |
167 Node* FunctionTable(uint32_t index); | 168 Node* FunctionTable(uint32_t index); |
168 | 169 |
169 //----------------------------------------------------------------------- | 170 //----------------------------------------------------------------------- |
170 // Operations that concern the linear memory. | 171 // Operations that concern the linear memory. |
171 //----------------------------------------------------------------------- | 172 //----------------------------------------------------------------------- |
172 Node* CurrentMemoryPages(); | 173 Node* MemSize(uint32_t offset); |
173 Node* GetGlobal(uint32_t index); | 174 Node* GetGlobal(uint32_t index); |
174 Node* SetGlobal(uint32_t index, Node* val); | 175 Node* SetGlobal(uint32_t index, Node* val); |
175 Node* LoadMem(wasm::LocalType type, MachineType memtype, Node* index, | 176 Node* LoadMem(wasm::LocalType type, MachineType memtype, Node* index, |
176 uint32_t offset, uint32_t alignment, | 177 uint32_t offset, uint32_t alignment, |
177 wasm::WasmCodePosition position); | 178 wasm::WasmCodePosition position); |
178 Node* StoreMem(MachineType type, Node* index, uint32_t offset, | 179 Node* StoreMem(MachineType type, Node* index, uint32_t offset, |
179 uint32_t alignment, Node* val, | 180 uint32_t alignment, Node* val, |
180 wasm::WasmCodePosition position); | 181 wasm::WasmCodePosition position); |
181 | 182 |
182 static void PrintDebugName(Node* node); | 183 static void PrintDebugName(Node* node); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 wasm::FunctionSig* function_signature_; | 222 wasm::FunctionSig* function_signature_; |
222 SetOncePointer<const Operator> allocate_heap_number_operator_; | 223 SetOncePointer<const Operator> allocate_heap_number_operator_; |
223 | 224 |
224 compiler::SourcePositionTable* source_position_table_ = nullptr; | 225 compiler::SourcePositionTable* source_position_table_ = nullptr; |
225 | 226 |
226 // Internal helper methods. | 227 // Internal helper methods. |
227 JSGraph* jsgraph() { return jsgraph_; } | 228 JSGraph* jsgraph() { return jsgraph_; } |
228 Graph* graph(); | 229 Graph* graph(); |
229 | 230 |
230 Node* String(const char* string); | 231 Node* String(const char* string); |
231 Node* MemSize(uint32_t offset); | |
232 Node* MemBuffer(uint32_t offset); | 232 Node* MemBuffer(uint32_t offset); |
233 void BoundsCheckMem(MachineType memtype, Node* index, uint32_t offset, | 233 void BoundsCheckMem(MachineType memtype, Node* index, uint32_t offset, |
234 wasm::WasmCodePosition position); | 234 wasm::WasmCodePosition position); |
235 | 235 |
236 Node* BuildChangeEndianness(Node* node, MachineType type, | 236 Node* BuildChangeEndianness(Node* node, MachineType type, |
237 wasm::LocalType wasmtype = wasm::kAstStmt); | 237 wasm::LocalType wasmtype = wasm::kAstStmt); |
238 | 238 |
239 Node* MaskShiftCount32(Node* node); | 239 Node* MaskShiftCount32(Node* node); |
240 Node* MaskShiftCount64(Node* node); | 240 Node* MaskShiftCount64(Node* node); |
241 | 241 |
242 Node* BuildCCall(MachineSignature* sig, Node** args); | 242 Node* BuildCCall(MachineSignature* sig, Node** args); |
243 Node** BuildWasmCall(wasm::FunctionSig* sig, Node** args, | 243 Node* BuildWasmCall(wasm::FunctionSig* sig, Node** args, |
244 wasm::WasmCodePosition position); | 244 wasm::WasmCodePosition position); |
245 | 245 |
246 Node* BuildF32CopySign(Node* left, Node* right); | 246 Node* BuildF32CopySign(Node* left, Node* right); |
247 Node* BuildF64CopySign(Node* left, Node* right); | 247 Node* BuildF64CopySign(Node* left, Node* right); |
248 Node* BuildI32SConvertF32(Node* input, wasm::WasmCodePosition position); | 248 Node* BuildI32SConvertF32(Node* input, wasm::WasmCodePosition position); |
249 Node* BuildI32SConvertF64(Node* input, wasm::WasmCodePosition position); | 249 Node* BuildI32SConvertF64(Node* input, wasm::WasmCodePosition position); |
250 Node* BuildI32UConvertF32(Node* input, wasm::WasmCodePosition position); | 250 Node* BuildI32UConvertF32(Node* input, wasm::WasmCodePosition position); |
251 Node* BuildI32UConvertF64(Node* input, wasm::WasmCodePosition position); | 251 Node* BuildI32UConvertF64(Node* input, wasm::WasmCodePosition position); |
252 Node* BuildI32Ctz(Node* input); | 252 Node* BuildI32Ctz(Node* input); |
253 Node* BuildI32Popcnt(Node* input); | 253 Node* BuildI32Popcnt(Node* input); |
254 Node* BuildI64Ctz(Node* input); | 254 Node* BuildI64Ctz(Node* input); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 } | 342 } |
343 | 343 |
344 int AddParameterNodes(Node** args, int pos, int param_count, | 344 int AddParameterNodes(Node** args, int pos, int param_count, |
345 wasm::FunctionSig* sig); | 345 wasm::FunctionSig* sig); |
346 }; | 346 }; |
347 } // namespace compiler | 347 } // namespace compiler |
348 } // namespace internal | 348 } // namespace internal |
349 } // namespace v8 | 349 } // namespace v8 |
350 | 350 |
351 #endif // V8_COMPILER_WASM_COMPILER_H_ | 351 #endif // V8_COMPILER_WASM_COMPILER_H_ |
OLD | NEW |