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 <functional> | 5 #include <functional> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "test/cctest/cctest.h" | 8 #include "test/cctest/cctest.h" |
9 #include "test/cctest/compiler/codegen-tester.h" | 9 #include "test/cctest/compiler/codegen-tester.h" |
10 #include "test/cctest/compiler/value-helper.h" | 10 #include "test/cctest/compiler/value-helper.h" |
(...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 } | 2504 } |
2505 | 2505 |
2506 // Test with various large and small offsets. | 2506 // Test with various large and small offsets. |
2507 for (int offset = -1; offset <= 200000; offset *= -5) { | 2507 for (int offset = -1; offset <= 200000; offset *= -5) { |
2508 for (int i = 0; i < kNumElems; i++) { | 2508 for (int i = 0; i < kNumElems; i++) { |
2509 RawMachineAssemblerTester<Type> m; | 2509 RawMachineAssemblerTester<Type> m; |
2510 Node* base = m.PointerConstant(buffer - offset); | 2510 Node* base = m.PointerConstant(buffer - offset); |
2511 Node* index = m.Int32Constant((offset + i) * sizeof(buffer[0])); | 2511 Node* index = m.Int32Constant((offset + i) * sizeof(buffer[0])); |
2512 m.Return(m.Load(rep, base, index)); | 2512 m.Return(m.Load(rep, base, index)); |
2513 | 2513 |
2514 CHECK_EQ(static_cast<Type>(buffer[i]), m.Call()); | 2514 Type expected = buffer[i]; |
| 2515 Type actual = static_cast<CType>(m.Call()); |
| 2516 CHECK_EQ(expected, actual); |
2515 printf("XXX\n"); | 2517 printf("XXX\n"); |
2516 } | 2518 } |
2517 } | 2519 } |
2518 } | 2520 } |
2519 | 2521 |
2520 | 2522 |
2521 TEST(RunLoadImmIndex) { | 2523 TEST(RunLoadImmIndex) { |
2522 RunLoadImmIndex<int8_t, uint8_t>(kMachineWord8); | 2524 RunLoadImmIndex<int8_t, uint8_t>(kMachineWord8); |
2523 RunLoadImmIndex<int16_t, uint16_t>(kMachineWord16); | 2525 RunLoadImmIndex<int16_t, uint16_t>(kMachineWord16); |
2524 RunLoadImmIndex<int32_t, uint32_t>(kMachineWord32); | 2526 RunLoadImmIndex<int32_t, uint32_t>(kMachineWord32); |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3874 m.Return(one); | 3876 m.Return(one); |
3875 m.Call(); | 3877 m.Call(); |
3876 for (int i = 0; i < kInputSize; i++) { | 3878 for (int i = 0; i < kInputSize; i++) { |
3877 CHECK_EQ(outputs[i], i + 2); | 3879 CHECK_EQ(outputs[i], i + 2); |
3878 } | 3880 } |
3879 } | 3881 } |
3880 | 3882 |
3881 #endif // MACHINE_ASSEMBLER_SUPPORTS_CALL_C | 3883 #endif // MACHINE_ASSEMBLER_SUPPORTS_CALL_C |
3882 | 3884 |
3883 #endif | 3885 #endif |
OLD | NEW |