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 // 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/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 wasm::FunctionSig* sig, | 82 wasm::FunctionSig* sig, |
83 wasm::WasmName module_name, | 83 wasm::WasmName module_name, |
84 wasm::WasmName function_name); | 84 wasm::WasmName function_name); |
85 | 85 |
86 // Wraps a given wasm code object, producing a JSFunction that can be called | 86 // Wraps a given wasm code object, producing a JSFunction that can be called |
87 // from JavaScript. | 87 // from JavaScript. |
88 Handle<JSFunction> CompileJSToWasmWrapper( | 88 Handle<JSFunction> CompileJSToWasmWrapper( |
89 Isolate* isolate, wasm::ModuleEnv* module, Handle<String> name, | 89 Isolate* isolate, wasm::ModuleEnv* module, Handle<String> name, |
90 Handle<Code> wasm_code, Handle<JSObject> module_object, uint32_t index); | 90 Handle<Code> wasm_code, Handle<JSObject> module_object, uint32_t index); |
91 | 91 |
| 92 // Compiles a function which captures the parameters and calls into the wasm |
| 93 // interpreter. It's ABI compatible with the real wasm function. |
| 94 Handle<Code> CompileWasmToInterpreter(Isolate* isolate, uint32_t func_index, |
| 95 wasm::FunctionSig* sig, |
| 96 Handle<JSObject> wasm_obj); |
| 97 |
92 // Abstracts details of building TurboFan graph nodes for WASM to separate | 98 // Abstracts details of building TurboFan graph nodes for WASM to separate |
93 // the WASM decoder from the internal details of TurboFan. | 99 // the WASM decoder from the internal details of TurboFan. |
94 class WasmTrapHelper; | 100 class WasmTrapHelper; |
95 class WasmGraphBuilder { | 101 class WasmGraphBuilder { |
96 public: | 102 public: |
97 WasmGraphBuilder( | 103 WasmGraphBuilder( |
98 Zone* z, JSGraph* g, wasm::FunctionSig* function_signature, | 104 Zone* z, JSGraph* g, wasm::FunctionSig* function_signature, |
99 compiler::SourcePositionTable* source_position_table = nullptr); | 105 compiler::SourcePositionTable* source_position_table = nullptr); |
100 | 106 |
101 Node** Buffer(size_t count) { | 107 Node** Buffer(size_t count) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 153 |
148 Node* CallDirect(uint32_t index, Node** args, | 154 Node* CallDirect(uint32_t index, Node** args, |
149 wasm::WasmCodePosition position); | 155 wasm::WasmCodePosition position); |
150 Node* CallImport(uint32_t index, Node** args, | 156 Node* CallImport(uint32_t index, Node** args, |
151 wasm::WasmCodePosition position); | 157 wasm::WasmCodePosition position); |
152 Node* CallIndirect(uint32_t index, Node** args, | 158 Node* CallIndirect(uint32_t index, Node** args, |
153 wasm::WasmCodePosition position); | 159 wasm::WasmCodePosition position); |
154 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); | 160 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); |
155 void BuildWasmToJSWrapper(Handle<JSFunction> function, | 161 void BuildWasmToJSWrapper(Handle<JSFunction> function, |
156 wasm::FunctionSig* sig); | 162 wasm::FunctionSig* sig); |
| 163 void BuildWasmToInterpreter(uint32_t func_index, wasm::FunctionSig* sig, |
| 164 Handle<JSObject> wasm_obj); |
157 | 165 |
158 Node* ToJS(Node* node, Node* context, wasm::LocalType type); | 166 Node* ToJS(Node* node, Node* context, wasm::LocalType type); |
159 Node* FromJS(Node* node, Node* context, wasm::LocalType type); | 167 Node* FromJS(Node* node, Node* context, wasm::LocalType type); |
160 Node* Invert(Node* node); | 168 Node* Invert(Node* node); |
161 Node* FunctionTable(); | 169 Node* FunctionTable(); |
162 | 170 |
163 //----------------------------------------------------------------------- | 171 //----------------------------------------------------------------------- |
164 // Operations that concern the linear memory. | 172 // Operations that concern the linear memory. |
165 //----------------------------------------------------------------------- | 173 //----------------------------------------------------------------------- |
166 Node* MemSize(uint32_t offset); | 174 Node* MemSize(uint32_t offset); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 Node** buf = Buffer(new_count); | 349 Node** buf = Buffer(new_count); |
342 if (buf != buffer) memcpy(buf, buffer, old_count * sizeof(Node*)); | 350 if (buf != buffer) memcpy(buf, buffer, old_count * sizeof(Node*)); |
343 return buf; | 351 return buf; |
344 } | 352 } |
345 }; | 353 }; |
346 } // namespace compiler | 354 } // namespace compiler |
347 } // namespace internal | 355 } // namespace internal |
348 } // namespace v8 | 356 } // namespace v8 |
349 | 357 |
350 #endif // V8_COMPILER_WASM_COMPILER_H_ | 358 #endif // V8_COMPILER_WASM_COMPILER_H_ |
OLD | NEW |