OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 <functional> | 5 #include <functional> |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 Type* subtype2 = RandomSubtype(type2); | 216 Type* subtype2 = RandomSubtype(type2); |
217 Type* subtype = TypeBinaryOp(op, subtype1, subtype2); | 217 Type* subtype = TypeBinaryOp(op, subtype1, subtype2); |
218 EXPECT_TRUE(subtype->Is(type)); | 218 EXPECT_TRUE(subtype->Is(type)); |
219 } | 219 } |
220 } | 220 } |
221 }; | 221 }; |
222 | 222 |
223 | 223 |
224 namespace { | 224 namespace { |
225 | 225 |
226 int32_t shift_left(int32_t x, int32_t y) { return x << y; } | 226 int32_t shift_left(int32_t x, int32_t y) { return x << (y & 0x1f); } |
227 int32_t shift_right(int32_t x, int32_t y) { return x >> y; } | 227 int32_t shift_right(int32_t x, int32_t y) { return x >> (y & 0x1f); } |
228 int32_t bit_or(int32_t x, int32_t y) { return x | y; } | 228 int32_t bit_or(int32_t x, int32_t y) { return x | y; } |
229 int32_t bit_and(int32_t x, int32_t y) { return x & y; } | 229 int32_t bit_and(int32_t x, int32_t y) { return x & y; } |
230 int32_t bit_xor(int32_t x, int32_t y) { return x ^ y; } | 230 int32_t bit_xor(int32_t x, int32_t y) { return x ^ y; } |
231 | 231 |
232 } // namespace | 232 } // namespace |
233 | 233 |
234 | 234 |
235 //------------------------------------------------------------------------------ | 235 //------------------------------------------------------------------------------ |
236 // Soundness | 236 // Soundness |
237 // For simplicity, we currently only test soundness on expression operators | 237 // For simplicity, we currently only test soundness on expression operators |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 TEST_BINARY_MONOTONICITY(Add) | 369 TEST_BINARY_MONOTONICITY(Add) |
370 TEST_BINARY_MONOTONICITY(Subtract) | 370 TEST_BINARY_MONOTONICITY(Subtract) |
371 TEST_BINARY_MONOTONICITY(Multiply) | 371 TEST_BINARY_MONOTONICITY(Multiply) |
372 TEST_BINARY_MONOTONICITY(Divide) | 372 TEST_BINARY_MONOTONICITY(Divide) |
373 TEST_BINARY_MONOTONICITY(Modulus) | 373 TEST_BINARY_MONOTONICITY(Modulus) |
374 #undef TEST_BINARY_MONOTONICITY | 374 #undef TEST_BINARY_MONOTONICITY |
375 | 375 |
376 } // namespace compiler | 376 } // namespace compiler |
377 } // namespace internal | 377 } // namespace internal |
378 } // namespace v8 | 378 } // namespace v8 |
OLD | NEW |