| 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/wasm/wasm-opcodes.h" | 10 #include "src/wasm/wasm-opcodes.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace compiler { | 34 namespace compiler { |
| 35 // Compiles a single function, producing a code object. | 35 // Compiles a single function, producing a code object. |
| 36 Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate, | 36 Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate, |
| 37 wasm::ModuleEnv* module_env, | 37 wasm::ModuleEnv* module_env, |
| 38 const wasm::WasmFunction& function); | 38 const wasm::WasmFunction& function); |
| 39 | 39 |
| 40 // Wraps a JS function, producing a code object that can be called from WASM. | 40 // Wraps a JS function, producing a code object that can be called from WASM. |
| 41 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module, | 41 Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module, |
| 42 Handle<JSFunction> function, | 42 Handle<JSFunction> function, |
| 43 uint32_t index); | 43 wasm::FunctionSig* sig, const char* name); |
| 44 | 44 |
| 45 // Wraps a given wasm code object, producing a JSFunction that can be called | 45 // Wraps a given wasm code object, producing a JSFunction that can be called |
| 46 // from JavaScript. | 46 // from JavaScript. |
| 47 Handle<JSFunction> CompileJSToWasmWrapper( | 47 Handle<JSFunction> CompileJSToWasmWrapper( |
| 48 Isolate* isolate, wasm::ModuleEnv* module, Handle<String> name, | 48 Isolate* isolate, wasm::ModuleEnv* module, Handle<String> name, |
| 49 Handle<Code> wasm_code, Handle<JSObject> module_object, uint32_t index); | 49 Handle<Code> wasm_code, Handle<JSObject> module_object, uint32_t index); |
| 50 | 50 |
| 51 // Abstracts details of building TurboFan graph nodes for WASM to separate | 51 // Abstracts details of building TurboFan graph nodes for WASM to separate |
| 52 // the WASM decoder from the internal details of TurboFan. | 52 // the WASM decoder from the internal details of TurboFan. |
| 53 class WasmTrapHelper; | 53 class WasmTrapHelper; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 //----------------------------------------------------------------------- | 93 //----------------------------------------------------------------------- |
| 94 Node* Branch(Node* cond, Node** true_node, Node** false_node); | 94 Node* Branch(Node* cond, Node** true_node, Node** false_node); |
| 95 Node* Switch(unsigned count, Node* key); | 95 Node* Switch(unsigned count, Node* key); |
| 96 Node* IfValue(int32_t value, Node* sw); | 96 Node* IfValue(int32_t value, Node* sw); |
| 97 Node* IfDefault(Node* sw); | 97 Node* IfDefault(Node* sw); |
| 98 Node* Return(unsigned count, Node** vals); | 98 Node* Return(unsigned count, Node** vals); |
| 99 Node* ReturnVoid(); | 99 Node* ReturnVoid(); |
| 100 Node* Unreachable(); | 100 Node* Unreachable(); |
| 101 | 101 |
| 102 Node* CallDirect(uint32_t index, Node** args); | 102 Node* CallDirect(uint32_t index, Node** args); |
| 103 Node* CallImport(uint32_t index, Node** args); |
| 103 Node* CallIndirect(uint32_t index, Node** args); | 104 Node* CallIndirect(uint32_t index, Node** args); |
| 104 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); | 105 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); |
| 105 void BuildWasmToJSWrapper(Handle<JSFunction> function, | 106 void BuildWasmToJSWrapper(Handle<JSFunction> function, |
| 106 wasm::FunctionSig* sig); | 107 wasm::FunctionSig* sig); |
| 107 Node* ToJS(Node* node, Node* context, wasm::LocalType type); | 108 Node* ToJS(Node* node, Node* context, wasm::LocalType type); |
| 108 Node* FromJS(Node* node, Node* context, wasm::LocalType type); | 109 Node* FromJS(Node* node, Node* context, wasm::LocalType type); |
| 109 Node* Invert(Node* node); | 110 Node* Invert(Node* node); |
| 110 Node* FunctionTable(); | 111 Node* FunctionTable(); |
| 111 | 112 |
| 112 //----------------------------------------------------------------------- | 113 //----------------------------------------------------------------------- |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 Node** buf = Buffer(count); | 195 Node** buf = Buffer(count); |
| 195 if (buf != buffer) memcpy(buf, buffer, count * sizeof(Node*)); | 196 if (buf != buffer) memcpy(buf, buffer, count * sizeof(Node*)); |
| 196 return buf; | 197 return buf; |
| 197 } | 198 } |
| 198 }; | 199 }; |
| 199 } // namespace compiler | 200 } // namespace compiler |
| 200 } // namespace internal | 201 } // namespace internal |
| 201 } // namespace v8 | 202 } // namespace v8 |
| 202 | 203 |
| 203 #endif // V8_COMPILER_WASM_COMPILER_H_ | 204 #endif // V8_COMPILER_WASM_COMPILER_H_ |
| OLD | NEW |