| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 CompilationInfo info_; | 74 CompilationInfo info_; |
| 75 std::unique_ptr<CompilationJob> job_; | 75 std::unique_ptr<CompilationJob> job_; |
| 76 uint32_t index_; | 76 uint32_t index_; |
| 77 wasm::Result<wasm::DecodeStruct*> graph_construction_result_; | 77 wasm::Result<wasm::DecodeStruct*> graph_construction_result_; |
| 78 bool ok_; | 78 bool ok_; |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(WasmCompilationUnit); | 80 DISALLOW_COPY_AND_ASSIGN(WasmCompilationUnit); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 // Wraps a JS function, producing a code object that can be called from WASM. | 83 // Wraps a JS function, producing a code object that can be called from WASM. |
| 84 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, | 84 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target, |
| 85 Handle<JSFunction> function, | |
| 86 wasm::FunctionSig* sig, uint32_t index, | 85 wasm::FunctionSig* sig, uint32_t index, |
| 87 Handle<String> import_module, | 86 Handle<String> import_module, |
| 88 MaybeHandle<String> import_function); | 87 MaybeHandle<String> import_function); |
| 89 | 88 |
| 90 // Wraps a given wasm code object, producing a code object. | 89 // Wraps a given wasm code object, producing a code object. |
| 91 Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::ModuleEnv* module, | 90 Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::ModuleEnv* module, |
| 92 Handle<Code> wasm_code, uint32_t index); | 91 Handle<Code> wasm_code, uint32_t index); |
| 93 | 92 |
| 94 // Abstracts details of building TurboFan graph nodes for WASM to separate | 93 // Abstracts details of building TurboFan graph nodes for WASM to separate |
| 95 // the WASM decoder from the internal details of TurboFan. | 94 // the WASM decoder from the internal details of TurboFan. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 Node* ReturnVoid(); | 148 Node* ReturnVoid(); |
| 150 Node* Unreachable(wasm::WasmCodePosition position); | 149 Node* Unreachable(wasm::WasmCodePosition position); |
| 151 | 150 |
| 152 Node* CallDirect(uint32_t index, Node** args, | 151 Node* CallDirect(uint32_t index, Node** args, |
| 153 wasm::WasmCodePosition position); | 152 wasm::WasmCodePosition position); |
| 154 Node* CallImport(uint32_t index, Node** args, | 153 Node* CallImport(uint32_t index, Node** args, |
| 155 wasm::WasmCodePosition position); | 154 wasm::WasmCodePosition position); |
| 156 Node* CallIndirect(uint32_t index, Node** args, | 155 Node* CallIndirect(uint32_t index, Node** args, |
| 157 wasm::WasmCodePosition position); | 156 wasm::WasmCodePosition position); |
| 158 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); | 157 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); |
| 159 void BuildWasmToJSWrapper(Handle<JSFunction> function, | 158 void BuildWasmToJSWrapper(Handle<JSReceiver> target, wasm::FunctionSig* sig); |
| 160 wasm::FunctionSig* sig); | |
| 161 | 159 |
| 162 Node* ToJS(Node* node, Node* context, wasm::LocalType type); | 160 Node* ToJS(Node* node, wasm::LocalType type); |
| 163 Node* FromJS(Node* node, Node* context, wasm::LocalType type); | 161 Node* FromJS(Node* node, Node* context, wasm::LocalType type); |
| 164 Node* Invert(Node* node); | 162 Node* Invert(Node* node); |
| 165 Node* FunctionTable(uint32_t index); | 163 Node* FunctionTable(uint32_t index); |
| 166 | 164 |
| 167 //----------------------------------------------------------------------- | 165 //----------------------------------------------------------------------- |
| 168 // Operations that concern the linear memory. | 166 // Operations that concern the linear memory. |
| 169 //----------------------------------------------------------------------- | 167 //----------------------------------------------------------------------- |
| 170 Node* MemSize(uint32_t offset); | 168 Node* MemSize(uint32_t offset); |
| 171 Node* GetGlobal(uint32_t index); | 169 Node* GetGlobal(uint32_t index); |
| 172 Node* SetGlobal(uint32_t index, Node* val); | 170 Node* SetGlobal(uint32_t index, Node* val); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 Node** buf = Buffer(new_count); | 333 Node** buf = Buffer(new_count); |
| 336 if (buf != buffer) memcpy(buf, buffer, old_count * sizeof(Node*)); | 334 if (buf != buffer) memcpy(buf, buffer, old_count * sizeof(Node*)); |
| 337 return buf; | 335 return buf; |
| 338 } | 336 } |
| 339 }; | 337 }; |
| 340 } // namespace compiler | 338 } // namespace compiler |
| 341 } // namespace internal | 339 } // namespace internal |
| 342 } // namespace v8 | 340 } // namespace v8 |
| 343 | 341 |
| 344 #endif // V8_COMPILER_WASM_COMPILER_H_ | 342 #endif // V8_COMPILER_WASM_COMPILER_H_ |
| OLD | NEW |