Commit ffbe019e authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

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
parent b23abba7
...@@ -269,9 +269,6 @@ ...@@ -269,9 +269,6 @@
############################################################################## ##############################################################################
['arch == arm', { ['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. # BUG(355): Test crashes on ARM.
'test-log/ProfLazyMode': [SKIP], 'test-log/ProfLazyMode': [SKIP],
......
...@@ -11,16 +11,14 @@ using namespace v8::internal::compiler; ...@@ -11,16 +11,14 @@ using namespace v8::internal::compiler;
template <typename U> template <typename U>
static void TypedArrayLoadHelper(const char* array_type) { static void TypedArrayLoadHelper(const char* array_type) {
const int64_t values[] = { static const uint32_t kValues[] = {
0x00000000, 0x00000001, 0x00000023, 0x00000042, 0x12345678, 0x87654321, 0x00000000, 0x00000001, 0x00000023, 0x00000042, 0x12345678, 0x87654321,
0x0000003f, 0x0000007f, 0x00003fff, 0x00007fff, 0x3fffffff, 0x7fffffff, 0x0000003f, 0x0000007f, 0x00003fff, 0x00007fff, 0x3fffffff, 0x7fffffff,
0x000000ff, 0x00000080, 0x0000ffff, 0x00008000, 0xffffffff, 0x80000000, 0x000000ff, 0x00000080, 0x0000ffff, 0x00008000, 0xffffffff, 0x80000000};
};
size_t size = arraysize(values);
EmbeddedVector<char, 1024> values_buffer; EmbeddedVector<char, 1024> values_buffer;
StringBuilder values_builder(values_buffer.start(), values_buffer.length()); StringBuilder values_builder(values_buffer.start(), values_buffer.length());
for (unsigned i = 0; i < size; i++) { for (size_t i = 0; i < arraysize(kValues); ++i) {
values_builder.AddFormatted("a[%d] = 0x%08x;", i, values[i]); values_builder.AddFormatted("a[%d] = 0x%08x;", i, kValues[i]);
} }
// Note that below source creates two different typed arrays with distinct // Note that below source creates two different typed arrays with distinct
...@@ -40,16 +38,17 @@ static void TypedArrayLoadHelper(const char* array_type) { ...@@ -40,16 +38,17 @@ static void TypedArrayLoadHelper(const char* array_type) {
" return f;" " return f;"
"})()"; "})()";
EmbeddedVector<char, 1024> source_buffer; EmbeddedVector<char, 1024> source_buffer;
SNPrintF(source_buffer, source, array_type, size, values_buffer.start(), SNPrintF(source_buffer, source, array_type, arraysize(kValues),
array_type, size, values_buffer.start(), array_type, array_type); values_buffer.start(), array_type, arraysize(kValues),
values_buffer.start(), array_type, array_type);
FunctionTester T( FunctionTester T(
source_buffer.start(), source_buffer.start(),
CompilationInfo::kContextSpecializing | CompilationInfo::kTypingEnabled); CompilationInfo::kContextSpecializing | CompilationInfo::kTypingEnabled);
for (unsigned i = 0; i < size; i++) { for (size_t i = 0; i < arraysize(kValues); ++i) {
for (unsigned j = 0; j < size; j++) { for (size_t j = 0; j < arraysize(kValues); ++j) {
double value_a = static_cast<U>(values[i]); double value_a = static_cast<U>(kValues[i]);
double value_b = static_cast<U>(values[j]); double value_b = static_cast<U>(kValues[j]);
double expected = value_a + value_b; double expected = value_a + value_b;
T.CheckCall(T.Val(expected), T.Val(i), T.Val(j)); T.CheckCall(T.Val(expected), T.Val(i), T.Val(j));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment