Fix cctest/test-run-properties/TypedArrayLoad.

Note: The test failure was unrelated to the fact that it run on actual
ARM hardware, but it was failing because the test relied on undefined
and implementation defined behaviour of the C++ compiler.

TBR=mstarzinger@chromium.org
TEST=cctest

Review URL: https://codereview.chromium.org/517943002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23507 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
bmeurer@chromium.org 2014-08-29 05:37:55 +00:00
parent b23abba7e5
commit ffbe019e22
2 changed files with 11 additions and 15 deletions

View File

@ -269,9 +269,6 @@
##############################################################################
['arch == arm', {
# TODO(mstarzinger): This fails on ARM hardware, but not in the simulator.
'test-run-properties/TypedArrayLoad': [SKIP],
# BUG(355): Test crashes on ARM.
'test-log/ProfLazyMode': [SKIP],

View File

@ -11,16 +11,14 @@ using namespace v8::internal::compiler;
template <typename U>
static void TypedArrayLoadHelper(const char* array_type) {
const int64_t values[] = {
static const uint32_t kValues[] = {
0x00000000, 0x00000001, 0x00000023, 0x00000042, 0x12345678, 0x87654321,
0x0000003f, 0x0000007f, 0x00003fff, 0x00007fff, 0x3fffffff, 0x7fffffff,
0x000000ff, 0x00000080, 0x0000ffff, 0x00008000, 0xffffffff, 0x80000000,
};
size_t size = arraysize(values);
0x000000ff, 0x00000080, 0x0000ffff, 0x00008000, 0xffffffff, 0x80000000};
EmbeddedVector<char, 1024> values_buffer;
StringBuilder values_builder(values_buffer.start(), values_buffer.length());
for (unsigned i = 0; i < size; i++) {
values_builder.AddFormatted("a[%d] = 0x%08x;", i, values[i]);
for (size_t i = 0; i < arraysize(kValues); ++i) {
values_builder.AddFormatted("a[%d] = 0x%08x;", i, kValues[i]);
}
// Note that below source creates two different typed arrays with distinct
@ -40,16 +38,17 @@ static void TypedArrayLoadHelper(const char* array_type) {
" return f;"
"})()";
EmbeddedVector<char, 1024> source_buffer;
SNPrintF(source_buffer, source, array_type, size, values_buffer.start(),
array_type, size, values_buffer.start(), array_type, array_type);
SNPrintF(source_buffer, source, array_type, arraysize(kValues),
values_buffer.start(), array_type, arraysize(kValues),
values_buffer.start(), array_type, array_type);
FunctionTester T(
source_buffer.start(),
CompilationInfo::kContextSpecializing | CompilationInfo::kTypingEnabled);
for (unsigned i = 0; i < size; i++) {
for (unsigned j = 0; j < size; j++) {
double value_a = static_cast<U>(values[i]);
double value_b = static_cast<U>(values[j]);
for (size_t i = 0; i < arraysize(kValues); ++i) {
for (size_t j = 0; j < arraysize(kValues); ++j) {
double value_a = static_cast<U>(kValues[i]);
double value_b = static_cast<U>(kValues[j]);
double expected = value_a + value_b;
T.CheckCall(T.Val(expected), T.Val(i), T.Val(j));
}