OLD | NEW |
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 Loading... |
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 U value_a = static_cast<U>(kValues[i]); | 50 volatile U value_a = static_cast<volatile U>(kValues[i]); |
51 U value_b = static_cast<U>(kValues[j]); | 51 volatile U value_b = static_cast<volatile U>(kValues[j]); |
52 double expected = | 52 double expected = |
53 static_cast<double>(value_a) + static_cast<double>(value_b); | 53 static_cast<double>(value_a) + static_cast<double>(value_b); |
54 T.CheckCall(T.Val(expected), T.Val(static_cast<double>(i)), | 54 T.CheckCall(T.Val(expected), T.Val(static_cast<double>(i)), |
55 T.Val(static_cast<double>(j))); | 55 T.Val(static_cast<double>(j))); |
56 } | 56 } |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 | 60 |
61 TEST(TypedArrayLoad) { | 61 TEST(TypedArrayLoad) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 EmbeddedVector<char, 2048> source_buffer; | 109 EmbeddedVector<char, 2048> source_buffer; |
110 SNPrintF(source_buffer, source, array_type, arraysize(kValues), | 110 SNPrintF(source_buffer, source, array_type, arraysize(kValues), |
111 values_buffer.start(), array_type, arraysize(kValues), | 111 values_buffer.start(), array_type, arraysize(kValues), |
112 values_buffer.start(), array_type, array_type); | 112 values_buffer.start(), array_type, array_type); |
113 | 113 |
114 FunctionTester T( | 114 FunctionTester T( |
115 source_buffer.start(), | 115 source_buffer.start(), |
116 CompilationInfo::kContextSpecializing | CompilationInfo::kTypingEnabled); | 116 CompilationInfo::kContextSpecializing | CompilationInfo::kTypingEnabled); |
117 for (size_t i = 0; i < arraysize(kValues); ++i) { | 117 for (size_t i = 0; i < arraysize(kValues); ++i) { |
118 for (size_t j = 0; j < arraysize(kValues); ++j) { | 118 for (size_t j = 0; j < arraysize(kValues); ++j) { |
119 U value_a = static_cast<U>(kValues[i]); | 119 volatile U value_a = static_cast<volatile U>(kValues[i]); |
120 U value_b = static_cast<U>(kValues[j]); | 120 volatile U value_b = static_cast<volatile U>(kValues[j]); |
121 double expected = | 121 double expected = |
122 static_cast<double>(value_a) + static_cast<double>(value_b); | 122 static_cast<double>(value_a) + static_cast<double>(value_b); |
123 T.CheckCall(T.Val(expected), T.Val(static_cast<double>(i)), | 123 T.CheckCall(T.Val(expected), T.Val(static_cast<double>(i)), |
124 T.Val(static_cast<double>(j))); | 124 T.Val(static_cast<double>(j))); |
125 } | 125 } |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 | 129 |
130 TEST(TypedArrayStore) { | 130 TEST(TypedArrayStore) { |
131 FLAG_typed_array_max_size_in_heap = 256; | 131 FLAG_typed_array_max_size_in_heap = 256; |
132 TypedArrayStoreHelper<int8_t>("Int8"); | 132 TypedArrayStoreHelper<int8_t>("Int8"); |
133 TypedArrayStoreHelper<uint8_t>("Uint8"); | 133 TypedArrayStoreHelper<uint8_t>("Uint8"); |
134 TypedArrayStoreHelper<int16_t>("Int16"); | 134 TypedArrayStoreHelper<int16_t>("Int16"); |
135 TypedArrayStoreHelper<uint16_t>("Uint16"); | 135 TypedArrayStoreHelper<uint16_t>("Uint16"); |
136 TypedArrayStoreHelper<int32_t>("Int32"); | 136 TypedArrayStoreHelper<int32_t>("Int32"); |
137 TypedArrayStoreHelper<uint32_t>("Uint32"); | 137 TypedArrayStoreHelper<uint32_t>("Uint32"); |
138 TypedArrayStoreHelper<float>("Float32"); | 138 TypedArrayStoreHelper<float>("Float32"); |
139 TypedArrayStoreHelper<double>("Float64"); | 139 TypedArrayStoreHelper<double>("Float64"); |
140 // TODO(mstarzinger): Add tests for ClampedUint8. | 140 // TODO(mstarzinger): Add tests for ClampedUint8. |
141 } | 141 } |
OLD | NEW |