OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 WASM_RUN_UTILS_H | 5 #ifndef WASM_RUN_UTILS_H |
6 #define WASM_RUN_UTILS_H | 6 #define WASM_RUN_UTILS_H |
7 | 7 |
8 #include <setjmp.h> | 8 #include <setjmp.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 DCHECK_LT(index, kMaxFunctions); // limited for testing. | 208 DCHECK_LT(index, kMaxFunctions); // limited for testing. |
209 return index; | 209 return index; |
210 } | 210 } |
211 | 211 |
212 uint32_t AddJsFunction(FunctionSig* sig, const char* source) { | 212 uint32_t AddJsFunction(FunctionSig* sig, const char* source) { |
213 Handle<JSFunction> jsfunc = Handle<JSFunction>::cast(v8::Utils::OpenHandle( | 213 Handle<JSFunction> jsfunc = Handle<JSFunction>::cast(v8::Utils::OpenHandle( |
214 *v8::Local<v8::Function>::Cast(CompileRun(source)))); | 214 *v8::Local<v8::Function>::Cast(CompileRun(source)))); |
215 uint32_t index = AddFunction(sig, Handle<Code>::null(), nullptr); | 215 uint32_t index = AddFunction(sig, Handle<Code>::null(), nullptr); |
216 Handle<Code> code = CompileWasmToJSWrapper( | 216 Handle<Code> code = CompileWasmToJSWrapper( |
217 isolate_, jsfunc, sig, index, Handle<String>::null(), | 217 isolate_, jsfunc, sig, index, Handle<String>::null(), |
218 Handle<String>::null(), module->get_origin()); | 218 Handle<String>::null(), module->origin()); |
219 instance->function_code[index] = code; | 219 instance->function_code[index] = code; |
220 return index; | 220 return index; |
221 } | 221 } |
222 | 222 |
223 Handle<JSFunction> WrapCode(uint32_t index) { | 223 Handle<JSFunction> WrapCode(uint32_t index) { |
224 // Wrap the code so it can be called as a JS function. | 224 // Wrap the code so it can be called as a JS function. |
225 Handle<Code> code = instance->function_code[index]; | 225 Handle<Code> code = instance->function_code[index]; |
226 Handle<Code> ret_code = | 226 Handle<Code> ret_code = |
227 compiler::CompileJSToWasmWrapper(isolate_, &module_, code, index); | 227 compiler::CompileJSToWasmWrapper(isolate_, &module_, code, index); |
228 Handle<JSFunction> ret = WasmExportedFunction::New( | 228 Handle<JSFunction> ret = WasmExportedFunction::New( |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 if (trap_handler::UseTrapHandler()) { \ | 837 if (trap_handler::UseTrapHandler()) { \ |
838 return; \ | 838 return; \ |
839 } \ | 839 } \ |
840 RunWasm_##name(kExecuteInterpreted); \ | 840 RunWasm_##name(kExecuteInterpreted); \ |
841 } \ | 841 } \ |
842 void RunWasm_##name(WasmExecutionMode execution_mode) | 842 void RunWasm_##name(WasmExecutionMode execution_mode) |
843 | 843 |
844 } // namespace | 844 } // namespace |
845 | 845 |
846 #endif | 846 #endif |
OLD | NEW |