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

Side by Side Diff: test/mjsunit/wasm/wasm-realms.js

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
(Empty)
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
3 // found in the LICENSE file.
4
5 // Flags: --expose-wasm
6
7
8 load("test/mjsunit/wasm/wasm-constants.js");
9 load("test/mjsunit/wasm/wasm-module-builder.js");
10
11 (function testImportsUseTheInstantiateRealm() {
12 print("testImportsUseTheInstantiateRealm");
13 Realm.create();
14
15 Object.prototype.valueOf = function() { return 1; };
16
17 var builder = new WasmModuleBuilder();
18
19 var sig_index = builder.addType(kSig_i);
20 builder.addImport("func", sig_index);
21 builder.addFunction("main", sig_index)
22 .addBody([
23 kExprCallImport, kArity0, 0 // --
24 ]) // --
25 .exportFunc();
26
27 var func = function() {return {};};
28 var main = builder.instantiate({func: func}).exports.main;
29 assertEquals(1, main());
30 Realm.eval(1, "Object.prototype.valueOf = function() { return 2; };");
31 assertEquals(1, main());
32 assertEquals(1, Realm.eval(1, "x => { return x(); };")(main));
33 Object.prototype.valueOf = function() { return 3; };
34 assertEquals(3, main());
35 assertEquals(3, Realm.eval(1, "x => { return x(); };")(main));
36 })();
OLDNEW
« src/runtime/runtime-compiler.cc ('K') | « test/cctest/wasm/wasm-run-utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698