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

Side by Side Diff: test/mjsunit/wasm/function-prototype.js

Issue 2395133002: Revert of [wasm] Refactor import handling for 0xC. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « test/mjsunit/wasm/ffi.js ('k') | test/mjsunit/wasm/globals.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Flags: --expose-wasm 5 // Flags: --expose-wasm
6 6
7 load("test/mjsunit/wasm/wasm-constants.js"); 7 load("test/mjsunit/wasm/wasm-constants.js");
8 load("test/mjsunit/wasm/wasm-module-builder.js"); 8 load("test/mjsunit/wasm/wasm-module-builder.js");
9 9
10 (function TestFunctionPrototype() { 10 (function TestFunctionPrototype() {
11 var builder = new WasmModuleBuilder(); 11 var builder = new WasmModuleBuilder();
12 12
13 builder.addFunction("nine", kSig_i_v) 13 builder.addFunction("nine", kSig_i)
14 .addBody([kExprI8Const, 9]) 14 .addBody([kExprI8Const, 9])
15 .exportFunc(); 15 .exportFunc();
16 16
17 var func = builder.instantiate().exports.nine; 17 var func = builder.instantiate().exports.nine;
18 18
19 // Check type and existence of prototype 19 // Check type and existence of prototype
20 assertEquals("function", typeof func.apply); 20 assertEquals("function", typeof func.apply);
21 assertTrue(func.prototype != undefined); 21 assertTrue(func.prototype != undefined);
22 assertEquals("nine", func.name); 22 assertEquals("nine", func.name);
23 assertEquals(undefined, func.displayName); 23 assertEquals(undefined, func.displayName);
24 24
25 // Check that .apply() works. 25 // Check that .apply() works.
26 assertEquals(9, func.apply([])); 26 assertEquals(9, func.apply([]));
27 assertEquals(9, func.apply([1])); 27 assertEquals(9, func.apply([1]));
28 assertEquals(9, func.apply([2, 3])); 28 assertEquals(9, func.apply([2, 3]));
29 assertEquals(9, func.apply([6, 7, 9, 9])); 29 assertEquals(9, func.apply([6, 7, 9, 9]));
30 30
31 // TODO(titzer): assertEquals(1, func.length); 31 // TODO(titzer): assertEquals(1, func.length);
32 32
33 // Check we don't crash when converting to a string. 33 // Check we don't crash when converting to a string.
34 print(func.toString()); 34 print(func.toString());
35 })(); 35 })();
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/ffi.js ('k') | test/mjsunit/wasm/globals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698