OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 #endif | 1811 #endif |
1812 F3 f = FUNCTION_CAST<F3>(code->entry()); | 1812 F3 f = FUNCTION_CAST<F3>(code->entry()); |
1813 for (size_t i = 0; i < 128; ++i) { | 1813 for (size_t i = 0; i < 128; ++i) { |
1814 int32_t r, x = rng->NextInt(), y = rng->NextInt(); | 1814 int32_t r, x = rng->NextInt(), y = rng->NextInt(); |
1815 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0); | 1815 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0); |
1816 CHECK_EQ(static_cast<int32_t>(static_cast<uint16_t>(x)) + y, r); | 1816 CHECK_EQ(static_cast<int32_t>(static_cast<uint16_t>(x)) + y, r); |
1817 USE(dummy); | 1817 USE(dummy); |
1818 } | 1818 } |
1819 } | 1819 } |
1820 | 1820 |
1821 | |
1822 #define TEST_RBIT(expected_, input_) \ | 1821 #define TEST_RBIT(expected_, input_) \ |
1823 t.input = input_; \ | 1822 t.input = input_; \ |
1824 t.result = 0; \ | 1823 t.result = 0; \ |
1825 dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \ | 1824 dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \ |
1826 CHECK_EQ(expected_, t.result); | 1825 CHECK_EQ(static_cast<uint32_t>(expected_), t.result); |
1827 | |
1828 | 1826 |
1829 TEST(rbit) { | 1827 TEST(rbit) { |
1830 CcTest::InitializeVM(); | 1828 CcTest::InitializeVM(); |
1831 Isolate* const isolate = CcTest::i_isolate(); | 1829 Isolate* const isolate = CcTest::i_isolate(); |
1832 HandleScope scope(isolate); | 1830 HandleScope scope(isolate); |
1833 Assembler assm(isolate, nullptr, 0); | 1831 Assembler assm(isolate, nullptr, 0); |
1834 | 1832 |
1835 if (CpuFeatures::IsSupported(ARMv7)) { | 1833 if (CpuFeatures::IsSupported(ARMv7)) { |
1836 CpuFeatureScope scope(&assm, ARMv7); | 1834 CpuFeatureScope scope(&assm, ARMv7); |
1837 | 1835 |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2801 F4 f = FUNCTION_CAST<F4>(code->entry()); | 2799 F4 f = FUNCTION_CAST<F4>(code->entry()); |
2802 | 2800 |
2803 Object* dummy = nullptr; | 2801 Object* dummy = nullptr; |
2804 USE(dummy); | 2802 USE(dummy); |
2805 | 2803 |
2806 #ifndef V8_TARGET_LITTLE_ENDIAN | 2804 #ifndef V8_TARGET_LITTLE_ENDIAN |
2807 #error This test assumes a little-endian layout. | 2805 #error This test assumes a little-endian layout. |
2808 #endif | 2806 #endif |
2809 uint64_t data = UINT64_C(0x84838281807f7e7d); | 2807 uint64_t data = UINT64_C(0x84838281807f7e7d); |
2810 dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 0, 0, 0); | 2808 dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 0, 0, 0); |
2811 CHECK_EQ(0x00007e7d, t.ldrh); | 2809 CHECK_EQ(0x00007e7du, t.ldrh); |
2812 CHECK_EQ(0x00007e7d, t.ldrsh); | 2810 CHECK_EQ(0x00007e7du, t.ldrsh); |
2813 CHECK_EQ(0x807f7e7d, t.ldr); | 2811 CHECK_EQ(0x807f7e7du, t.ldr); |
2814 dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 1, 0, 0); | 2812 dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 1, 0, 0); |
2815 CHECK_EQ(0x00007f7e, t.ldrh); | 2813 CHECK_EQ(0x00007f7eu, t.ldrh); |
2816 CHECK_EQ(0x00007f7e, t.ldrsh); | 2814 CHECK_EQ(0x00007f7eu, t.ldrsh); |
2817 CHECK_EQ(0x81807f7e, t.ldr); | 2815 CHECK_EQ(0x81807f7eu, t.ldr); |
2818 dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 2, 0, 0); | 2816 dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 2, 0, 0); |
2819 CHECK_EQ(0x0000807f, t.ldrh); | 2817 CHECK_EQ(0x0000807fu, t.ldrh); |
2820 CHECK_EQ(0xffff807f, t.ldrsh); | 2818 CHECK_EQ(0xffff807fu, t.ldrsh); |
2821 CHECK_EQ(0x8281807f, t.ldr); | 2819 CHECK_EQ(0x8281807fu, t.ldr); |
2822 dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 3, 0, 0); | 2820 dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 3, 0, 0); |
2823 CHECK_EQ(0x00008180, t.ldrh); | 2821 CHECK_EQ(0x00008180u, t.ldrh); |
2824 CHECK_EQ(0xffff8180, t.ldrsh); | 2822 CHECK_EQ(0xffff8180u, t.ldrsh); |
2825 CHECK_EQ(0x83828180, t.ldr); | 2823 CHECK_EQ(0x83828180u, t.ldr); |
2826 } | 2824 } |
2827 | 2825 |
2828 TEST(unaligned_stores) { | 2826 TEST(unaligned_stores) { |
2829 // All supported ARM targets allow unaligned accesses. | 2827 // All supported ARM targets allow unaligned accesses. |
2830 CcTest::InitializeVM(); | 2828 CcTest::InitializeVM(); |
2831 Isolate* isolate = CcTest::i_isolate(); | 2829 Isolate* isolate = CcTest::i_isolate(); |
2832 HandleScope scope(isolate); | 2830 HandleScope scope(isolate); |
2833 | 2831 |
2834 Assembler assm(isolate, NULL, 0); | 2832 Assembler assm(isolate, NULL, 0); |
2835 __ strh(r3, MemOperand(r0, r2)); | 2833 __ strh(r3, MemOperand(r0, r2)); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2982 HandleScope scope(isolate); | 2980 HandleScope scope(isolate); |
2983 | 2981 |
2984 Assembler assm(isolate, NULL, 0); | 2982 Assembler assm(isolate, NULL, 0); |
2985 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 2983 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
2986 __ BlockConstPoolFor(1019); | 2984 __ BlockConstPoolFor(1019); |
2987 for (int i = 0; i < 1019; ++i) __ nop(); | 2985 for (int i = 0; i < 1019; ++i) __ nop(); |
2988 __ vldr(d0, MemOperand(r0, 0)); | 2986 __ vldr(d0, MemOperand(r0, 0)); |
2989 } | 2987 } |
2990 | 2988 |
2991 #undef __ | 2989 #undef __ |
OLD | NEW |