| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 Handle<String>::null(), Handle<String>::null()); | 201 Handle<String>::null(), Handle<String>::null()); |
| 202 instance->function_code[index] = code; | 202 instance->function_code[index] = code; |
| 203 return index; | 203 return index; |
| 204 } | 204 } |
| 205 | 205 |
| 206 Handle<JSFunction> WrapCode(uint32_t index) { | 206 Handle<JSFunction> WrapCode(uint32_t index) { |
| 207 // Wrap the code so it can be called as a JS function. | 207 // Wrap the code so it can be called as a JS function. |
| 208 Handle<String> name = isolate_->factory()->NewStringFromStaticChars("main"); | 208 Handle<String> name = isolate_->factory()->NewStringFromStaticChars("main"); |
| 209 Handle<JSObject> module_object = Handle<JSObject>(0, isolate_); | 209 Handle<JSObject> module_object = Handle<JSObject>(0, isolate_); |
| 210 Handle<Code> code = instance->function_code[index]; | 210 Handle<Code> code = instance->function_code[index]; |
| 211 WasmJs::InstallWasmFunctionMapIfNeeded(isolate_, | 211 WasmJs::InstallWasmMapsIfNeeded(isolate_, isolate_->native_context()); |
| 212 isolate_->native_context()); | |
| 213 Handle<Code> ret_code = | 212 Handle<Code> ret_code = |
| 214 compiler::CompileJSToWasmWrapper(isolate_, this, code, index); | 213 compiler::CompileJSToWasmWrapper(isolate_, this, code, index); |
| 215 FunctionSig* funcSig = this->module->functions[index].sig; | 214 FunctionSig* funcSig = this->module->functions[index].sig; |
| 216 Handle<ByteArray> exportedSig = isolate_->factory()->NewByteArray( | 215 Handle<ByteArray> exportedSig = isolate_->factory()->NewByteArray( |
| 217 static_cast<int>(funcSig->parameter_count() + funcSig->return_count()), | 216 static_cast<int>(funcSig->parameter_count() + funcSig->return_count()), |
| 218 TENURED); | 217 TENURED); |
| 219 exportedSig->copy_in(0, reinterpret_cast<const byte*>(funcSig->raw_data()), | 218 exportedSig->copy_in(0, reinterpret_cast<const byte*>(funcSig->raw_data()), |
| 220 exportedSig->length()); | 219 exportedSig->length()); |
| 221 Handle<JSFunction> ret = WrapExportCodeAsJSFunction( | 220 Handle<JSFunction> ret = WrapExportCodeAsJSFunction( |
| 222 isolate_, ret_code, name, | 221 isolate_, ret_code, name, |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 // interpreter. | 775 // interpreter. |
| 777 #define WASM_EXEC_TEST(name) \ | 776 #define WASM_EXEC_TEST(name) \ |
| 778 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 777 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
| 779 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 778 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
| 780 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 779 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
| 781 void RunWasm_##name(WasmExecutionMode execution_mode) | 780 void RunWasm_##name(WasmExecutionMode execution_mode) |
| 782 | 781 |
| 783 } // namespace | 782 } // namespace |
| 784 | 783 |
| 785 #endif | 784 #endif |
| OLD | NEW |