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

Side by Side Diff: test/cctest/wasm/test-run-wasm-module.cc

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, 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 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 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 7
8 #include "src/wasm/encoder.h" 8 #include "src/wasm/encoder.h"
9 #include "src/wasm/module-decoder.h" 9 #include "src/wasm/module-decoder.h"
10 #include "src/wasm/wasm-js.h" 10 #include "src/wasm/wasm-js.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 v8::MaybeLocal<v8::WasmCompiledModule> deserialized = 239 v8::MaybeLocal<v8::WasmCompiledModule> deserialized =
240 v8::WasmCompiledModule::Deserialize(v8_isolate, data); 240 v8::WasmCompiledModule::Deserialize(v8_isolate, data);
241 v8::Local<v8::WasmCompiledModule> compiled_module; 241 v8::Local<v8::WasmCompiledModule> compiled_module;
242 CHECK(deserialized.ToLocal(&compiled_module)); 242 CHECK(deserialized.ToLocal(&compiled_module));
243 Handle<JSObject> module_object = 243 Handle<JSObject> module_object =
244 Handle<JSObject>::cast(v8::Utils::OpenHandle(*compiled_module)); 244 Handle<JSObject>::cast(v8::Utils::OpenHandle(*compiled_module));
245 Handle<FixedArray> compiled_part = 245 Handle<FixedArray> compiled_part =
246 handle(FixedArray::cast(module_object->GetInternalField(0))); 246 handle(FixedArray::cast(module_object->GetInternalField(0)));
247 Handle<JSObject> instance = 247 Handle<JSObject> instance =
248 WasmModule::Instantiate(isolate, compiled_part, 248 WasmModule::Instantiate(isolate, handle(isolate->context(), isolate),
249 Handle<JSReceiver>::null(), 249 compiled_part, Handle<JSReceiver>::null(),
250 Handle<JSArrayBuffer>::null()) 250 Handle<JSArrayBuffer>::null())
251 .ToHandleChecked(); 251 .ToHandleChecked();
252 Handle<Object> params[1] = {Handle<Object>(Smi::FromInt(41), isolate)}; 252 Handle<Object> params[1] = {Handle<Object>(Smi::FromInt(41), isolate)};
253 int32_t result = testing::CallFunction(isolate, instance, &thrower, 253 int32_t result = testing::CallFunction(isolate, instance, &thrower,
254 kFunctionName, 1, params); 254 kFunctionName, 1, params);
255 CHECK(result == 42); 255 CHECK(result == 42);
256 new_ctx->Exit(); 256 new_ctx->Exit();
257 } 257 }
258 } 258 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698