[turbofan] Fix regress-694088.js for big endian.
Test regress-694088.js is adapted for execution on big endian platforms. TEST=test/mjsunit/compiler/regress-694088.js BUG= Review-Url: https://codereview.chromium.org/2739403002 Cr-Commit-Position: refs/heads/master@{#43746}
This commit is contained in:
parent
6e0496b256
commit
d9bcc067ca
@ -2,6 +2,17 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
function is_little_endian() {
|
||||||
|
var buffer = new ArrayBuffer(4);
|
||||||
|
HEAP32 = new Int32Array(buffer);
|
||||||
|
HEAPU8 = new Uint8Array(buffer);
|
||||||
|
HEAP32[0] = 255;
|
||||||
|
if (HEAPU8[0] === 255 && HEAPU8[3] === 0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
var buffer = new ArrayBuffer(8);
|
var buffer = new ArrayBuffer(8);
|
||||||
var i32 = new Int32Array(buffer);
|
var i32 = new Int32Array(buffer);
|
||||||
@ -10,7 +21,10 @@
|
|||||||
function foo() {
|
function foo() {
|
||||||
f64[0] = 1;
|
f64[0] = 1;
|
||||||
var x = f64[0];
|
var x = f64[0];
|
||||||
|
if (is_little_endian())
|
||||||
return i32[0];
|
return i32[0];
|
||||||
|
else
|
||||||
|
return i32[1];
|
||||||
}
|
}
|
||||||
assertEquals(0, foo());
|
assertEquals(0, foo());
|
||||||
})();
|
})();
|
||||||
@ -21,9 +35,12 @@
|
|||||||
var i32 = new Int32Array(buffer);
|
var i32 = new Int32Array(buffer);
|
||||||
|
|
||||||
function foo() {
|
function foo() {
|
||||||
i32[0] = 0x10001;
|
i32[0] = 0x20001;
|
||||||
var x = i32[0];
|
var x = i32[0];
|
||||||
|
if (is_little_endian())
|
||||||
return i16[0];
|
return i16[0];
|
||||||
|
else
|
||||||
|
return i16[1];
|
||||||
}
|
}
|
||||||
assertEquals(1, foo());
|
assertEquals(1, foo());
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user