Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: test/cctest/wasm/wasm-run-utils.h

Issue 2262103002: [wasm] Pass the context to ToJS. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@fix-imports-context
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::InstallWasmFunctionMap(isolate_, isolate_->native_context()); 211 WasmJs::InstallWasmFunctionMap(isolate_, isolate_->native_context());
212 Handle<Code> ret_code = 212 Handle<Code> ret_code = compiler::CompileJSToWasmWrapper(
213 compiler::CompileJSToWasmWrapper(isolate_, this, code, index); 213 isolate_, isolate_->native_context(), this, code, index);
214 FunctionSig* funcSig = this->module->functions[index].sig; 214 FunctionSig* funcSig = this->module->functions[index].sig;
215 Handle<ByteArray> exportedSig = isolate_->factory()->NewByteArray( 215 Handle<ByteArray> exportedSig = isolate_->factory()->NewByteArray(
216 static_cast<int>(funcSig->parameter_count() + funcSig->return_count()), 216 static_cast<int>(funcSig->parameter_count() + funcSig->return_count()),
217 TENURED); 217 TENURED);
218 exportedSig->copy_in(0, reinterpret_cast<const byte*>(funcSig->raw_data()), 218 exportedSig->copy_in(0, reinterpret_cast<const byte*>(funcSig->raw_data()),
219 exportedSig->length()); 219 exportedSig->length());
220 Handle<JSFunction> ret = WrapExportCodeAsJSFunction( 220 Handle<JSFunction> ret = WrapExportCodeAsJSFunction(
221 isolate_, ret_code, name, 221 isolate_, ret_code, name,
222 static_cast<int>(this->module->functions[index].sig->parameter_count()), 222 static_cast<int>(this->module->functions[index].sig->parameter_count()),
223 exportedSig, module_object); 223 exportedSig, module_object);
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 // interpreter. 774 // interpreter.
775 #define WASM_EXEC_TEST(name) \ 775 #define WASM_EXEC_TEST(name) \
776 void RunWasm_##name(WasmExecutionMode execution_mode); \ 776 void RunWasm_##name(WasmExecutionMode execution_mode); \
777 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ 777 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \
778 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ 778 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \
779 void RunWasm_##name(WasmExecutionMode execution_mode) 779 void RunWasm_##name(WasmExecutionMode execution_mode)
780 780
781 } // namespace 781 } // namespace
782 782
783 #endif 783 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698