Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: test/cctest/compiler/test-run-properties.cc

Issue 576973003: Hack representation inference to assume current behavior of float32 loads and stores, which include… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "test/cctest/compiler/function-tester.h" 7 #include "test/cctest/compiler/function-tester.h"
8 8
9 using namespace v8::internal; 9 using namespace v8::internal;
10 using namespace v8::internal::compiler; 10 using namespace v8::internal::compiler;
(...skipping 29 matching lines...) Expand all
40 EmbeddedVector<char, 1024> source_buffer; 40 EmbeddedVector<char, 1024> source_buffer;
41 SNPrintF(source_buffer, source, array_type, arraysize(kValues), 41 SNPrintF(source_buffer, source, array_type, arraysize(kValues),
42 values_buffer.start(), array_type, arraysize(kValues), 42 values_buffer.start(), array_type, arraysize(kValues),
43 values_buffer.start(), array_type, array_type); 43 values_buffer.start(), array_type, array_type);
44 44
45 FunctionTester T( 45 FunctionTester T(
46 source_buffer.start(), 46 source_buffer.start(),
47 CompilationInfo::kContextSpecializing | CompilationInfo::kTypingEnabled); 47 CompilationInfo::kContextSpecializing | CompilationInfo::kTypingEnabled);
48 for (size_t i = 0; i < arraysize(kValues); ++i) { 48 for (size_t i = 0; i < arraysize(kValues); ++i) {
49 for (size_t j = 0; j < arraysize(kValues); ++j) { 49 for (size_t j = 0; j < arraysize(kValues); ++j) {
50 double value_a = static_cast<U>(kValues[i]); 50 volatile U value_a = static_cast<U>(kValues[i]);
Michael Starzinger 2014/09/18 18:38:07 Man, do I love C++ intuitiveness. :)
51 double value_b = static_cast<U>(kValues[j]); 51 volatile U value_b = static_cast<U>(kValues[j]);
52 double expected = value_a + value_b; 52 double expected =
53 static_cast<double>(value_a) + static_cast<double>(value_b);
Sven Panne 2014/09/19 06:07:26 Casting away volatile leads to undefined behavior:
53 T.CheckCall(T.Val(expected), T.Val(static_cast<double>(i)), 54 T.CheckCall(T.Val(expected), T.Val(static_cast<double>(i)),
54 T.Val(static_cast<double>(j))); 55 T.Val(static_cast<double>(j)));
55 } 56 }
56 } 57 }
57 } 58 }
58 59
59 60
60 TEST(TypedArrayLoad) { 61 TEST(TypedArrayLoad) {
61 FLAG_typed_array_max_size_in_heap = 256; 62 FLAG_typed_array_max_size_in_heap = 256;
62 TypedArrayLoadHelper<int8_t>("Int8"); 63 TypedArrayLoadHelper<int8_t>("Int8");
63 TypedArrayLoadHelper<uint8_t>("Uint8"); 64 TypedArrayLoadHelper<uint8_t>("Uint8");
64 TypedArrayLoadHelper<int16_t>("Int16"); 65 TypedArrayLoadHelper<int16_t>("Int16");
65 TypedArrayLoadHelper<uint16_t>("Uint16"); 66 TypedArrayLoadHelper<uint16_t>("Uint16");
66 TypedArrayLoadHelper<int32_t>("Int32"); 67 TypedArrayLoadHelper<int32_t>("Int32");
67 TypedArrayLoadHelper<uint32_t>("Uint32"); 68 TypedArrayLoadHelper<uint32_t>("Uint32");
69 TypedArrayLoadHelper<float>("Float32");
68 TypedArrayLoadHelper<double>("Float64"); 70 TypedArrayLoadHelper<double>("Float64");
69 // TODO(mstarzinger): Add tests for Float32.
70 // TODO(mstarzinger): Add tests for ClampedUint8. 71 // TODO(mstarzinger): Add tests for ClampedUint8.
71 } 72 }
72 73
73 74
74 template <typename U> 75 template <typename U>
75 static void TypedArrayStoreHelper(const char* array_type) { 76 static void TypedArrayStoreHelper(const char* array_type) {
76 static const uint32_t kValues[] = { 77 static const uint32_t kValues[] = {
77 0x00000000, 0x00000001, 0x00000023, 0x00000042, 0x12345678, 0x87654321, 78 0x00000000, 0x00000001, 0x00000023, 0x00000042, 0x12345678, 0x87654321,
78 0x0000003f, 0x0000007f, 0x00003fff, 0x00007fff, 0x3fffffff, 0x7fffffff, 79 0x0000003f, 0x0000007f, 0x00003fff, 0x00007fff, 0x3fffffff, 0x7fffffff,
79 0x000000ff, 0x00000080, 0x0000ffff, 0x00008000, 0xffffffff, 0x80000000}; 80 0x000000ff, 0x00000080, 0x0000ffff, 0x00008000, 0xffffffff, 0x80000000};
(...skipping 28 matching lines...) Expand all
108 EmbeddedVector<char, 2048> source_buffer; 109 EmbeddedVector<char, 2048> source_buffer;
109 SNPrintF(source_buffer, source, array_type, arraysize(kValues), 110 SNPrintF(source_buffer, source, array_type, arraysize(kValues),
110 values_buffer.start(), array_type, arraysize(kValues), 111 values_buffer.start(), array_type, arraysize(kValues),
111 values_buffer.start(), array_type, array_type); 112 values_buffer.start(), array_type, array_type);
112 113
113 FunctionTester T( 114 FunctionTester T(
114 source_buffer.start(), 115 source_buffer.start(),
115 CompilationInfo::kContextSpecializing | CompilationInfo::kTypingEnabled); 116 CompilationInfo::kContextSpecializing | CompilationInfo::kTypingEnabled);
116 for (size_t i = 0; i < arraysize(kValues); ++i) { 117 for (size_t i = 0; i < arraysize(kValues); ++i) {
117 for (size_t j = 0; j < arraysize(kValues); ++j) { 118 for (size_t j = 0; j < arraysize(kValues); ++j) {
118 double value_a = static_cast<U>(kValues[i]); 119 volatile U value_a = static_cast<U>(kValues[i]);
119 double value_b = static_cast<U>(kValues[j]); 120 volatile U value_b = static_cast<U>(kValues[j]);
120 double expected = value_b + value_a; 121 double expected =
122 static_cast<double>(value_a) + static_cast<double>(value_b);
121 T.CheckCall(T.Val(expected), T.Val(static_cast<double>(i)), 123 T.CheckCall(T.Val(expected), T.Val(static_cast<double>(i)),
122 T.Val(static_cast<double>(j))); 124 T.Val(static_cast<double>(j)));
123 } 125 }
124 } 126 }
125 } 127 }
126 128
127 129
128 TEST(TypedArrayStore) { 130 TEST(TypedArrayStore) {
129 FLAG_typed_array_max_size_in_heap = 256; 131 FLAG_typed_array_max_size_in_heap = 256;
130 TypedArrayStoreHelper<int8_t>("Int8"); 132 TypedArrayStoreHelper<int8_t>("Int8");
131 TypedArrayStoreHelper<uint8_t>("Uint8"); 133 TypedArrayStoreHelper<uint8_t>("Uint8");
132 TypedArrayStoreHelper<int16_t>("Int16"); 134 TypedArrayStoreHelper<int16_t>("Int16");
133 TypedArrayStoreHelper<uint16_t>("Uint16"); 135 TypedArrayStoreHelper<uint16_t>("Uint16");
134 TypedArrayStoreHelper<int32_t>("Int32"); 136 TypedArrayStoreHelper<int32_t>("Int32");
135 TypedArrayStoreHelper<uint32_t>("Uint32"); 137 TypedArrayStoreHelper<uint32_t>("Uint32");
138 TypedArrayStoreHelper<float>("Float32");
136 TypedArrayStoreHelper<double>("Float64"); 139 TypedArrayStoreHelper<double>("Float64");
137 // TODO(mstarzinger): Add tests for Float32.
138 // TODO(mstarzinger): Add tests for ClampedUint8. 140 // TODO(mstarzinger): Add tests for ClampedUint8.
139 } 141 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-representation-change.cc ('k') | test/cctest/compiler/test-simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698