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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 wasm::FunctionSig* sig, uint32_t index, | 95 wasm::FunctionSig* sig, uint32_t index, |
96 Handle<String> module_name, | 96 Handle<String> module_name, |
97 MaybeHandle<String> import_name, | 97 MaybeHandle<String> import_name, |
98 wasm::ModuleOrigin origin); | 98 wasm::ModuleOrigin origin); |
99 | 99 |
100 // Wraps a given wasm code object, producing a code object. | 100 // Wraps a given wasm code object, producing a code object. |
101 Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, | 101 Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, |
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 // Compiles a stub that redirects a call to a wasm function to the wasm |
| 106 // interpreter. It's ABI compatible with the compiled wasm function. |
| 107 Handle<Code> CompileWasmInterpreterEntry(Isolate* isolate, uint32_t func_index, |
| 108 wasm::FunctionSig* sig, |
| 109 Handle<WasmInstanceObject> instance); |
| 110 |
105 // Abstracts details of building TurboFan graph nodes for WASM to separate | 111 // Abstracts details of building TurboFan graph nodes for WASM to separate |
106 // the WASM decoder from the internal details of TurboFan. | 112 // the WASM decoder from the internal details of TurboFan. |
107 class WasmTrapHelper; | 113 class WasmTrapHelper; |
108 typedef ZoneVector<Node*> NodeVector; | 114 typedef ZoneVector<Node*> NodeVector; |
109 class WasmGraphBuilder { | 115 class WasmGraphBuilder { |
110 public: | 116 public: |
111 WasmGraphBuilder( | 117 WasmGraphBuilder( |
112 wasm::ModuleEnv* module_env, Zone* z, JSGraph* g, wasm::FunctionSig* sig, | 118 wasm::ModuleEnv* module_env, Zone* z, JSGraph* g, wasm::FunctionSig* sig, |
113 compiler::SourcePositionTable* source_position_table = nullptr); | 119 compiler::SourcePositionTable* source_position_table = nullptr); |
114 | 120 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 Node* ReturnVoid(); | 181 Node* ReturnVoid(); |
176 Node* Unreachable(wasm::WasmCodePosition position); | 182 Node* Unreachable(wasm::WasmCodePosition position); |
177 | 183 |
178 Node* CallDirect(uint32_t index, Node** args, Node*** rets, | 184 Node* CallDirect(uint32_t index, Node** args, Node*** rets, |
179 wasm::WasmCodePosition position); | 185 wasm::WasmCodePosition position); |
180 Node* CallIndirect(uint32_t index, Node** args, Node*** rets, | 186 Node* CallIndirect(uint32_t index, Node** args, Node*** rets, |
181 wasm::WasmCodePosition position); | 187 wasm::WasmCodePosition position); |
182 | 188 |
183 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); | 189 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); |
184 void BuildWasmToJSWrapper(Handle<JSReceiver> target, wasm::FunctionSig* sig); | 190 void BuildWasmToJSWrapper(Handle<JSReceiver> target, wasm::FunctionSig* sig); |
| 191 void BuildWasmInterpreterEntry(uint32_t func_index, wasm::FunctionSig* sig, |
| 192 Handle<WasmInstanceObject> instance); |
185 | 193 |
186 Node* ToJS(Node* node, wasm::ValueType type); | 194 Node* ToJS(Node* node, wasm::ValueType type); |
187 Node* FromJS(Node* node, Node* context, wasm::ValueType type); | 195 Node* FromJS(Node* node, Node* context, wasm::ValueType type); |
188 Node* Invert(Node* node); | 196 Node* Invert(Node* node); |
189 void EnsureFunctionTableNodes(); | 197 void EnsureFunctionTableNodes(); |
190 | 198 |
191 //----------------------------------------------------------------------- | 199 //----------------------------------------------------------------------- |
192 // Operations that concern the linear memory. | 200 // Operations that concern the linear memory. |
193 //----------------------------------------------------------------------- | 201 //----------------------------------------------------------------------- |
194 Node* CurrentMemoryPages(); | 202 Node* CurrentMemoryPages(); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 380 } |
373 | 381 |
374 int AddParameterNodes(Node** args, int pos, int param_count, | 382 int AddParameterNodes(Node** args, int pos, int param_count, |
375 wasm::FunctionSig* sig); | 383 wasm::FunctionSig* sig); |
376 }; | 384 }; |
377 } // namespace compiler | 385 } // namespace compiler |
378 } // namespace internal | 386 } // namespace internal |
379 } // namespace v8 | 387 } // namespace v8 |
380 | 388 |
381 #endif // V8_COMPILER_WASM_COMPILER_H_ | 389 #endif // V8_COMPILER_WASM_COMPILER_H_ |
OLD | NEW |