@@ -18,8 +18,20 @@
setCachingEnabled(true);
+// In order to allow following tests work on both big-endian and little-
+// endian architectures we need to define least significant byte (lsb) and
+// least significant word (lsw).
var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return i8[0]|0}; return f');
var f = asmLink(code, this, null, new ArrayBuffer(BUF_MIN));
+var lsb=0;
+var lsw=0
+if (f(0x12345678) == 0x12) {
+ lsb=3;
+ lsw=1;
+}
+
+var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return i8[' + lsb + ']|0}; return f');
+var f = asmLink(code, this, null, new ArrayBuffer(BUF_MIN));
assertEq(f(0),0);
assertEq(f(0x7f),0x7f);
assertEq(f(0xff),-1);
@@ -33,7 +45,7 @@
setJitCompilerOption("signals.enable", 0);
var buf = new ArrayBuffer(BUF_MIN);
- var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + '/* not a clone */ function f(i) {i=i|0; i32[0] = i; return i8[0]|0}; return f');
+ var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + '/* not a clone */ function f(i) {i=i|0; i32[0] = i; return i8[' + lsb + ']|0}; return f');
var f = asmLink(code, this, null, buf);
assertEq(f(0),0);
assertEq(f(0x7f),0x7f);
@@ -52,21 +64,21 @@
setCachingEnabled(false);
-var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return u8[0]|0}; return f');
+var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return u8[' + lsb + ']|0}; return f');
var f = asmLink(code, this, null, new ArrayBuffer(BUF_MIN));
assertEq(f(0),0);
assertEq(f(0x7f),0x7f);
assertEq(f(0xff),0xff);
assertEq(f(0x100),0);
-var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return i16[0]|0}; return f');
+var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return i16[' + lsw + ']|0}; return f');
var f = asmLink(code, this, null, new ArrayBuffer(BUF_MIN));
assertEq(f(0),0);
assertEq(f(0x7fff),0x7fff);
assertEq(f(0xffff),-1);
assertEq(f(0x10000),0);
-var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return u16[0]|0}; return f');
+var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return u16[' + lsw + ']|0}; return f');
var f = asmLink(code, this, null, new ArrayBuffer(BUF_MIN));
assertEq(f(0),0);
assertEq(f(0x7fff),0x7fff);
@@ -87,14 +99,14 @@
assertEq(f(0xffffffff),-1);
assertEq(f(0x100000000),0);
-var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return i8[0]|0}; return f');
+var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return i8[' + lsb + ']|0}; return f');
var f = asmLink(code, this, null, new ArrayBuffer(BUF_MIN));
assertEq(f(0),0);
assertEq(f(0x7f),0x7f);
assertEq(f(0xff),-1);
assertEq(f(0x100),0);
-var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return u8[0]|0}; return f');
+var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return u8[' + lsb + ']|0}; return f');
var f = asmLink(code, this, null, new ArrayBuffer(BUF_MIN));
assertEq(f(0),0);
assertEq(f(0x7f),0x7f);
@@ -222,13 +222,13 @@
uint64_t taken = hits - fallthroughHits;
outBRDA_.printf("BRDA:%d,%d,0,", lineno, branchId);
if (taken)
- outBRDA_.printf("%d\n", taken);
+ outBRDA_.printf("%" PRIu64 "\n", taken);
else
outBRDA_.put("-\n", 2);
outBRDA_.printf("BRDA:%d,%d,1,", lineno, branchId);
if (fallthroughHits)
- outBRDA_.printf("%d\n", fallthroughHits);
+ outBRDA_.printf("%" PRIu64 "\n", fallthroughHits);
else
outBRDA_.put("-\n", 2);
@@ -301,7 +301,7 @@
outBRDA_.printf("BRDA:%d,%d,%d,", lineno, branchId, i);
if (caseHits)
- outBRDA_.printf("%d\n", caseHits);
+ outBRDA_.printf("%" PRIu64 "\n", caseHits);
else
outBRDA_.put("-\n", 2);
@@ -327,7 +327,7 @@
outBRDA_.printf("BRDA:%d,%d,%d,", lineno, branchId, numCases);
if (defaultHits)
- outBRDA_.printf("%d\n", defaultHits);
+ outBRDA_.printf("%" PRIu64 "\n", defaultHits);
else
outBRDA_.put("-\n", 2);
numBranchesFound_++;
@@ -6,7 +6,7 @@
function test() {
let lib;
try {
- lib = ctypes.open(ctypes.libraryName("c"));
+ lib = ctypes.open(ctypes.libraryName("m"));
} catch (e) {
}
if (!lib)
@@ -1,3 +1,10 @@
+// getJitCompilerOptions will always return array with zeros when JIT is
+// disabled. Therefore we quit now.
+if (inJit() == 'Baseline is disabled.') {
+ print("JIT is disabled.");
+ quit();
+}
+
var wait = 100;
var method_A = function() {
@@ -19,5 +19,7 @@
var msg = getLastWarning().message;
assertEq(msg === "asm.js type error: Disabled by debugger" ||
+ msg === "asm.js type error: Disabled by lack of a JIT compiler" ||
+ msg === "asm.js type error: Disabled by javascript.options.asmjs in about:config" ||
msg === "asm.js type error: Disabled by lack of floating point support",
true);