| 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 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 using namespace v8::internal; | 38 using namespace v8::internal; |
| 39 | 39 |
| 40 | 40 |
| 41 // Define these function prototypes to match JSEntryFunction in execution.cc. | 41 // Define these function prototypes to match JSEntryFunction in execution.cc. |
| 42 typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); | 42 typedef Object* (*F1)(int x, int p1, int p2, int p3, int p4); |
| 43 typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); | 43 typedef Object* (*F2)(int x, int y, int p2, int p3, int p4); |
| 44 typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); | 44 typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); |
| 45 | 45 |
| 46 | 46 |
| 47 static v8::Persistent<v8::Context> env; | |
| 48 | |
| 49 | |
| 50 static void InitializeVM() { | |
| 51 // Disable compilation of natives. | |
| 52 FLAG_disable_native_files = true; | |
| 53 | |
| 54 if (env.IsEmpty()) { | |
| 55 env = v8::Context::New(); | |
| 56 } | |
| 57 } | |
| 58 | |
| 59 | |
| 60 #define __ assm. | 47 #define __ assm. |
| 61 | 48 |
| 62 | 49 |
| 63 TEST(MIPS0) { | 50 TEST(MIPS0) { |
| 64 InitializeVM(); | 51 CcTest::InitializeVM(); |
| 65 Isolate* isolate = Isolate::Current(); | 52 Isolate* isolate = Isolate::Current(); |
| 66 HandleScope scope(isolate); | 53 HandleScope scope(isolate); |
| 67 | 54 |
| 68 MacroAssembler assm(isolate, NULL, 0); | 55 MacroAssembler assm(isolate, NULL, 0); |
| 69 | 56 |
| 70 // Addition. | 57 // Addition. |
| 71 __ addu(v0, a0, a1); | 58 __ addu(v0, a0, a1); |
| 72 __ jr(ra); | 59 __ jr(ra); |
| 73 __ nop(); | 60 __ nop(); |
| 74 | 61 |
| 75 CodeDesc desc; | 62 CodeDesc desc; |
| 76 assm.GetCode(&desc); | 63 assm.GetCode(&desc); |
| 77 Object* code = HEAP->CreateCode( | 64 Object* code = HEAP->CreateCode( |
| 78 desc, | 65 desc, |
| 79 Code::ComputeFlags(Code::STUB), | 66 Code::ComputeFlags(Code::STUB), |
| 80 Handle<Code>())->ToObjectChecked(); | 67 Handle<Code>())->ToObjectChecked(); |
| 81 CHECK(code->IsCode()); | 68 CHECK(code->IsCode()); |
| 82 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); | 69 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); |
| 83 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); | 70 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); |
| 84 ::printf("f() = %d\n", res); | 71 ::printf("f() = %d\n", res); |
| 85 CHECK_EQ(0xabc, res); | 72 CHECK_EQ(0xabc, res); |
| 86 } | 73 } |
| 87 | 74 |
| 88 | 75 |
| 89 TEST(MIPS1) { | 76 TEST(MIPS1) { |
| 90 InitializeVM(); | 77 CcTest::InitializeVM(); |
| 91 Isolate* isolate = Isolate::Current(); | 78 Isolate* isolate = Isolate::Current(); |
| 92 HandleScope scope(isolate); | 79 HandleScope scope(isolate); |
| 93 | 80 |
| 94 MacroAssembler assm(isolate, NULL, 0); | 81 MacroAssembler assm(isolate, NULL, 0); |
| 95 Label L, C; | 82 Label L, C; |
| 96 | 83 |
| 97 __ mov(a1, a0); | 84 __ mov(a1, a0); |
| 98 __ li(v0, 0); | 85 __ li(v0, 0); |
| 99 __ b(&C); | 86 __ b(&C); |
| 100 __ nop(); | 87 __ nop(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 119 Handle<Code>())->ToObjectChecked(); | 106 Handle<Code>())->ToObjectChecked(); |
| 120 CHECK(code->IsCode()); | 107 CHECK(code->IsCode()); |
| 121 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); | 108 F1 f = FUNCTION_CAST<F1>(Code::cast(code)->entry()); |
| 122 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 50, 0, 0, 0, 0)); | 109 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 50, 0, 0, 0, 0)); |
| 123 ::printf("f() = %d\n", res); | 110 ::printf("f() = %d\n", res); |
| 124 CHECK_EQ(1275, res); | 111 CHECK_EQ(1275, res); |
| 125 } | 112 } |
| 126 | 113 |
| 127 | 114 |
| 128 TEST(MIPS2) { | 115 TEST(MIPS2) { |
| 129 InitializeVM(); | 116 CcTest::InitializeVM(); |
| 130 Isolate* isolate = Isolate::Current(); | 117 Isolate* isolate = Isolate::Current(); |
| 131 HandleScope scope(isolate); | 118 HandleScope scope(isolate); |
| 132 | 119 |
| 133 MacroAssembler assm(isolate, NULL, 0); | 120 MacroAssembler assm(isolate, NULL, 0); |
| 134 | 121 |
| 135 Label exit, error; | 122 Label exit, error; |
| 136 | 123 |
| 137 // ----- Test all instructions. | 124 // ----- Test all instructions. |
| 138 | 125 |
| 139 // Test lui, ori, and addiu, used in the li pseudo-instruction. | 126 // Test lui, ori, and addiu, used in the li pseudo-instruction. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 CHECK(code->IsCode()); | 248 CHECK(code->IsCode()); |
| 262 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); | 249 F2 f = FUNCTION_CAST<F2>(Code::cast(code)->entry()); |
| 263 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); | 250 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 0xab0, 0xc, 0, 0, 0)); |
| 264 ::printf("f() = %d\n", res); | 251 ::printf("f() = %d\n", res); |
| 265 CHECK_EQ(0x31415926, res); | 252 CHECK_EQ(0x31415926, res); |
| 266 } | 253 } |
| 267 | 254 |
| 268 | 255 |
| 269 TEST(MIPS3) { | 256 TEST(MIPS3) { |
| 270 // Test floating point instructions. | 257 // Test floating point instructions. |
| 271 InitializeVM(); | 258 CcTest::InitializeVM(); |
| 272 Isolate* isolate = Isolate::Current(); | 259 Isolate* isolate = Isolate::Current(); |
| 273 HandleScope scope(isolate); | 260 HandleScope scope(isolate); |
| 274 | 261 |
| 275 typedef struct { | 262 typedef struct { |
| 276 double a; | 263 double a; |
| 277 double b; | 264 double b; |
| 278 double c; | 265 double c; |
| 279 double d; | 266 double d; |
| 280 double e; | 267 double e; |
| 281 double f; | 268 double f; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 CHECK_EQ(1.8066e16, t.e); | 340 CHECK_EQ(1.8066e16, t.e); |
| 354 CHECK_EQ(120.44, t.f); | 341 CHECK_EQ(120.44, t.f); |
| 355 CHECK_EQ(10.97451593465515908537, t.g); | 342 CHECK_EQ(10.97451593465515908537, t.g); |
| 356 CHECK_EQ(6.875, t.h); | 343 CHECK_EQ(6.875, t.h); |
| 357 } | 344 } |
| 358 } | 345 } |
| 359 | 346 |
| 360 | 347 |
| 361 TEST(MIPS4) { | 348 TEST(MIPS4) { |
| 362 // Test moves between floating point and integer registers. | 349 // Test moves between floating point and integer registers. |
| 363 InitializeVM(); | 350 CcTest::InitializeVM(); |
| 364 Isolate* isolate = Isolate::Current(); | 351 Isolate* isolate = Isolate::Current(); |
| 365 HandleScope scope(isolate); | 352 HandleScope scope(isolate); |
| 366 | 353 |
| 367 typedef struct { | 354 typedef struct { |
| 368 double a; | 355 double a; |
| 369 double b; | 356 double b; |
| 370 double c; | 357 double c; |
| 371 } T; | 358 } T; |
| 372 T t; | 359 T t; |
| 373 | 360 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 401 |
| 415 CHECK_EQ(2.75e11, t.a); | 402 CHECK_EQ(2.75e11, t.a); |
| 416 CHECK_EQ(2.75e11, t.b); | 403 CHECK_EQ(2.75e11, t.b); |
| 417 CHECK_EQ(1.5e22, t.c); | 404 CHECK_EQ(1.5e22, t.c); |
| 418 } | 405 } |
| 419 } | 406 } |
| 420 | 407 |
| 421 | 408 |
| 422 TEST(MIPS5) { | 409 TEST(MIPS5) { |
| 423 // Test conversions between doubles and integers. | 410 // Test conversions between doubles and integers. |
| 424 InitializeVM(); | 411 CcTest::InitializeVM(); |
| 425 Isolate* isolate = Isolate::Current(); | 412 Isolate* isolate = Isolate::Current(); |
| 426 HandleScope scope(isolate); | 413 HandleScope scope(isolate); |
| 427 | 414 |
| 428 typedef struct { | 415 typedef struct { |
| 429 double a; | 416 double a; |
| 430 double b; | 417 double b; |
| 431 int i; | 418 int i; |
| 432 int j; | 419 int j; |
| 433 } T; | 420 } T; |
| 434 T t; | 421 T t; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 CHECK_EQ(12345678.0, t.a); | 473 CHECK_EQ(12345678.0, t.a); |
| 487 CHECK_EQ(-100000.0, t.b); | 474 CHECK_EQ(-100000.0, t.b); |
| 488 CHECK_EQ(15000, t.i); | 475 CHECK_EQ(15000, t.i); |
| 489 CHECK_EQ(275000000, t.j); | 476 CHECK_EQ(275000000, t.j); |
| 490 } | 477 } |
| 491 } | 478 } |
| 492 | 479 |
| 493 | 480 |
| 494 TEST(MIPS6) { | 481 TEST(MIPS6) { |
| 495 // Test simple memory loads and stores. | 482 // Test simple memory loads and stores. |
| 496 InitializeVM(); | 483 CcTest::InitializeVM(); |
| 497 Isolate* isolate = Isolate::Current(); | 484 Isolate* isolate = Isolate::Current(); |
| 498 HandleScope scope(isolate); | 485 HandleScope scope(isolate); |
| 499 | 486 |
| 500 typedef struct { | 487 typedef struct { |
| 501 uint32_t ui; | 488 uint32_t ui; |
| 502 int32_t si; | 489 int32_t si; |
| 503 int32_t r1; | 490 int32_t r1; |
| 504 int32_t r2; | 491 int32_t r2; |
| 505 int32_t r3; | 492 int32_t r3; |
| 506 int32_t r4; | 493 int32_t r4; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 CHECK_EQ(0x3344, t.r2); | 546 CHECK_EQ(0x3344, t.r2); |
| 560 CHECK_EQ(0xffffbbcc, t.r3); | 547 CHECK_EQ(0xffffbbcc, t.r3); |
| 561 CHECK_EQ(0x0000bbcc, t.r4); | 548 CHECK_EQ(0x0000bbcc, t.r4); |
| 562 CHECK_EQ(0xffffffcc, t.r5); | 549 CHECK_EQ(0xffffffcc, t.r5); |
| 563 CHECK_EQ(0x3333bbcc, t.r6); | 550 CHECK_EQ(0x3333bbcc, t.r6); |
| 564 } | 551 } |
| 565 | 552 |
| 566 | 553 |
| 567 TEST(MIPS7) { | 554 TEST(MIPS7) { |
| 568 // Test floating point compare and branch instructions. | 555 // Test floating point compare and branch instructions. |
| 569 InitializeVM(); | 556 CcTest::InitializeVM(); |
| 570 Isolate* isolate = Isolate::Current(); | 557 Isolate* isolate = Isolate::Current(); |
| 571 HandleScope scope(isolate); | 558 HandleScope scope(isolate); |
| 572 | 559 |
| 573 typedef struct { | 560 typedef struct { |
| 574 double a; | 561 double a; |
| 575 double b; | 562 double b; |
| 576 double c; | 563 double c; |
| 577 double d; | 564 double d; |
| 578 double e; | 565 double e; |
| 579 double f; | 566 double f; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 USE(dummy); | 628 USE(dummy); |
| 642 CHECK_EQ(1.5e14, t.a); | 629 CHECK_EQ(1.5e14, t.a); |
| 643 CHECK_EQ(2.75e11, t.b); | 630 CHECK_EQ(2.75e11, t.b); |
| 644 CHECK_EQ(1, t.result); | 631 CHECK_EQ(1, t.result); |
| 645 } | 632 } |
| 646 } | 633 } |
| 647 | 634 |
| 648 | 635 |
| 649 TEST(MIPS8) { | 636 TEST(MIPS8) { |
| 650 // Test ROTR and ROTRV instructions. | 637 // Test ROTR and ROTRV instructions. |
| 651 InitializeVM(); | 638 CcTest::InitializeVM(); |
| 652 Isolate* isolate = Isolate::Current(); | 639 Isolate* isolate = Isolate::Current(); |
| 653 HandleScope scope(isolate); | 640 HandleScope scope(isolate); |
| 654 | 641 |
| 655 typedef struct { | 642 typedef struct { |
| 656 int32_t input; | 643 int32_t input; |
| 657 int32_t result_rotr_4; | 644 int32_t result_rotr_4; |
| 658 int32_t result_rotr_8; | 645 int32_t result_rotr_8; |
| 659 int32_t result_rotr_12; | 646 int32_t result_rotr_12; |
| 660 int32_t result_rotr_16; | 647 int32_t result_rotr_16; |
| 661 int32_t result_rotr_20; | 648 int32_t result_rotr_20; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 CHECK_EQ(0x67812345, t.result_rotrv_12); | 733 CHECK_EQ(0x67812345, t.result_rotrv_12); |
| 747 CHECK_EQ(0x56781234, t.result_rotrv_16); | 734 CHECK_EQ(0x56781234, t.result_rotrv_16); |
| 748 CHECK_EQ(0x45678123, t.result_rotrv_20); | 735 CHECK_EQ(0x45678123, t.result_rotrv_20); |
| 749 CHECK_EQ(0x34567812, t.result_rotrv_24); | 736 CHECK_EQ(0x34567812, t.result_rotrv_24); |
| 750 CHECK_EQ(0x23456781, t.result_rotrv_28); | 737 CHECK_EQ(0x23456781, t.result_rotrv_28); |
| 751 } | 738 } |
| 752 | 739 |
| 753 | 740 |
| 754 TEST(MIPS9) { | 741 TEST(MIPS9) { |
| 755 // Test BRANCH improvements. | 742 // Test BRANCH improvements. |
| 756 InitializeVM(); | 743 CcTest::InitializeVM(); |
| 757 Isolate* isolate = Isolate::Current(); | 744 Isolate* isolate = Isolate::Current(); |
| 758 HandleScope scope(isolate); | 745 HandleScope scope(isolate); |
| 759 | 746 |
| 760 MacroAssembler assm(isolate, NULL, 0); | 747 MacroAssembler assm(isolate, NULL, 0); |
| 761 Label exit, exit2, exit3; | 748 Label exit, exit2, exit3; |
| 762 | 749 |
| 763 __ Branch(&exit, ge, a0, Operand(0x00000000)); | 750 __ Branch(&exit, ge, a0, Operand(0x00000000)); |
| 764 __ Branch(&exit2, ge, a0, Operand(0x00001FFF)); | 751 __ Branch(&exit2, ge, a0, Operand(0x00001FFF)); |
| 765 __ Branch(&exit3, ge, a0, Operand(0x0001FFFF)); | 752 __ Branch(&exit3, ge, a0, Operand(0x0001FFFF)); |
| 766 | 753 |
| 767 __ bind(&exit); | 754 __ bind(&exit); |
| 768 __ bind(&exit2); | 755 __ bind(&exit2); |
| 769 __ bind(&exit3); | 756 __ bind(&exit3); |
| 770 __ jr(ra); | 757 __ jr(ra); |
| 771 __ nop(); | 758 __ nop(); |
| 772 | 759 |
| 773 CodeDesc desc; | 760 CodeDesc desc; |
| 774 assm.GetCode(&desc); | 761 assm.GetCode(&desc); |
| 775 Object* code = HEAP->CreateCode( | 762 Object* code = HEAP->CreateCode( |
| 776 desc, | 763 desc, |
| 777 Code::ComputeFlags(Code::STUB), | 764 Code::ComputeFlags(Code::STUB), |
| 778 Handle<Code>())->ToObjectChecked(); | 765 Handle<Code>())->ToObjectChecked(); |
| 779 CHECK(code->IsCode()); | 766 CHECK(code->IsCode()); |
| 780 } | 767 } |
| 781 | 768 |
| 782 | 769 |
| 783 TEST(MIPS10) { | 770 TEST(MIPS10) { |
| 784 // Test conversions between doubles and long integers. | 771 // Test conversions between doubles and long integers. |
| 785 // Test hos the long ints map to FP regs pairs. | 772 // Test hos the long ints map to FP regs pairs. |
| 786 InitializeVM(); | 773 CcTest::InitializeVM(); |
| 787 Isolate* isolate = Isolate::Current(); | 774 Isolate* isolate = Isolate::Current(); |
| 788 HandleScope scope(isolate); | 775 HandleScope scope(isolate); |
| 789 | 776 |
| 790 typedef struct { | 777 typedef struct { |
| 791 double a; | 778 double a; |
| 792 double b; | 779 double b; |
| 793 int32_t dbl_mant; | 780 int32_t dbl_mant; |
| 794 int32_t dbl_exp; | 781 int32_t dbl_exp; |
| 795 int32_t long_hi; | 782 int32_t long_hi; |
| 796 int32_t long_lo; | 783 int32_t long_lo; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 CHECK_EQ(0, t.long_hi); | 838 CHECK_EQ(0, t.long_hi); |
| 852 CHECK_EQ(0x7fffffff, t.long_lo); | 839 CHECK_EQ(0x7fffffff, t.long_lo); |
| 853 // 0xFF00FF00FF -> 1.095233372415e12. | 840 // 0xFF00FF00FF -> 1.095233372415e12. |
| 854 CHECK_EQ(1.095233372415e12, t.b); | 841 CHECK_EQ(1.095233372415e12, t.b); |
| 855 } | 842 } |
| 856 } | 843 } |
| 857 | 844 |
| 858 | 845 |
| 859 TEST(MIPS11) { | 846 TEST(MIPS11) { |
| 860 // Test LWL, LWR, SWL and SWR instructions. | 847 // Test LWL, LWR, SWL and SWR instructions. |
| 861 InitializeVM(); | 848 CcTest::InitializeVM(); |
| 862 Isolate* isolate = Isolate::Current(); | 849 Isolate* isolate = Isolate::Current(); |
| 863 HandleScope scope(isolate); | 850 HandleScope scope(isolate); |
| 864 | 851 |
| 865 typedef struct { | 852 typedef struct { |
| 866 int32_t reg_init; | 853 int32_t reg_init; |
| 867 int32_t mem_init; | 854 int32_t mem_init; |
| 868 int32_t lwl_0; | 855 int32_t lwl_0; |
| 869 int32_t lwl_1; | 856 int32_t lwl_1; |
| 870 int32_t lwl_2; | 857 int32_t lwl_2; |
| 871 int32_t lwl_3; | 858 int32_t lwl_3; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 CHECK_EQ(0xaabbccdd, t.swl_3); | 982 CHECK_EQ(0xaabbccdd, t.swl_3); |
| 996 | 983 |
| 997 CHECK_EQ(0xaabbccdd, t.swr_0); | 984 CHECK_EQ(0xaabbccdd, t.swr_0); |
| 998 CHECK_EQ(0xbbccdd44, t.swr_1); | 985 CHECK_EQ(0xbbccdd44, t.swr_1); |
| 999 CHECK_EQ(0xccdd3344, t.swr_2); | 986 CHECK_EQ(0xccdd3344, t.swr_2); |
| 1000 CHECK_EQ(0xdd223344, t.swr_3); | 987 CHECK_EQ(0xdd223344, t.swr_3); |
| 1001 } | 988 } |
| 1002 | 989 |
| 1003 | 990 |
| 1004 TEST(MIPS12) { | 991 TEST(MIPS12) { |
| 1005 InitializeVM(); | 992 CcTest::InitializeVM(); |
| 1006 Isolate* isolate = Isolate::Current(); | 993 Isolate* isolate = Isolate::Current(); |
| 1007 HandleScope scope(isolate); | 994 HandleScope scope(isolate); |
| 1008 | 995 |
| 1009 typedef struct { | 996 typedef struct { |
| 1010 int32_t x; | 997 int32_t x; |
| 1011 int32_t y; | 998 int32_t y; |
| 1012 int32_t y1; | 999 int32_t y1; |
| 1013 int32_t y2; | 1000 int32_t y2; |
| 1014 int32_t y3; | 1001 int32_t y3; |
| 1015 int32_t y4; | 1002 int32_t y4; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 | 1074 |
| 1088 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); | 1075 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); |
| 1089 USE(dummy); | 1076 USE(dummy); |
| 1090 | 1077 |
| 1091 CHECK_EQ(3, t.y1); | 1078 CHECK_EQ(3, t.y1); |
| 1092 } | 1079 } |
| 1093 | 1080 |
| 1094 | 1081 |
| 1095 TEST(MIPS13) { | 1082 TEST(MIPS13) { |
| 1096 // Test Cvt_d_uw and Trunc_uw_d macros. | 1083 // Test Cvt_d_uw and Trunc_uw_d macros. |
| 1097 InitializeVM(); | 1084 CcTest::InitializeVM(); |
| 1098 Isolate* isolate = Isolate::Current(); | 1085 Isolate* isolate = Isolate::Current(); |
| 1099 HandleScope scope(isolate); | 1086 HandleScope scope(isolate); |
| 1100 | 1087 |
| 1101 typedef struct { | 1088 typedef struct { |
| 1102 double cvt_big_out; | 1089 double cvt_big_out; |
| 1103 double cvt_small_out; | 1090 double cvt_small_out; |
| 1104 uint32_t trunc_big_out; | 1091 uint32_t trunc_big_out; |
| 1105 uint32_t trunc_small_out; | 1092 uint32_t trunc_small_out; |
| 1106 uint32_t cvt_big_in; | 1093 uint32_t cvt_big_in; |
| 1107 uint32_t cvt_small_in; | 1094 uint32_t cvt_small_in; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 | 1137 |
| 1151 CHECK_EQ(static_cast<int>(t.trunc_big_out), static_cast<int>(t.cvt_big_in)); | 1138 CHECK_EQ(static_cast<int>(t.trunc_big_out), static_cast<int>(t.cvt_big_in)); |
| 1152 CHECK_EQ(static_cast<int>(t.trunc_small_out), | 1139 CHECK_EQ(static_cast<int>(t.trunc_small_out), |
| 1153 static_cast<int>(t.cvt_small_in)); | 1140 static_cast<int>(t.cvt_small_in)); |
| 1154 } | 1141 } |
| 1155 } | 1142 } |
| 1156 | 1143 |
| 1157 | 1144 |
| 1158 TEST(MIPS14) { | 1145 TEST(MIPS14) { |
| 1159 // Test round, floor, ceil, trunc, cvt. | 1146 // Test round, floor, ceil, trunc, cvt. |
| 1160 InitializeVM(); | 1147 CcTest::InitializeVM(); |
| 1161 Isolate* isolate = Isolate::Current(); | 1148 Isolate* isolate = Isolate::Current(); |
| 1162 HandleScope scope(isolate); | 1149 HandleScope scope(isolate); |
| 1163 | 1150 |
| 1164 #define ROUND_STRUCT_ELEMENT(x) \ | 1151 #define ROUND_STRUCT_ELEMENT(x) \ |
| 1165 int32_t x##_up_out; \ | 1152 int32_t x##_up_out; \ |
| 1166 int32_t x##_down_out; \ | 1153 int32_t x##_down_out; \ |
| 1167 int32_t neg_##x##_up_out; \ | 1154 int32_t neg_##x##_up_out; \ |
| 1168 int32_t neg_##x##_down_out; \ | 1155 int32_t neg_##x##_down_out; \ |
| 1169 uint32_t x##_err1_out; \ | 1156 uint32_t x##_err1_out; \ |
| 1170 uint32_t x##_err2_out; \ | 1157 uint32_t x##_err2_out; \ |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 CHECK_ROUND_RESULT(round); | 1274 CHECK_ROUND_RESULT(round); |
| 1288 CHECK_ROUND_RESULT(floor); | 1275 CHECK_ROUND_RESULT(floor); |
| 1289 CHECK_ROUND_RESULT(ceil); | 1276 CHECK_ROUND_RESULT(ceil); |
| 1290 CHECK_ROUND_RESULT(cvt); | 1277 CHECK_ROUND_RESULT(cvt); |
| 1291 } | 1278 } |
| 1292 } | 1279 } |
| 1293 | 1280 |
| 1294 | 1281 |
| 1295 TEST(MIPS15) { | 1282 TEST(MIPS15) { |
| 1296 // Test chaining of label usages within instructions (issue 1644). | 1283 // Test chaining of label usages within instructions (issue 1644). |
| 1297 InitializeVM(); | 1284 CcTest::InitializeVM(); |
| 1298 Isolate* isolate = Isolate::Current(); | 1285 Isolate* isolate = Isolate::Current(); |
| 1299 HandleScope scope(isolate); | 1286 HandleScope scope(isolate); |
| 1300 Assembler assm(isolate, NULL, 0); | 1287 Assembler assm(isolate, NULL, 0); |
| 1301 | 1288 |
| 1302 Label target; | 1289 Label target; |
| 1303 __ beq(v0, v1, &target); | 1290 __ beq(v0, v1, &target); |
| 1304 __ nop(); | 1291 __ nop(); |
| 1305 __ bne(v0, v1, &target); | 1292 __ bne(v0, v1, &target); |
| 1306 __ nop(); | 1293 __ nop(); |
| 1307 __ bind(&target); | 1294 __ bind(&target); |
| 1308 __ nop(); | 1295 __ nop(); |
| 1309 } | 1296 } |
| 1310 | 1297 |
| 1311 #undef __ | 1298 #undef __ |
| OLD | NEW |