summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/latin1/asm.js
blob: ace4e7f52c41bae97cfd7b3ddf3411c20f0f54a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
load(libdir + "asm.js");

setCachingEnabled(true);
if (!isAsmJSCompilationAvailable() || !isCachingEnabled())
    quit();

// Test Latin1 and TwoByte PropertyName serialization.

// Latin1
var body1 = "'use asm'; function funName() { return 42 } return funName";
var m = new Function(body1);
assertEq(isAsmJSModule(m), true);
assertEq(m()(), 42);
var m = new Function(body1);
assertEq(isAsmJSModuleLoadedFromCache(m), true);
assertEq(m()(), 42);

var f = m();
assertEq(isLatin1(f.name), true);
assertEq(f.name, "funName");

// TwoByte
var body1 = "'use asm'; function funName\u1200() { return 42 } return funName\u1200";
var m = new Function(body1);
assertEq(isAsmJSModule(m), true);
assertEq(m()(), 42);
var m = new Function(body1);
assertEq(isAsmJSModuleLoadedFromCache(m), true);
assertEq(m()(), 42);

var f = m();
assertEq(isLatin1(f.name), false);
assertEq(f.name, "funName\u1200");