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 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2374 CHECK_VSEL(1, 0, 1, 1, kResultFail, kResultPass, kResultPass, kResultPass); | 2374 CHECK_VSEL(1, 0, 1, 1, kResultFail, kResultPass, kResultPass, kResultPass); |
2375 CHECK_VSEL(1, 1, 0, 0, kResultPass, kResultFail, kResultFail, kResultFail); | 2375 CHECK_VSEL(1, 1, 0, 0, kResultPass, kResultFail, kResultFail, kResultFail); |
2376 CHECK_VSEL(1, 1, 0, 1, kResultPass, kResultPass, kResultFail, kResultPass); | 2376 CHECK_VSEL(1, 1, 0, 1, kResultPass, kResultPass, kResultFail, kResultPass); |
2377 CHECK_VSEL(1, 1, 1, 0, kResultPass, kResultFail, kResultFail, kResultFail); | 2377 CHECK_VSEL(1, 1, 1, 0, kResultPass, kResultFail, kResultFail, kResultFail); |
2378 CHECK_VSEL(1, 1, 1, 1, kResultPass, kResultPass, kResultFail, kResultPass); | 2378 CHECK_VSEL(1, 1, 1, 1, kResultPass, kResultPass, kResultFail, kResultPass); |
2379 | 2379 |
2380 #undef CHECK_VSEL | 2380 #undef CHECK_VSEL |
2381 } | 2381 } |
2382 } | 2382 } |
2383 | 2383 |
| 2384 TEST(unaligned_loads) { |
| 2385 // All supported ARM targets allow unaligned accesses. |
| 2386 CcTest::InitializeVM(); |
| 2387 Isolate* isolate = CcTest::i_isolate(); |
| 2388 HandleScope scope(isolate); |
| 2389 |
| 2390 typedef struct { |
| 2391 uint32_t ldrh; |
| 2392 uint32_t ldrsh; |
| 2393 uint32_t ldr; |
| 2394 } T; |
| 2395 T t; |
| 2396 |
| 2397 Assembler assm(isolate, NULL, 0); |
| 2398 __ ldrh(ip, MemOperand(r1, r2)); |
| 2399 __ str(ip, MemOperand(r0, offsetof(T, ldrh))); |
| 2400 __ ldrsh(ip, MemOperand(r1, r2)); |
| 2401 __ str(ip, MemOperand(r0, offsetof(T, ldrsh))); |
| 2402 __ ldr(ip, MemOperand(r1, r2)); |
| 2403 __ str(ip, MemOperand(r0, offsetof(T, ldr))); |
| 2404 __ bx(lr); |
| 2405 |
| 2406 CodeDesc desc; |
| 2407 assm.GetCode(&desc); |
| 2408 Handle<Code> code = isolate->factory()->NewCode( |
| 2409 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 2410 #ifdef DEBUG |
| 2411 OFStream os(stdout); |
| 2412 code->Print(os); |
| 2413 #endif |
| 2414 F4 f = FUNCTION_CAST<F4>(code->entry()); |
| 2415 |
| 2416 Object* dummy = nullptr; |
| 2417 USE(dummy); |
| 2418 |
| 2419 #ifndef V8_TARGET_LITTLE_ENDIAN |
| 2420 #error This test assumes a little-endian layout. |
| 2421 #endif |
| 2422 uint64_t data = UINT64_C(0x84838281807f7e7d); |
| 2423 dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 0, 0, 0); |
| 2424 CHECK_EQ(0x00007e7d, t.ldrh); |
| 2425 CHECK_EQ(0x00007e7d, t.ldrsh); |
| 2426 CHECK_EQ(0x807f7e7d, t.ldr); |
| 2427 dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 1, 0, 0); |
| 2428 CHECK_EQ(0x00007f7e, t.ldrh); |
| 2429 CHECK_EQ(0x00007f7e, t.ldrsh); |
| 2430 CHECK_EQ(0x81807f7e, t.ldr); |
| 2431 dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 2, 0, 0); |
| 2432 CHECK_EQ(0x0000807f, t.ldrh); |
| 2433 CHECK_EQ(0xffff807f, t.ldrsh); |
| 2434 CHECK_EQ(0x8281807f, t.ldr); |
| 2435 dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 3, 0, 0); |
| 2436 CHECK_EQ(0x00008180, t.ldrh); |
| 2437 CHECK_EQ(0xffff8180, t.ldrsh); |
| 2438 CHECK_EQ(0x83828180, t.ldr); |
| 2439 } |
| 2440 |
| 2441 TEST(unaligned_stores) { |
| 2442 // All supported ARM targets allow unaligned accesses. |
| 2443 CcTest::InitializeVM(); |
| 2444 Isolate* isolate = CcTest::i_isolate(); |
| 2445 HandleScope scope(isolate); |
| 2446 |
| 2447 Assembler assm(isolate, NULL, 0); |
| 2448 __ strh(r3, MemOperand(r0, r2)); |
| 2449 __ str(r3, MemOperand(r1, r2)); |
| 2450 __ bx(lr); |
| 2451 |
| 2452 CodeDesc desc; |
| 2453 assm.GetCode(&desc); |
| 2454 Handle<Code> code = isolate->factory()->NewCode( |
| 2455 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 2456 #ifdef DEBUG |
| 2457 OFStream os(stdout); |
| 2458 code->Print(os); |
| 2459 #endif |
| 2460 F4 f = FUNCTION_CAST<F4>(code->entry()); |
| 2461 |
| 2462 Object* dummy = nullptr; |
| 2463 USE(dummy); |
| 2464 |
| 2465 #ifndef V8_TARGET_LITTLE_ENDIAN |
| 2466 #error This test assumes a little-endian layout. |
| 2467 #endif |
| 2468 { |
| 2469 uint64_t strh = 0; |
| 2470 uint64_t str = 0; |
| 2471 dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 0, 0xfedcba98, 0); |
| 2472 CHECK_EQ(UINT64_C(0x000000000000ba98), strh); |
| 2473 CHECK_EQ(UINT64_C(0x00000000fedcba98), str); |
| 2474 } |
| 2475 { |
| 2476 uint64_t strh = 0; |
| 2477 uint64_t str = 0; |
| 2478 dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 1, 0xfedcba98, 0); |
| 2479 CHECK_EQ(UINT64_C(0x0000000000ba9800), strh); |
| 2480 CHECK_EQ(UINT64_C(0x000000fedcba9800), str); |
| 2481 } |
| 2482 { |
| 2483 uint64_t strh = 0; |
| 2484 uint64_t str = 0; |
| 2485 dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 2, 0xfedcba98, 0); |
| 2486 CHECK_EQ(UINT64_C(0x00000000ba980000), strh); |
| 2487 CHECK_EQ(UINT64_C(0x0000fedcba980000), str); |
| 2488 } |
| 2489 { |
| 2490 uint64_t strh = 0; |
| 2491 uint64_t str = 0; |
| 2492 dummy = CALL_GENERATED_CODE(isolate, f, &strh, &str, 3, 0xfedcba98, 0); |
| 2493 CHECK_EQ(UINT64_C(0x000000ba98000000), strh); |
| 2494 CHECK_EQ(UINT64_C(0x00fedcba98000000), str); |
| 2495 } |
| 2496 } |
| 2497 |
2384 TEST(regress4292_b) { | 2498 TEST(regress4292_b) { |
2385 CcTest::InitializeVM(); | 2499 CcTest::InitializeVM(); |
2386 Isolate* isolate = CcTest::i_isolate(); | 2500 Isolate* isolate = CcTest::i_isolate(); |
2387 HandleScope scope(isolate); | 2501 HandleScope scope(isolate); |
2388 | 2502 |
2389 Assembler assm(isolate, NULL, 0); | 2503 Assembler assm(isolate, NULL, 0); |
2390 Label end; | 2504 Label end; |
2391 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 2505 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
2392 for (int i = 0; i < 1020; ++i) { | 2506 for (int i = 0; i < 1020; ++i) { |
2393 __ b(hi, &end); | 2507 __ b(hi, &end); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2432 HandleScope scope(isolate); | 2546 HandleScope scope(isolate); |
2433 | 2547 |
2434 Assembler assm(isolate, NULL, 0); | 2548 Assembler assm(isolate, NULL, 0); |
2435 __ mov(r0, Operand(isolate->factory()->infinity_value())); | 2549 __ mov(r0, Operand(isolate->factory()->infinity_value())); |
2436 __ BlockConstPoolFor(1019); | 2550 __ BlockConstPoolFor(1019); |
2437 for (int i = 0; i < 1019; ++i) __ nop(); | 2551 for (int i = 0; i < 1019; ++i) __ nop(); |
2438 __ vldr(d0, MemOperand(r0, 0)); | 2552 __ vldr(d0, MemOperand(r0, 0)); |
2439 } | 2553 } |
2440 | 2554 |
2441 #undef __ | 2555 #undef __ |
OLD | NEW |