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

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

Issue 2263953002: [wasm] Use the right context in the wasm-to-js wrapper. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup the test. Created 4 years, 4 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 CHECK_EQ(index, static_cast<uint32_t>(interpreter_index)); 189 CHECK_EQ(index, static_cast<uint32_t>(interpreter_index));
190 } 190 }
191 DCHECK_LT(index, kMaxFunctions); // limited for testing. 191 DCHECK_LT(index, kMaxFunctions); // limited for testing.
192 return index; 192 return index;
193 } 193 }
194 194
195 uint32_t AddJsFunction(FunctionSig* sig, const char* source) { 195 uint32_t AddJsFunction(FunctionSig* sig, const char* source) {
196 Handle<JSFunction> jsfunc = Handle<JSFunction>::cast(v8::Utils::OpenHandle( 196 Handle<JSFunction> jsfunc = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
197 *v8::Local<v8::Function>::Cast(CompileRun(source)))); 197 *v8::Local<v8::Function>::Cast(CompileRun(source))));
198 uint32_t index = AddFunction(sig, Handle<Code>::null()); 198 uint32_t index = AddFunction(sig, Handle<Code>::null());
199 Handle<Code> code = 199 Handle<Code> code = CompileWasmToJSWrapper(
200 CompileWasmToJSWrapper(isolate_, jsfunc, sig, index, 200 isolate_, handle(isolate_->context(), isolate_), jsfunc, sig, index,
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::InstallWasmFunctionMap(isolate_, isolate_->native_context()); 211 WasmJs::InstallWasmFunctionMap(isolate_, isolate_->native_context());
(...skipping 562 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