Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: test/cctest/test-assembler-arm.cc

Issue 1457223005: Remove a bunch of Isolate::Current() callsites from simulators (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x87/simulator-x87.h ('k') | test/cctest/test-assembler-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 CodeDesc desc; 66 CodeDesc desc;
67 assm.GetCode(&desc); 67 assm.GetCode(&desc);
68 Handle<Code> code = isolate->factory()->NewCode( 68 Handle<Code> code = isolate->factory()->NewCode(
69 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 69 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
70 #ifdef DEBUG 70 #ifdef DEBUG
71 OFStream os(stdout); 71 OFStream os(stdout);
72 code->Print(os); 72 code->Print(os);
73 #endif 73 #endif
74 F2 f = FUNCTION_CAST<F2>(code->entry()); 74 F2 f = FUNCTION_CAST<F2>(code->entry());
75 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 3, 4, 0, 0, 0)); 75 int res =
76 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 3, 4, 0, 0, 0));
76 ::printf("f() = %d\n", res); 77 ::printf("f() = %d\n", res);
77 CHECK_EQ(7, res); 78 CHECK_EQ(7, res);
78 } 79 }
79 80
80 81
81 TEST(1) { 82 TEST(1) {
82 CcTest::InitializeVM(); 83 CcTest::InitializeVM();
83 Isolate* isolate = CcTest::i_isolate(); 84 Isolate* isolate = CcTest::i_isolate();
84 HandleScope scope(isolate); 85 HandleScope scope(isolate);
85 86
(...skipping 15 matching lines...) Expand all
101 102
102 CodeDesc desc; 103 CodeDesc desc;
103 assm.GetCode(&desc); 104 assm.GetCode(&desc);
104 Handle<Code> code = isolate->factory()->NewCode( 105 Handle<Code> code = isolate->factory()->NewCode(
105 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 106 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
106 #ifdef DEBUG 107 #ifdef DEBUG
107 OFStream os(stdout); 108 OFStream os(stdout);
108 code->Print(os); 109 code->Print(os);
109 #endif 110 #endif
110 F1 f = FUNCTION_CAST<F1>(code->entry()); 111 F1 f = FUNCTION_CAST<F1>(code->entry());
111 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 100, 0, 0, 0, 0)); 112 int res =
113 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 100, 0, 0, 0, 0));
112 ::printf("f() = %d\n", res); 114 ::printf("f() = %d\n", res);
113 CHECK_EQ(5050, res); 115 CHECK_EQ(5050, res);
114 } 116 }
115 117
116 118
117 TEST(2) { 119 TEST(2) {
118 CcTest::InitializeVM(); 120 CcTest::InitializeVM();
119 Isolate* isolate = CcTest::i_isolate(); 121 Isolate* isolate = CcTest::i_isolate();
120 HandleScope scope(isolate); 122 HandleScope scope(isolate);
121 123
(...skipping 24 matching lines...) Expand all
146 148
147 CodeDesc desc; 149 CodeDesc desc;
148 assm.GetCode(&desc); 150 assm.GetCode(&desc);
149 Handle<Code> code = isolate->factory()->NewCode( 151 Handle<Code> code = isolate->factory()->NewCode(
150 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 152 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
151 #ifdef DEBUG 153 #ifdef DEBUG
152 OFStream os(stdout); 154 OFStream os(stdout);
153 code->Print(os); 155 code->Print(os);
154 #endif 156 #endif
155 F1 f = FUNCTION_CAST<F1>(code->entry()); 157 F1 f = FUNCTION_CAST<F1>(code->entry());
156 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 10, 0, 0, 0, 0)); 158 int res =
159 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 10, 0, 0, 0, 0));
157 ::printf("f() = %d\n", res); 160 ::printf("f() = %d\n", res);
158 CHECK_EQ(3628800, res); 161 CHECK_EQ(3628800, res);
159 } 162 }
160 163
161 164
162 TEST(3) { 165 TEST(3) {
163 CcTest::InitializeVM(); 166 CcTest::InitializeVM();
164 Isolate* isolate = CcTest::i_isolate(); 167 Isolate* isolate = CcTest::i_isolate();
165 HandleScope scope(isolate); 168 HandleScope scope(isolate);
166 169
(...skipping 29 matching lines...) Expand all
196 Handle<Code> code = isolate->factory()->NewCode( 199 Handle<Code> code = isolate->factory()->NewCode(
197 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 200 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
198 #ifdef DEBUG 201 #ifdef DEBUG
199 OFStream os(stdout); 202 OFStream os(stdout);
200 code->Print(os); 203 code->Print(os);
201 #endif 204 #endif
202 F3 f = FUNCTION_CAST<F3>(code->entry()); 205 F3 f = FUNCTION_CAST<F3>(code->entry());
203 t.i = 100000; 206 t.i = 100000;
204 t.c = 10; 207 t.c = 10;
205 t.s = 1000; 208 t.s = 1000;
206 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0)); 209 int res =
210 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0));
207 ::printf("f() = %d\n", res); 211 ::printf("f() = %d\n", res);
208 CHECK_EQ(101010, res); 212 CHECK_EQ(101010, res);
209 CHECK_EQ(100000/2, t.i); 213 CHECK_EQ(100000/2, t.i);
210 CHECK_EQ(10*4, t.c); 214 CHECK_EQ(10*4, t.c);
211 CHECK_EQ(1000/8, t.s); 215 CHECK_EQ(1000/8, t.s);
212 } 216 }
213 217
214 218
215 TEST(4) { 219 TEST(4) {
216 // Test the VFP floating point instructions. 220 // Test the VFP floating point instructions.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 t.e = 0.0; 335 t.e = 0.0;
332 t.f = 0.0; 336 t.f = 0.0;
333 t.g = -2718.2818; 337 t.g = -2718.2818;
334 t.h = 31415926.5; 338 t.h = 31415926.5;
335 t.i = 0; 339 t.i = 0;
336 t.j = 0; 340 t.j = 0;
337 t.m = -2718.2818; 341 t.m = -2718.2818;
338 t.n = 123.456; 342 t.n = 123.456;
339 t.x = 4.5; 343 t.x = 4.5;
340 t.y = 9.0; 344 t.y = 9.0;
341 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 345 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0);
342 USE(dummy); 346 USE(dummy);
343 CHECK_EQ(-123.456, t.n); 347 CHECK_EQ(-123.456, t.n);
344 CHECK_EQ(2718.2818, t.m); 348 CHECK_EQ(2718.2818, t.m);
345 CHECK_EQ(2, t.i); 349 CHECK_EQ(2, t.i);
346 CHECK_EQ(2718.2818, t.g); 350 CHECK_EQ(2718.2818, t.g);
347 CHECK_EQ(31415926.5, t.h); 351 CHECK_EQ(31415926.5, t.h);
348 CHECK_EQ(617.0, t.j); 352 CHECK_EQ(617.0, t.j);
349 CHECK_EQ(42.0, t.f); 353 CHECK_EQ(42.0, t.f);
350 CHECK_EQ(1.0, t.e); 354 CHECK_EQ(1.0, t.e);
351 CHECK_EQ(1.000000059604644775390625, t.d); 355 CHECK_EQ(1.000000059604644775390625, t.d);
(...skipping 27 matching lines...) Expand all
379 CodeDesc desc; 383 CodeDesc desc;
380 assm.GetCode(&desc); 384 assm.GetCode(&desc);
381 Handle<Code> code = isolate->factory()->NewCode( 385 Handle<Code> code = isolate->factory()->NewCode(
382 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 386 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
383 #ifdef DEBUG 387 #ifdef DEBUG
384 OFStream os(stdout); 388 OFStream os(stdout);
385 code->Print(os); 389 code->Print(os);
386 #endif 390 #endif
387 F1 f = FUNCTION_CAST<F1>(code->entry()); 391 F1 f = FUNCTION_CAST<F1>(code->entry());
388 int res = reinterpret_cast<int>( 392 int res = reinterpret_cast<int>(
389 CALL_GENERATED_CODE(f, 0xAAAAAAAA, 0, 0, 0, 0)); 393 CALL_GENERATED_CODE(isolate, f, 0xAAAAAAAA, 0, 0, 0, 0));
390 ::printf("f() = %d\n", res); 394 ::printf("f() = %d\n", res);
391 CHECK_EQ(-7, res); 395 CHECK_EQ(-7, res);
392 } 396 }
393 } 397 }
394 398
395 399
396 TEST(6) { 400 TEST(6) {
397 // Test saturating instructions. 401 // Test saturating instructions.
398 CcTest::InitializeVM(); 402 CcTest::InitializeVM();
399 Isolate* isolate = CcTest::i_isolate(); 403 Isolate* isolate = CcTest::i_isolate();
(...skipping 13 matching lines...) Expand all
413 CodeDesc desc; 417 CodeDesc desc;
414 assm.GetCode(&desc); 418 assm.GetCode(&desc);
415 Handle<Code> code = isolate->factory()->NewCode( 419 Handle<Code> code = isolate->factory()->NewCode(
416 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 420 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
417 #ifdef DEBUG 421 #ifdef DEBUG
418 OFStream os(stdout); 422 OFStream os(stdout);
419 code->Print(os); 423 code->Print(os);
420 #endif 424 #endif
421 F1 f = FUNCTION_CAST<F1>(code->entry()); 425 F1 f = FUNCTION_CAST<F1>(code->entry());
422 int res = reinterpret_cast<int>( 426 int res = reinterpret_cast<int>(
423 CALL_GENERATED_CODE(f, 0xFFFF, 0, 0, 0, 0)); 427 CALL_GENERATED_CODE(isolate, f, 0xFFFF, 0, 0, 0, 0));
424 ::printf("f() = %d\n", res); 428 ::printf("f() = %d\n", res);
425 CHECK_EQ(382, res); 429 CHECK_EQ(382, res);
426 } 430 }
427 } 431 }
428 432
429 433
430 enum VCVTTypes { 434 enum VCVTTypes {
431 s32_f64, 435 s32_f64,
432 u32_f64 436 u32_f64
433 }; 437 };
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 490
487 CodeDesc desc; 491 CodeDesc desc;
488 assm.GetCode(&desc); 492 assm.GetCode(&desc);
489 Handle<Code> code = isolate->factory()->NewCode( 493 Handle<Code> code = isolate->factory()->NewCode(
490 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 494 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
491 #ifdef DEBUG 495 #ifdef DEBUG
492 OFStream os(stdout); 496 OFStream os(stdout);
493 code->Print(os); 497 code->Print(os);
494 #endif 498 #endif
495 F1 f = FUNCTION_CAST<F1>(code->entry()); 499 F1 f = FUNCTION_CAST<F1>(code->entry());
496 int res = reinterpret_cast<int>( 500 int res =
497 CALL_GENERATED_CODE(f, 0, 0, 0, 0, 0)); 501 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0));
498 ::printf("res = %d\n", res); 502 ::printf("res = %d\n", res);
499 CHECK_EQ(expected, res); 503 CHECK_EQ(expected, res);
500 } 504 }
501 } 505 }
502 506
503 507
504 TEST(7) { 508 TEST(7) {
505 CcTest::InitializeVM(); 509 CcTest::InitializeVM();
506 // Test vfp rounding modes. 510 // Test vfp rounding modes.
507 511
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 692
689 f.a = 1.0; 693 f.a = 1.0;
690 f.b = 2.0; 694 f.b = 2.0;
691 f.c = 3.0; 695 f.c = 3.0;
692 f.d = 4.0; 696 f.d = 4.0;
693 f.e = 5.0; 697 f.e = 5.0;
694 f.f = 6.0; 698 f.f = 6.0;
695 f.g = 7.0; 699 f.g = 7.0;
696 f.h = 8.0; 700 f.h = 8.0;
697 701
698 Object* dummy = CALL_GENERATED_CODE(fn, &d, &f, 0, 0, 0); 702 Object* dummy = CALL_GENERATED_CODE(isolate, fn, &d, &f, 0, 0, 0);
699 USE(dummy); 703 USE(dummy);
700 704
701 CHECK_EQ(7.7, d.a); 705 CHECK_EQ(7.7, d.a);
702 CHECK_EQ(8.8, d.b); 706 CHECK_EQ(8.8, d.b);
703 CHECK_EQ(1.1, d.c); 707 CHECK_EQ(1.1, d.c);
704 CHECK_EQ(2.2, d.d); 708 CHECK_EQ(2.2, d.d);
705 CHECK_EQ(3.3, d.e); 709 CHECK_EQ(3.3, d.e);
706 CHECK_EQ(4.4, d.f); 710 CHECK_EQ(4.4, d.f);
707 CHECK_EQ(5.5, d.g); 711 CHECK_EQ(5.5, d.g);
708 CHECK_EQ(6.6, d.h); 712 CHECK_EQ(6.6, d.h);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 802
799 f.a = 1.0; 803 f.a = 1.0;
800 f.b = 2.0; 804 f.b = 2.0;
801 f.c = 3.0; 805 f.c = 3.0;
802 f.d = 4.0; 806 f.d = 4.0;
803 f.e = 5.0; 807 f.e = 5.0;
804 f.f = 6.0; 808 f.f = 6.0;
805 f.g = 7.0; 809 f.g = 7.0;
806 f.h = 8.0; 810 f.h = 8.0;
807 811
808 Object* dummy = CALL_GENERATED_CODE(fn, &d, &f, 0, 0, 0); 812 Object* dummy = CALL_GENERATED_CODE(isolate, fn, &d, &f, 0, 0, 0);
809 USE(dummy); 813 USE(dummy);
810 814
811 CHECK_EQ(7.7, d.a); 815 CHECK_EQ(7.7, d.a);
812 CHECK_EQ(8.8, d.b); 816 CHECK_EQ(8.8, d.b);
813 CHECK_EQ(1.1, d.c); 817 CHECK_EQ(1.1, d.c);
814 CHECK_EQ(2.2, d.d); 818 CHECK_EQ(2.2, d.d);
815 CHECK_EQ(3.3, d.e); 819 CHECK_EQ(3.3, d.e);
816 CHECK_EQ(4.4, d.f); 820 CHECK_EQ(4.4, d.f);
817 CHECK_EQ(5.5, d.g); 821 CHECK_EQ(5.5, d.g);
818 CHECK_EQ(6.6, d.h); 822 CHECK_EQ(6.6, d.h);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 908
905 f.a = 1.0; 909 f.a = 1.0;
906 f.b = 2.0; 910 f.b = 2.0;
907 f.c = 3.0; 911 f.c = 3.0;
908 f.d = 4.0; 912 f.d = 4.0;
909 f.e = 5.0; 913 f.e = 5.0;
910 f.f = 6.0; 914 f.f = 6.0;
911 f.g = 7.0; 915 f.g = 7.0;
912 f.h = 8.0; 916 f.h = 8.0;
913 917
914 Object* dummy = CALL_GENERATED_CODE(fn, &d, &f, 0, 0, 0); 918 Object* dummy = CALL_GENERATED_CODE(isolate, fn, &d, &f, 0, 0, 0);
915 USE(dummy); 919 USE(dummy);
916 920
917 CHECK_EQ(7.7, d.a); 921 CHECK_EQ(7.7, d.a);
918 CHECK_EQ(8.8, d.b); 922 CHECK_EQ(8.8, d.b);
919 CHECK_EQ(1.1, d.c); 923 CHECK_EQ(1.1, d.c);
920 CHECK_EQ(2.2, d.d); 924 CHECK_EQ(2.2, d.d);
921 CHECK_EQ(3.3, d.e); 925 CHECK_EQ(3.3, d.e);
922 CHECK_EQ(4.4, d.f); 926 CHECK_EQ(4.4, d.f);
923 CHECK_EQ(5.5, d.g); 927 CHECK_EQ(5.5, d.g);
924 CHECK_EQ(6.6, d.h); 928 CHECK_EQ(6.6, d.h);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 985
982 CodeDesc desc; 986 CodeDesc desc;
983 assm.GetCode(&desc); 987 assm.GetCode(&desc);
984 Handle<Code> code = isolate->factory()->NewCode( 988 Handle<Code> code = isolate->factory()->NewCode(
985 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 989 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
986 #ifdef DEBUG 990 #ifdef DEBUG
987 OFStream os(stdout); 991 OFStream os(stdout);
988 code->Print(os); 992 code->Print(os);
989 #endif 993 #endif
990 F3 f = FUNCTION_CAST<F3>(code->entry()); 994 F3 f = FUNCTION_CAST<F3>(code->entry());
991 Object* dummy = CALL_GENERATED_CODE(f, &i, 0, 0, 0, 0); 995 Object* dummy = CALL_GENERATED_CODE(isolate, f, &i, 0, 0, 0, 0);
992 USE(dummy); 996 USE(dummy);
993 997
994 CHECK_EQ(static_cast<int32_t>(0xabcd0001), i.a); 998 CHECK_EQ(static_cast<int32_t>(0xabcd0001), i.a);
995 CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b); 999 CHECK_EQ(static_cast<int32_t>(0xabcd0000) >> 1, i.b);
996 CHECK_EQ(0x00000000, i.c); 1000 CHECK_EQ(0x00000000, i.c);
997 CHECK_EQ(static_cast<int32_t>(0xffffffff), i.d); 1001 CHECK_EQ(static_cast<int32_t>(0xffffffff), i.d);
998 } 1002 }
999 1003
1000 1004
1001 TEST(12) { 1005 TEST(12) {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 OFStream os(stdout); 1119 OFStream os(stdout);
1116 code->Print(os); 1120 code->Print(os);
1117 #endif 1121 #endif
1118 F3 f = FUNCTION_CAST<F3>(code->entry()); 1122 F3 f = FUNCTION_CAST<F3>(code->entry());
1119 t.a = 1.5; 1123 t.a = 1.5;
1120 t.b = 2.75; 1124 t.b = 2.75;
1121 t.c = 17.17; 1125 t.c = 17.17;
1122 t.x = 1.5; 1126 t.x = 1.5;
1123 t.y = 2.75; 1127 t.y = 2.75;
1124 t.z = 17.17; 1128 t.z = 17.17;
1125 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 1129 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0);
1126 USE(dummy); 1130 USE(dummy);
1127 CHECK_EQ(14.7610017472335499, t.a); 1131 CHECK_EQ(14.7610017472335499, t.a);
1128 CHECK_EQ(3.84200491244266251, t.b); 1132 CHECK_EQ(3.84200491244266251, t.b);
1129 CHECK_EQ(73.8818412254460241, t.c); 1133 CHECK_EQ(73.8818412254460241, t.c);
1130 CHECK_EQ(2.75, t.x); 1134 CHECK_EQ(2.75, t.x);
1131 CHECK_EQ(1.5, t.y); 1135 CHECK_EQ(1.5, t.y);
1132 CHECK_EQ(17.0, t.z); 1136 CHECK_EQ(17.0, t.z);
1133 CHECK_EQ(14.7610017472335499, t.i); 1137 CHECK_EQ(14.7610017472335499, t.i);
1134 CHECK_EQ(16.0, t.j); 1138 CHECK_EQ(16.0, t.j);
1135 CHECK_EQ(73.8818412254460241, t.k); 1139 CHECK_EQ(73.8818412254460241, t.k);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 OFStream os(stdout); 1192 OFStream os(stdout);
1189 code->Print(os); 1193 code->Print(os);
1190 #endif 1194 #endif
1191 F3 f = FUNCTION_CAST<F3>(code->entry()); 1195 F3 f = FUNCTION_CAST<F3>(code->entry());
1192 t.left = bit_cast<double>(kHoleNanInt64); 1196 t.left = bit_cast<double>(kHoleNanInt64);
1193 t.right = 1; 1197 t.right = 1;
1194 t.add_result = 0; 1198 t.add_result = 0;
1195 t.sub_result = 0; 1199 t.sub_result = 0;
1196 t.mul_result = 0; 1200 t.mul_result = 0;
1197 t.div_result = 0; 1201 t.div_result = 0;
1198 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 1202 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0);
1199 USE(dummy); 1203 USE(dummy);
1200 const uint32_t kArmNanUpper32 = 0x7ff80000; 1204 const uint32_t kArmNanUpper32 = 0x7ff80000;
1201 const uint32_t kArmNanLower32 = 0x00000000; 1205 const uint32_t kArmNanLower32 = 0x00000000;
1202 #ifdef DEBUG 1206 #ifdef DEBUG
1203 const uint64_t kArmNanInt64 = 1207 const uint64_t kArmNanInt64 =
1204 (static_cast<uint64_t>(kArmNanUpper32) << 32) | kArmNanLower32; 1208 (static_cast<uint64_t>(kArmNanUpper32) << 32) | kArmNanLower32;
1205 DCHECK(kArmNanInt64 != kHoleNanInt64); 1209 DCHECK(kArmNanInt64 != kHoleNanInt64);
1206 #endif 1210 #endif
1207 // With VFP2 the sign of the canonicalized Nan is undefined. So 1211 // With VFP2 the sign of the canonicalized Nan is undefined. So
1208 // we remove the sign bit for the upper tests. 1212 // we remove the sign bit for the upper tests.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 t.srcA0 = 0x41424344; 1320 t.srcA0 = 0x41424344;
1317 t.srcA1 = 0x81828384; 1321 t.srcA1 = 0x81828384;
1318 t.dstA0 = 0; 1322 t.dstA0 = 0;
1319 t.dstA1 = 0; 1323 t.dstA1 = 0;
1320 t.dstA2 = 0; 1324 t.dstA2 = 0;
1321 t.dstA3 = 0; 1325 t.dstA3 = 0;
1322 t.dstA4 = 0; 1326 t.dstA4 = 0;
1323 t.dstA5 = 0; 1327 t.dstA5 = 0;
1324 t.dstA6 = 0; 1328 t.dstA6 = 0;
1325 t.dstA7 = 0; 1329 t.dstA7 = 0;
1326 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 1330 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0);
1327 USE(dummy); 1331 USE(dummy);
1328 CHECK_EQ(0x01020304u, t.dst0); 1332 CHECK_EQ(0x01020304u, t.dst0);
1329 CHECK_EQ(0x11121314u, t.dst1); 1333 CHECK_EQ(0x11121314u, t.dst1);
1330 CHECK_EQ(0x21222324u, t.dst2); 1334 CHECK_EQ(0x21222324u, t.dst2);
1331 CHECK_EQ(0x31323334u, t.dst3); 1335 CHECK_EQ(0x31323334u, t.dst3);
1332 CHECK_EQ(0x41424344u, t.dst4); 1336 CHECK_EQ(0x41424344u, t.dst4);
1333 CHECK_EQ(0x51525354u, t.dst5); 1337 CHECK_EQ(0x51525354u, t.dst5);
1334 CHECK_EQ(0x61626364u, t.dst6); 1338 CHECK_EQ(0x61626364u, t.dst6);
1335 CHECK_EQ(0x71727374u, t.dst7); 1339 CHECK_EQ(0x71727374u, t.dst7);
1336 CHECK_EQ(0x00430044u, t.dstA0); 1340 CHECK_EQ(0x00430044u, t.dstA0);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 #endif 1405 #endif
1402 F3 f = FUNCTION_CAST<F3>(code->entry()); 1406 F3 f = FUNCTION_CAST<F3>(code->entry());
1403 t.src0 = 0x01020304; 1407 t.src0 = 0x01020304;
1404 t.src1 = 0x11121314; 1408 t.src1 = 0x11121314;
1405 t.src2 = 0x11121300; 1409 t.src2 = 0x11121300;
1406 t.dst0 = 0; 1410 t.dst0 = 0;
1407 t.dst1 = 0; 1411 t.dst1 = 0;
1408 t.dst2 = 0; 1412 t.dst2 = 0;
1409 t.dst3 = 0; 1413 t.dst3 = 0;
1410 t.dst4 = 0; 1414 t.dst4 = 0;
1411 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 1415 Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0);
1412 USE(dummy); 1416 USE(dummy);
1413 CHECK_EQ(0x12130304u, t.dst0); 1417 CHECK_EQ(0x12130304u, t.dst0);
1414 CHECK_EQ(0x01021213u, t.dst1); 1418 CHECK_EQ(0x01021213u, t.dst1);
1415 CHECK_EQ(0x00010003u, t.dst2); 1419 CHECK_EQ(0x00010003u, t.dst2);
1416 CHECK_EQ(0x00000003u, t.dst3); 1420 CHECK_EQ(0x00000003u, t.dst3);
1417 CHECK_EQ(0x11121313u, t.dst4); 1421 CHECK_EQ(0x11121313u, t.dst4);
1418 } 1422 }
1419 1423
1420 1424
1421 TEST(17) { 1425 TEST(17) {
1422 // Test generating labels at high addresses. 1426 // Test generating labels at high addresses.
1423 // Should not assert. 1427 // Should not assert.
1424 CcTest::InitializeVM(); 1428 CcTest::InitializeVM();
1425 Isolate* isolate = CcTest::i_isolate(); 1429 Isolate* isolate = CcTest::i_isolate();
1426 HandleScope scope(isolate); 1430 HandleScope scope(isolate);
1427 1431
1428 // Generate a code segment that will be longer than 2^24 bytes. 1432 // Generate a code segment that will be longer than 2^24 bytes.
1429 Assembler assm(isolate, NULL, 0); 1433 Assembler assm(isolate, NULL, 0);
1430 for (size_t i = 0; i < 1 << 23 ; ++i) { // 2^23 1434 for (size_t i = 0; i < 1 << 23 ; ++i) { // 2^23
1431 __ nop(); 1435 __ nop();
1432 } 1436 }
1433 1437
1434 Label target; 1438 Label target;
1435 __ b(eq, &target); 1439 __ b(eq, &target);
1436 __ bind(&target); 1440 __ bind(&target);
1437 __ nop(); 1441 __ nop();
1438 } 1442 }
1439 1443
1440 1444
1441 #define TEST_SDIV(expected_, dividend_, divisor_) \ 1445 #define TEST_SDIV(expected_, dividend_, divisor_) \
1442 t.dividend = dividend_; \ 1446 t.dividend = dividend_; \
1443 t.divisor = divisor_; \ 1447 t.divisor = divisor_; \
1444 t.result = 0; \ 1448 t.result = 0; \
1445 dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); \ 1449 dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \
1446 CHECK_EQ(expected_, t.result); 1450 CHECK_EQ(expected_, t.result);
1447 1451
1448 1452
1449 TEST(sdiv) { 1453 TEST(sdiv) {
1450 // Test the sdiv. 1454 // Test the sdiv.
1451 CcTest::InitializeVM(); 1455 CcTest::InitializeVM();
1452 Isolate* isolate = CcTest::i_isolate(); 1456 Isolate* isolate = CcTest::i_isolate();
1453 HandleScope scope(isolate); 1457 HandleScope scope(isolate);
1454 Assembler assm(isolate, NULL, 0); 1458 Assembler assm(isolate, NULL, 0);
1455 1459
1456 struct T { 1460 struct T {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 TEST_SDIV(5, -10, -2); 1499 TEST_SDIV(5, -10, -2);
1496 TEST_SDIV(3, -10, -3); 1500 TEST_SDIV(3, -10, -3);
1497 USE(dummy); 1501 USE(dummy);
1498 } 1502 }
1499 } 1503 }
1500 1504
1501 1505
1502 #undef TEST_SDIV 1506 #undef TEST_SDIV
1503 1507
1504 1508
1505 #define TEST_UDIV(expected_, dividend_, divisor_) \ 1509 #define TEST_UDIV(expected_, dividend_, divisor_) \
1506 t.dividend = dividend_; \ 1510 t.dividend = dividend_; \
1507 t.divisor = divisor_; \ 1511 t.divisor = divisor_; \
1508 t.result = 0; \ 1512 t.result = 0; \
1509 dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); \ 1513 dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \
1510 CHECK_EQ(expected_, t.result); 1514 CHECK_EQ(expected_, t.result);
1511 1515
1512 1516
1513 TEST(udiv) { 1517 TEST(udiv) {
1514 // Test the udiv. 1518 // Test the udiv.
1515 CcTest::InitializeVM(); 1519 CcTest::InitializeVM();
1516 Isolate* isolate = CcTest::i_isolate(); 1520 Isolate* isolate = CcTest::i_isolate();
1517 HandleScope scope(isolate); 1521 HandleScope scope(isolate);
1518 Assembler assm(isolate, NULL, 0); 1522 Assembler assm(isolate, NULL, 0);
1519 1523
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 CodeDesc desc; 1574 CodeDesc desc;
1571 assm.GetCode(&desc); 1575 assm.GetCode(&desc);
1572 Handle<Code> code = isolate->factory()->NewCode( 1576 Handle<Code> code = isolate->factory()->NewCode(
1573 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1577 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1574 #ifdef OBJECT_PRINT 1578 #ifdef OBJECT_PRINT
1575 code->Print(std::cout); 1579 code->Print(std::cout);
1576 #endif 1580 #endif
1577 F3 f = FUNCTION_CAST<F3>(code->entry()); 1581 F3 f = FUNCTION_CAST<F3>(code->entry());
1578 for (size_t i = 0; i < 128; ++i) { 1582 for (size_t i = 0; i < 128; ++i) {
1579 int32_t r, x = rng->NextInt(), y = rng->NextInt(), z = rng->NextInt(); 1583 int32_t r, x = rng->NextInt(), y = rng->NextInt(), z = rng->NextInt();
1580 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, z, 0); 1584 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, z, 0);
1581 CHECK_EQ(bits::SignedMulHighAndAdd32(x, y, z), r); 1585 CHECK_EQ(bits::SignedMulHighAndAdd32(x, y, z), r);
1582 USE(dummy); 1586 USE(dummy);
1583 } 1587 }
1584 } 1588 }
1585 1589
1586 1590
1587 TEST(smmul) { 1591 TEST(smmul) {
1588 CcTest::InitializeVM(); 1592 CcTest::InitializeVM();
1589 Isolate* const isolate = CcTest::i_isolate(); 1593 Isolate* const isolate = CcTest::i_isolate();
1590 HandleScope scope(isolate); 1594 HandleScope scope(isolate);
1591 RandomNumberGenerator* const rng = isolate->random_number_generator(); 1595 RandomNumberGenerator* const rng = isolate->random_number_generator();
1592 Assembler assm(isolate, nullptr, 0); 1596 Assembler assm(isolate, nullptr, 0);
1593 __ smmul(r1, r1, r2); 1597 __ smmul(r1, r1, r2);
1594 __ str(r1, MemOperand(r0)); 1598 __ str(r1, MemOperand(r0));
1595 __ bx(lr); 1599 __ bx(lr);
1596 CodeDesc desc; 1600 CodeDesc desc;
1597 assm.GetCode(&desc); 1601 assm.GetCode(&desc);
1598 Handle<Code> code = isolate->factory()->NewCode( 1602 Handle<Code> code = isolate->factory()->NewCode(
1599 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1603 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1600 #ifdef OBJECT_PRINT 1604 #ifdef OBJECT_PRINT
1601 code->Print(std::cout); 1605 code->Print(std::cout);
1602 #endif 1606 #endif
1603 F3 f = FUNCTION_CAST<F3>(code->entry()); 1607 F3 f = FUNCTION_CAST<F3>(code->entry());
1604 for (size_t i = 0; i < 128; ++i) { 1608 for (size_t i = 0; i < 128; ++i) {
1605 int32_t r, x = rng->NextInt(), y = rng->NextInt(); 1609 int32_t r, x = rng->NextInt(), y = rng->NextInt();
1606 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, 0, 0); 1610 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0);
1607 CHECK_EQ(bits::SignedMulHigh32(x, y), r); 1611 CHECK_EQ(bits::SignedMulHigh32(x, y), r);
1608 USE(dummy); 1612 USE(dummy);
1609 } 1613 }
1610 } 1614 }
1611 1615
1612 1616
1613 TEST(sxtb) { 1617 TEST(sxtb) {
1614 CcTest::InitializeVM(); 1618 CcTest::InitializeVM();
1615 Isolate* const isolate = CcTest::i_isolate(); 1619 Isolate* const isolate = CcTest::i_isolate();
1616 HandleScope scope(isolate); 1620 HandleScope scope(isolate);
1617 RandomNumberGenerator* const rng = isolate->random_number_generator(); 1621 RandomNumberGenerator* const rng = isolate->random_number_generator();
1618 Assembler assm(isolate, nullptr, 0); 1622 Assembler assm(isolate, nullptr, 0);
1619 __ sxtb(r1, r1); 1623 __ sxtb(r1, r1);
1620 __ str(r1, MemOperand(r0)); 1624 __ str(r1, MemOperand(r0));
1621 __ bx(lr); 1625 __ bx(lr);
1622 CodeDesc desc; 1626 CodeDesc desc;
1623 assm.GetCode(&desc); 1627 assm.GetCode(&desc);
1624 Handle<Code> code = isolate->factory()->NewCode( 1628 Handle<Code> code = isolate->factory()->NewCode(
1625 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1629 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1626 #ifdef OBJECT_PRINT 1630 #ifdef OBJECT_PRINT
1627 code->Print(std::cout); 1631 code->Print(std::cout);
1628 #endif 1632 #endif
1629 F3 f = FUNCTION_CAST<F3>(code->entry()); 1633 F3 f = FUNCTION_CAST<F3>(code->entry());
1630 for (size_t i = 0; i < 128; ++i) { 1634 for (size_t i = 0; i < 128; ++i) {
1631 int32_t r, x = rng->NextInt(); 1635 int32_t r, x = rng->NextInt();
1632 Object* dummy = CALL_GENERATED_CODE(f, &r, x, 0, 0, 0); 1636 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, 0, 0, 0);
1633 CHECK_EQ(static_cast<int32_t>(static_cast<int8_t>(x)), r); 1637 CHECK_EQ(static_cast<int32_t>(static_cast<int8_t>(x)), r);
1634 USE(dummy); 1638 USE(dummy);
1635 } 1639 }
1636 } 1640 }
1637 1641
1638 1642
1639 TEST(sxtab) { 1643 TEST(sxtab) {
1640 CcTest::InitializeVM(); 1644 CcTest::InitializeVM();
1641 Isolate* const isolate = CcTest::i_isolate(); 1645 Isolate* const isolate = CcTest::i_isolate();
1642 HandleScope scope(isolate); 1646 HandleScope scope(isolate);
1643 RandomNumberGenerator* const rng = isolate->random_number_generator(); 1647 RandomNumberGenerator* const rng = isolate->random_number_generator();
1644 Assembler assm(isolate, nullptr, 0); 1648 Assembler assm(isolate, nullptr, 0);
1645 __ sxtab(r1, r2, r1); 1649 __ sxtab(r1, r2, r1);
1646 __ str(r1, MemOperand(r0)); 1650 __ str(r1, MemOperand(r0));
1647 __ bx(lr); 1651 __ bx(lr);
1648 CodeDesc desc; 1652 CodeDesc desc;
1649 assm.GetCode(&desc); 1653 assm.GetCode(&desc);
1650 Handle<Code> code = isolate->factory()->NewCode( 1654 Handle<Code> code = isolate->factory()->NewCode(
1651 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1655 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1652 #ifdef OBJECT_PRINT 1656 #ifdef OBJECT_PRINT
1653 code->Print(std::cout); 1657 code->Print(std::cout);
1654 #endif 1658 #endif
1655 F3 f = FUNCTION_CAST<F3>(code->entry()); 1659 F3 f = FUNCTION_CAST<F3>(code->entry());
1656 for (size_t i = 0; i < 128; ++i) { 1660 for (size_t i = 0; i < 128; ++i) {
1657 int32_t r, x = rng->NextInt(), y = rng->NextInt(); 1661 int32_t r, x = rng->NextInt(), y = rng->NextInt();
1658 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, 0, 0); 1662 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0);
1659 CHECK_EQ(static_cast<int32_t>(static_cast<int8_t>(x)) + y, r); 1663 CHECK_EQ(static_cast<int32_t>(static_cast<int8_t>(x)) + y, r);
1660 USE(dummy); 1664 USE(dummy);
1661 } 1665 }
1662 } 1666 }
1663 1667
1664 1668
1665 TEST(sxth) { 1669 TEST(sxth) {
1666 CcTest::InitializeVM(); 1670 CcTest::InitializeVM();
1667 Isolate* const isolate = CcTest::i_isolate(); 1671 Isolate* const isolate = CcTest::i_isolate();
1668 HandleScope scope(isolate); 1672 HandleScope scope(isolate);
1669 RandomNumberGenerator* const rng = isolate->random_number_generator(); 1673 RandomNumberGenerator* const rng = isolate->random_number_generator();
1670 Assembler assm(isolate, nullptr, 0); 1674 Assembler assm(isolate, nullptr, 0);
1671 __ sxth(r1, r1); 1675 __ sxth(r1, r1);
1672 __ str(r1, MemOperand(r0)); 1676 __ str(r1, MemOperand(r0));
1673 __ bx(lr); 1677 __ bx(lr);
1674 CodeDesc desc; 1678 CodeDesc desc;
1675 assm.GetCode(&desc); 1679 assm.GetCode(&desc);
1676 Handle<Code> code = isolate->factory()->NewCode( 1680 Handle<Code> code = isolate->factory()->NewCode(
1677 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1681 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1678 #ifdef OBJECT_PRINT 1682 #ifdef OBJECT_PRINT
1679 code->Print(std::cout); 1683 code->Print(std::cout);
1680 #endif 1684 #endif
1681 F3 f = FUNCTION_CAST<F3>(code->entry()); 1685 F3 f = FUNCTION_CAST<F3>(code->entry());
1682 for (size_t i = 0; i < 128; ++i) { 1686 for (size_t i = 0; i < 128; ++i) {
1683 int32_t r, x = rng->NextInt(); 1687 int32_t r, x = rng->NextInt();
1684 Object* dummy = CALL_GENERATED_CODE(f, &r, x, 0, 0, 0); 1688 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, 0, 0, 0);
1685 CHECK_EQ(static_cast<int32_t>(static_cast<int16_t>(x)), r); 1689 CHECK_EQ(static_cast<int32_t>(static_cast<int16_t>(x)), r);
1686 USE(dummy); 1690 USE(dummy);
1687 } 1691 }
1688 } 1692 }
1689 1693
1690 1694
1691 TEST(sxtah) { 1695 TEST(sxtah) {
1692 CcTest::InitializeVM(); 1696 CcTest::InitializeVM();
1693 Isolate* const isolate = CcTest::i_isolate(); 1697 Isolate* const isolate = CcTest::i_isolate();
1694 HandleScope scope(isolate); 1698 HandleScope scope(isolate);
1695 RandomNumberGenerator* const rng = isolate->random_number_generator(); 1699 RandomNumberGenerator* const rng = isolate->random_number_generator();
1696 Assembler assm(isolate, nullptr, 0); 1700 Assembler assm(isolate, nullptr, 0);
1697 __ sxtah(r1, r2, r1); 1701 __ sxtah(r1, r2, r1);
1698 __ str(r1, MemOperand(r0)); 1702 __ str(r1, MemOperand(r0));
1699 __ bx(lr); 1703 __ bx(lr);
1700 CodeDesc desc; 1704 CodeDesc desc;
1701 assm.GetCode(&desc); 1705 assm.GetCode(&desc);
1702 Handle<Code> code = isolate->factory()->NewCode( 1706 Handle<Code> code = isolate->factory()->NewCode(
1703 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1707 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1704 #ifdef OBJECT_PRINT 1708 #ifdef OBJECT_PRINT
1705 code->Print(std::cout); 1709 code->Print(std::cout);
1706 #endif 1710 #endif
1707 F3 f = FUNCTION_CAST<F3>(code->entry()); 1711 F3 f = FUNCTION_CAST<F3>(code->entry());
1708 for (size_t i = 0; i < 128; ++i) { 1712 for (size_t i = 0; i < 128; ++i) {
1709 int32_t r, x = rng->NextInt(), y = rng->NextInt(); 1713 int32_t r, x = rng->NextInt(), y = rng->NextInt();
1710 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, 0, 0); 1714 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0);
1711 CHECK_EQ(static_cast<int32_t>(static_cast<int16_t>(x)) + y, r); 1715 CHECK_EQ(static_cast<int32_t>(static_cast<int16_t>(x)) + y, r);
1712 USE(dummy); 1716 USE(dummy);
1713 } 1717 }
1714 } 1718 }
1715 1719
1716 1720
1717 TEST(uxtb) { 1721 TEST(uxtb) {
1718 CcTest::InitializeVM(); 1722 CcTest::InitializeVM();
1719 Isolate* const isolate = CcTest::i_isolate(); 1723 Isolate* const isolate = CcTest::i_isolate();
1720 HandleScope scope(isolate); 1724 HandleScope scope(isolate);
1721 RandomNumberGenerator* const rng = isolate->random_number_generator(); 1725 RandomNumberGenerator* const rng = isolate->random_number_generator();
1722 Assembler assm(isolate, nullptr, 0); 1726 Assembler assm(isolate, nullptr, 0);
1723 __ uxtb(r1, r1); 1727 __ uxtb(r1, r1);
1724 __ str(r1, MemOperand(r0)); 1728 __ str(r1, MemOperand(r0));
1725 __ bx(lr); 1729 __ bx(lr);
1726 CodeDesc desc; 1730 CodeDesc desc;
1727 assm.GetCode(&desc); 1731 assm.GetCode(&desc);
1728 Handle<Code> code = isolate->factory()->NewCode( 1732 Handle<Code> code = isolate->factory()->NewCode(
1729 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1733 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1730 #ifdef OBJECT_PRINT 1734 #ifdef OBJECT_PRINT
1731 code->Print(std::cout); 1735 code->Print(std::cout);
1732 #endif 1736 #endif
1733 F3 f = FUNCTION_CAST<F3>(code->entry()); 1737 F3 f = FUNCTION_CAST<F3>(code->entry());
1734 for (size_t i = 0; i < 128; ++i) { 1738 for (size_t i = 0; i < 128; ++i) {
1735 int32_t r, x = rng->NextInt(); 1739 int32_t r, x = rng->NextInt();
1736 Object* dummy = CALL_GENERATED_CODE(f, &r, x, 0, 0, 0); 1740 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, 0, 0, 0);
1737 CHECK_EQ(static_cast<int32_t>(static_cast<uint8_t>(x)), r); 1741 CHECK_EQ(static_cast<int32_t>(static_cast<uint8_t>(x)), r);
1738 USE(dummy); 1742 USE(dummy);
1739 } 1743 }
1740 } 1744 }
1741 1745
1742 1746
1743 TEST(uxtab) { 1747 TEST(uxtab) {
1744 CcTest::InitializeVM(); 1748 CcTest::InitializeVM();
1745 Isolate* const isolate = CcTest::i_isolate(); 1749 Isolate* const isolate = CcTest::i_isolate();
1746 HandleScope scope(isolate); 1750 HandleScope scope(isolate);
1747 RandomNumberGenerator* const rng = isolate->random_number_generator(); 1751 RandomNumberGenerator* const rng = isolate->random_number_generator();
1748 Assembler assm(isolate, nullptr, 0); 1752 Assembler assm(isolate, nullptr, 0);
1749 __ uxtab(r1, r2, r1); 1753 __ uxtab(r1, r2, r1);
1750 __ str(r1, MemOperand(r0)); 1754 __ str(r1, MemOperand(r0));
1751 __ bx(lr); 1755 __ bx(lr);
1752 CodeDesc desc; 1756 CodeDesc desc;
1753 assm.GetCode(&desc); 1757 assm.GetCode(&desc);
1754 Handle<Code> code = isolate->factory()->NewCode( 1758 Handle<Code> code = isolate->factory()->NewCode(
1755 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1759 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1756 #ifdef OBJECT_PRINT 1760 #ifdef OBJECT_PRINT
1757 code->Print(std::cout); 1761 code->Print(std::cout);
1758 #endif 1762 #endif
1759 F3 f = FUNCTION_CAST<F3>(code->entry()); 1763 F3 f = FUNCTION_CAST<F3>(code->entry());
1760 for (size_t i = 0; i < 128; ++i) { 1764 for (size_t i = 0; i < 128; ++i) {
1761 int32_t r, x = rng->NextInt(), y = rng->NextInt(); 1765 int32_t r, x = rng->NextInt(), y = rng->NextInt();
1762 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, 0, 0); 1766 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0);
1763 CHECK_EQ(static_cast<int32_t>(static_cast<uint8_t>(x)) + y, r); 1767 CHECK_EQ(static_cast<int32_t>(static_cast<uint8_t>(x)) + y, r);
1764 USE(dummy); 1768 USE(dummy);
1765 } 1769 }
1766 } 1770 }
1767 1771
1768 1772
1769 TEST(uxth) { 1773 TEST(uxth) {
1770 CcTest::InitializeVM(); 1774 CcTest::InitializeVM();
1771 Isolate* const isolate = CcTest::i_isolate(); 1775 Isolate* const isolate = CcTest::i_isolate();
1772 HandleScope scope(isolate); 1776 HandleScope scope(isolate);
1773 RandomNumberGenerator* const rng = isolate->random_number_generator(); 1777 RandomNumberGenerator* const rng = isolate->random_number_generator();
1774 Assembler assm(isolate, nullptr, 0); 1778 Assembler assm(isolate, nullptr, 0);
1775 __ uxth(r1, r1); 1779 __ uxth(r1, r1);
1776 __ str(r1, MemOperand(r0)); 1780 __ str(r1, MemOperand(r0));
1777 __ bx(lr); 1781 __ bx(lr);
1778 CodeDesc desc; 1782 CodeDesc desc;
1779 assm.GetCode(&desc); 1783 assm.GetCode(&desc);
1780 Handle<Code> code = isolate->factory()->NewCode( 1784 Handle<Code> code = isolate->factory()->NewCode(
1781 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1785 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1782 #ifdef OBJECT_PRINT 1786 #ifdef OBJECT_PRINT
1783 code->Print(std::cout); 1787 code->Print(std::cout);
1784 #endif 1788 #endif
1785 F3 f = FUNCTION_CAST<F3>(code->entry()); 1789 F3 f = FUNCTION_CAST<F3>(code->entry());
1786 for (size_t i = 0; i < 128; ++i) { 1790 for (size_t i = 0; i < 128; ++i) {
1787 int32_t r, x = rng->NextInt(); 1791 int32_t r, x = rng->NextInt();
1788 Object* dummy = CALL_GENERATED_CODE(f, &r, x, 0, 0, 0); 1792 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, 0, 0, 0);
1789 CHECK_EQ(static_cast<int32_t>(static_cast<uint16_t>(x)), r); 1793 CHECK_EQ(static_cast<int32_t>(static_cast<uint16_t>(x)), r);
1790 USE(dummy); 1794 USE(dummy);
1791 } 1795 }
1792 } 1796 }
1793 1797
1794 1798
1795 TEST(uxtah) { 1799 TEST(uxtah) {
1796 CcTest::InitializeVM(); 1800 CcTest::InitializeVM();
1797 Isolate* const isolate = CcTest::i_isolate(); 1801 Isolate* const isolate = CcTest::i_isolate();
1798 HandleScope scope(isolate); 1802 HandleScope scope(isolate);
1799 RandomNumberGenerator* const rng = isolate->random_number_generator(); 1803 RandomNumberGenerator* const rng = isolate->random_number_generator();
1800 Assembler assm(isolate, nullptr, 0); 1804 Assembler assm(isolate, nullptr, 0);
1801 __ uxtah(r1, r2, r1); 1805 __ uxtah(r1, r2, r1);
1802 __ str(r1, MemOperand(r0)); 1806 __ str(r1, MemOperand(r0));
1803 __ bx(lr); 1807 __ bx(lr);
1804 CodeDesc desc; 1808 CodeDesc desc;
1805 assm.GetCode(&desc); 1809 assm.GetCode(&desc);
1806 Handle<Code> code = isolate->factory()->NewCode( 1810 Handle<Code> code = isolate->factory()->NewCode(
1807 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1811 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1808 #ifdef OBJECT_PRINT 1812 #ifdef OBJECT_PRINT
1809 code->Print(std::cout); 1813 code->Print(std::cout);
1810 #endif 1814 #endif
1811 F3 f = FUNCTION_CAST<F3>(code->entry()); 1815 F3 f = FUNCTION_CAST<F3>(code->entry());
1812 for (size_t i = 0; i < 128; ++i) { 1816 for (size_t i = 0; i < 128; ++i) {
1813 int32_t r, x = rng->NextInt(), y = rng->NextInt(); 1817 int32_t r, x = rng->NextInt(), y = rng->NextInt();
1814 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, 0, 0); 1818 Object* dummy = CALL_GENERATED_CODE(isolate, f, &r, x, y, 0, 0);
1815 CHECK_EQ(static_cast<int32_t>(static_cast<uint16_t>(x)) + y, r); 1819 CHECK_EQ(static_cast<int32_t>(static_cast<uint16_t>(x)) + y, r);
1816 USE(dummy); 1820 USE(dummy);
1817 } 1821 }
1818 } 1822 }
1819 1823
1820 1824
1821 TEST(code_relative_offset) { 1825 TEST(code_relative_offset) {
1822 // Test extracting the offset of a label from the beginning of the code 1826 // Test extracting the offset of a label from the beginning of the code
1823 // in a register. 1827 // in a register.
1824 CcTest::InitializeVM(); 1828 CcTest::InitializeVM();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 // r0 = r0 + 5 + 5 + 11 1880 // r0 = r0 + 5 + 5 + 11
1877 __ add(r0, r0, Operand(11)); 1881 __ add(r0, r0, Operand(11));
1878 1882
1879 __ ldm(ia_w, sp, r4.bit() | r5.bit() | pc.bit()); 1883 __ ldm(ia_w, sp, r4.bit() | r5.bit() | pc.bit());
1880 1884
1881 CodeDesc desc; 1885 CodeDesc desc;
1882 assm.GetCode(&desc); 1886 assm.GetCode(&desc);
1883 Handle<Code> code = isolate->factory()->NewCode( 1887 Handle<Code> code = isolate->factory()->NewCode(
1884 desc, Code::ComputeFlags(Code::STUB), code_object); 1888 desc, Code::ComputeFlags(Code::STUB), code_object);
1885 F1 f = FUNCTION_CAST<F1>(code->entry()); 1889 F1 f = FUNCTION_CAST<F1>(code->entry());
1886 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0)); 1890 int res =
1891 reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 21, 0, 0, 0, 0));
1887 ::printf("f() = %d\n", res); 1892 ::printf("f() = %d\n", res);
1888 CHECK_EQ(42, res); 1893 CHECK_EQ(42, res);
1889 } 1894 }
1890 1895
1891 1896
1892 TEST(ARMv8_vrintX) { 1897 TEST(ARMv8_vrintX) {
1893 // Test the vrintX floating point instructions. 1898 // Test the vrintX floating point instructions.
1894 CcTest::InitializeVM(); 1899 CcTest::InitializeVM();
1895 Isolate* isolate = CcTest::i_isolate(); 1900 Isolate* isolate = CcTest::i_isolate();
1896 HandleScope scope(isolate); 1901 HandleScope scope(isolate);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 OFStream os(stdout); 1959 OFStream os(stdout);
1955 code->Print(os); 1960 code->Print(os);
1956 #endif 1961 #endif
1957 F3 f = FUNCTION_CAST<F3>(code->entry()); 1962 F3 f = FUNCTION_CAST<F3>(code->entry());
1958 1963
1959 Object* dummy = nullptr; 1964 Object* dummy = nullptr;
1960 USE(dummy); 1965 USE(dummy);
1961 1966
1962 #define CHECK_VRINT(input_val, ares, nres, mres, pres, zres) \ 1967 #define CHECK_VRINT(input_val, ares, nres, mres, pres, zres) \
1963 t.input = input_val; \ 1968 t.input = input_val; \
1964 dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); \ 1969 dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \
1965 CHECK_EQ(ares, t.ar); \ 1970 CHECK_EQ(ares, t.ar); \
1966 CHECK_EQ(nres, t.nr); \ 1971 CHECK_EQ(nres, t.nr); \
1967 CHECK_EQ(mres, t.mr); \ 1972 CHECK_EQ(mres, t.mr); \
1968 CHECK_EQ(pres, t.pr); \ 1973 CHECK_EQ(pres, t.pr); \
1969 CHECK_EQ(zres, t.zr); 1974 CHECK_EQ(zres, t.zr);
1970 1975
1971 CHECK_VRINT(-0.5, -1.0, -0.0, -1.0, -0.0, -0.0) 1976 CHECK_VRINT(-0.5, -1.0, -0.0, -1.0, -0.0, -0.0)
1972 CHECK_VRINT(-0.6, -1.0, -1.0, -1.0, -0.0, -0.0) 1977 CHECK_VRINT(-0.6, -1.0, -1.0, -1.0, -0.0, -0.0)
1973 CHECK_VRINT(-1.1, -1.0, -1.0, -2.0, -1.0, -1.0) 1978 CHECK_VRINT(-1.1, -1.0, -1.0, -2.0, -1.0, -1.0)
1974 CHECK_VRINT(0.5, 1.0, 0.0, 0.0, 1.0, 0.0) 1979 CHECK_VRINT(0.5, 1.0, 0.0, 0.0, 1.0, 0.0)
1975 CHECK_VRINT(0.6, 1.0, 1.0, 0.0, 1.0, 0.0) 1980 CHECK_VRINT(0.6, 1.0, 1.0, 0.0, 1.0, 0.0)
1976 CHECK_VRINT(1.1, 1.0, 1.0, 1.0, 2.0, 1.0) 1981 CHECK_VRINT(1.1, 1.0, 1.0, 1.0, 2.0, 1.0)
1977 double inf = std::numeric_limits<double>::infinity(); 1982 double inf = std::numeric_limits<double>::infinity();
1978 CHECK_VRINT(inf, inf, inf, inf, inf, inf) 1983 CHECK_VRINT(inf, inf, inf, inf, inf, inf)
1979 CHECK_VRINT(-inf, -inf, -inf, -inf, -inf, -inf) 1984 CHECK_VRINT(-inf, -inf, -inf, -inf, -inf, -inf)
1980 CHECK_VRINT(-0.0, -0.0, -0.0, -0.0, -0.0, -0.0) 1985 CHECK_VRINT(-0.0, -0.0, -0.0, -0.0, -0.0, -0.0)
1981 1986
1982 // Check NaN propagation. 1987 // Check NaN propagation.
1983 double nan = std::numeric_limits<double>::quiet_NaN(); 1988 double nan = std::numeric_limits<double>::quiet_NaN();
1984 t.input = nan; 1989 t.input = nan;
1985 dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 1990 dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0);
1986 CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.ar)); 1991 CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.ar));
1987 CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.nr)); 1992 CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.nr));
1988 CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.mr)); 1993 CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.mr));
1989 CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.pr)); 1994 CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.pr));
1990 CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.zr)); 1995 CHECK_EQ(bit_cast<int64_t>(nan), bit_cast<int64_t>(t.zr));
1991 1996
1992 #undef CHECK_VRINT 1997 #undef CHECK_VRINT
1993 } 1998 }
1994 } 1999 }
1995 2000
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 HandleScope scope(isolate); 2050 HandleScope scope(isolate);
2046 2051
2047 Assembler assm(isolate, NULL, 0); 2052 Assembler assm(isolate, NULL, 0);
2048 __ mov(r0, Operand(isolate->factory()->infinity_value())); 2053 __ mov(r0, Operand(isolate->factory()->infinity_value()));
2049 __ BlockConstPoolFor(1019); 2054 __ BlockConstPoolFor(1019);
2050 for (int i = 0; i < 1019; ++i) __ nop(); 2055 for (int i = 0; i < 1019; ++i) __ nop();
2051 __ vldr(d0, MemOperand(r0, 0)); 2056 __ vldr(d0, MemOperand(r0, 0));
2052 } 2057 }
2053 2058
2054 #undef __ 2059 #undef __
OLDNEW
« no previous file with comments | « src/x87/simulator-x87.h ('k') | test/cctest/test-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698