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

Side by Side Diff: test/cctest/test-macro-assembler-x64.cc

Issue 2900683002: [compiler] Delay allocation of code-embedded heap numbers. (Closed)
Patch Set: Fix rebase. Created 3 years, 6 months 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 | « test/cctest/test-macro-assembler-mips64.cc ('k') | test/cctest/test-run-wasm-relocation-arm.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 TestMoveSmi(masm, &exit, 10, Smi::FromInt(-256)); 189 TestMoveSmi(masm, &exit, 10, Smi::FromInt(-256));
190 TestMoveSmi(masm, &exit, 11, Smi::FromInt(-257)); 190 TestMoveSmi(masm, &exit, 11, Smi::FromInt(-257));
191 TestMoveSmi(masm, &exit, 12, Smi::FromInt(Smi::kMinValue)); 191 TestMoveSmi(masm, &exit, 12, Smi::FromInt(Smi::kMinValue));
192 192
193 __ xorq(rax, rax); // Success. 193 __ xorq(rax, rax); // Success.
194 __ bind(&exit); 194 __ bind(&exit);
195 ExitCode(masm); 195 ExitCode(masm);
196 __ ret(0); 196 __ ret(0);
197 197
198 CodeDesc desc; 198 CodeDesc desc;
199 masm->GetCode(&desc); 199 masm->GetCode(isolate, &desc);
200 // Call the function from C++. 200 // Call the function from C++.
201 int result = FUNCTION_CAST<F0>(buffer)(); 201 int result = FUNCTION_CAST<F0>(buffer)();
202 CHECK_EQ(0, result); 202 CHECK_EQ(0, result);
203 } 203 }
204 204
205 205
206 void TestSmiCompare(MacroAssembler* masm, Label* exit, int id, int x, int y) { 206 void TestSmiCompare(MacroAssembler* masm, Label* exit, int id, int x, int y) {
207 __ Move(rcx, Smi::FromInt(x)); 207 __ Move(rcx, Smi::FromInt(x));
208 __ movq(r8, rcx); 208 __ movq(r8, rcx);
209 __ Move(rdx, Smi::FromInt(y)); 209 __ Move(rdx, Smi::FromInt(y));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 TestSmiCompare(masm, &exit, 0x110, Smi::kMinValue, Smi::kMaxValue); 283 TestSmiCompare(masm, &exit, 0x110, Smi::kMinValue, Smi::kMaxValue);
284 TestSmiCompare(masm, &exit, 0x120, Smi::kMaxValue, Smi::kMinValue); 284 TestSmiCompare(masm, &exit, 0x120, Smi::kMaxValue, Smi::kMinValue);
285 TestSmiCompare(masm, &exit, 0x130, Smi::kMaxValue, Smi::kMaxValue); 285 TestSmiCompare(masm, &exit, 0x130, Smi::kMaxValue, Smi::kMaxValue);
286 286
287 __ xorq(rax, rax); // Success. 287 __ xorq(rax, rax); // Success.
288 __ bind(&exit); 288 __ bind(&exit);
289 ExitCode(masm); 289 ExitCode(masm);
290 __ ret(0); 290 __ ret(0);
291 291
292 CodeDesc desc; 292 CodeDesc desc;
293 masm->GetCode(&desc); 293 masm->GetCode(isolate, &desc);
294 // Call the function from C++. 294 // Call the function from C++.
295 int result = FUNCTION_CAST<F0>(buffer)(); 295 int result = FUNCTION_CAST<F0>(buffer)();
296 CHECK_EQ(0, result); 296 CHECK_EQ(0, result);
297 } 297 }
298 298
299 299
300 300
301 TEST(Integer32ToSmi) { 301 TEST(Integer32ToSmi) {
302 // Allocate an executable page of memory. 302 // Allocate an executable page of memory.
303 size_t actual_size; 303 size_t actual_size;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 __ cmpq(r8, rdx); 385 __ cmpq(r8, rdx);
386 __ j(not_equal, &exit); 386 __ j(not_equal, &exit);
387 387
388 388
389 __ xorq(rax, rax); // Success. 389 __ xorq(rax, rax); // Success.
390 __ bind(&exit); 390 __ bind(&exit);
391 ExitCode(masm); 391 ExitCode(masm);
392 __ ret(0); 392 __ ret(0);
393 393
394 CodeDesc desc; 394 CodeDesc desc;
395 masm->GetCode(&desc); 395 masm->GetCode(isolate, &desc);
396 // Call the function from C++. 396 // Call the function from C++.
397 int result = FUNCTION_CAST<F0>(buffer)(); 397 int result = FUNCTION_CAST<F0>(buffer)();
398 CHECK_EQ(0, result); 398 CHECK_EQ(0, result);
399 } 399 }
400 400
401 401
402 void TestI64PlusConstantToSmi(MacroAssembler* masm, 402 void TestI64PlusConstantToSmi(MacroAssembler* masm,
403 Label* exit, 403 Label* exit,
404 int id, 404 int id,
405 int64_t x, 405 int64_t x,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 TestI64PlusConstantToSmi(masm, &exit, 0xA0, Smi::kMinValue, 0); 454 TestI64PlusConstantToSmi(masm, &exit, 0xA0, Smi::kMinValue, 0);
455 TestI64PlusConstantToSmi(masm, &exit, 0xB0, Smi::kMaxValue, 0); 455 TestI64PlusConstantToSmi(masm, &exit, 0xB0, Smi::kMaxValue, 0);
456 TestI64PlusConstantToSmi(masm, &exit, 0xC0, twice_max, Smi::kMinValue); 456 TestI64PlusConstantToSmi(masm, &exit, 0xC0, twice_max, Smi::kMinValue);
457 457
458 __ xorq(rax, rax); // Success. 458 __ xorq(rax, rax); // Success.
459 __ bind(&exit); 459 __ bind(&exit);
460 ExitCode(masm); 460 ExitCode(masm);
461 __ ret(0); 461 __ ret(0);
462 462
463 CodeDesc desc; 463 CodeDesc desc;
464 masm->GetCode(&desc); 464 masm->GetCode(isolate, &desc);
465 // Call the function from C++. 465 // Call the function from C++.
466 int result = FUNCTION_CAST<F0>(buffer)(); 466 int result = FUNCTION_CAST<F0>(buffer)();
467 CHECK_EQ(0, result); 467 CHECK_EQ(0, result);
468 } 468 }
469 469
470 470
471 TEST(SmiCheck) { 471 TEST(SmiCheck) {
472 // Allocate an executable page of memory. 472 // Allocate an executable page of memory.
473 size_t actual_size; 473 size_t actual_size;
474 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 474 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 __ j(NegateCondition(cond), &exit); 627 __ j(NegateCondition(cond), &exit);
628 628
629 // Success 629 // Success
630 __ xorq(rax, rax); 630 __ xorq(rax, rax);
631 631
632 __ bind(&exit); 632 __ bind(&exit);
633 ExitCode(masm); 633 ExitCode(masm);
634 __ ret(0); 634 __ ret(0);
635 635
636 CodeDesc desc; 636 CodeDesc desc;
637 masm->GetCode(&desc); 637 masm->GetCode(isolate, &desc);
638 // Call the function from C++. 638 // Call the function from C++.
639 int result = FUNCTION_CAST<F0>(buffer)(); 639 int result = FUNCTION_CAST<F0>(buffer)();
640 CHECK_EQ(0, result); 640 CHECK_EQ(0, result);
641 } 641 }
642 642
643 643
644 644
645 void TestSmiNeg(MacroAssembler* masm, Label* exit, int id, int x) { 645 void TestSmiNeg(MacroAssembler* masm, Label* exit, int id, int x) {
646 __ Move(rcx, Smi::FromInt(x)); 646 __ Move(rcx, Smi::FromInt(x));
647 __ movq(r11, rcx); 647 __ movq(r11, rcx);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 TestSmiNeg(masm, &exit, 0x60, Smi::kMinValue); 711 TestSmiNeg(masm, &exit, 0x60, Smi::kMinValue);
712 TestSmiNeg(masm, &exit, 0x70, Smi::kMaxValue); 712 TestSmiNeg(masm, &exit, 0x70, Smi::kMaxValue);
713 TestSmiNeg(masm, &exit, 0x80, -Smi::kMaxValue); 713 TestSmiNeg(masm, &exit, 0x80, -Smi::kMaxValue);
714 714
715 __ xorq(rax, rax); // Success. 715 __ xorq(rax, rax); // Success.
716 __ bind(&exit); 716 __ bind(&exit);
717 ExitCode(masm); 717 ExitCode(masm);
718 __ ret(0); 718 __ ret(0);
719 719
720 CodeDesc desc; 720 CodeDesc desc;
721 masm->GetCode(&desc); 721 masm->GetCode(isolate, &desc);
722 // Call the function from C++. 722 // Call the function from C++.
723 int result = FUNCTION_CAST<F0>(buffer)(); 723 int result = FUNCTION_CAST<F0>(buffer)();
724 CHECK_EQ(0, result); 724 CHECK_EQ(0, result);
725 } 725 }
726 726
727 727
728 static void SmiAddTest(MacroAssembler* masm, 728 static void SmiAddTest(MacroAssembler* masm,
729 Label* exit, 729 Label* exit,
730 int id, 730 int id,
731 int first, 731 int first,
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 SmiAddOverflowTest(masm, &exit, 0xD0, -2); 932 SmiAddOverflowTest(masm, &exit, 0xD0, -2);
933 SmiAddOverflowTest(masm, &exit, 0xE0, -42000); 933 SmiAddOverflowTest(masm, &exit, 0xE0, -42000);
934 SmiAddOverflowTest(masm, &exit, 0xF0, Smi::kMinValue); 934 SmiAddOverflowTest(masm, &exit, 0xF0, Smi::kMinValue);
935 935
936 __ xorq(rax, rax); // Success. 936 __ xorq(rax, rax); // Success.
937 __ bind(&exit); 937 __ bind(&exit);
938 ExitCode(masm); 938 ExitCode(masm);
939 __ ret(0); 939 __ ret(0);
940 940
941 CodeDesc desc; 941 CodeDesc desc;
942 masm->GetCode(&desc); 942 masm->GetCode(isolate, &desc);
943 // Call the function from C++. 943 // Call the function from C++.
944 int result = FUNCTION_CAST<F0>(buffer)(); 944 int result = FUNCTION_CAST<F0>(buffer)();
945 CHECK_EQ(0, result); 945 CHECK_EQ(0, result);
946 } 946 }
947 947
948 948
949 static void SmiSubTest(MacroAssembler* masm, 949 static void SmiSubTest(MacroAssembler* masm,
950 Label* exit, 950 Label* exit,
951 int id, 951 int id,
952 int first, 952 int first,
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 SmiSubOverflowTest(masm, &exit, 0xE0, -42000); 1149 SmiSubOverflowTest(masm, &exit, 0xE0, -42000);
1150 SmiSubOverflowTest(masm, &exit, 0xF0, Smi::kMinValue); 1150 SmiSubOverflowTest(masm, &exit, 0xF0, Smi::kMinValue);
1151 SmiSubOverflowTest(masm, &exit, 0x100, 0); 1151 SmiSubOverflowTest(masm, &exit, 0x100, 0);
1152 1152
1153 __ xorq(rax, rax); // Success. 1153 __ xorq(rax, rax); // Success.
1154 __ bind(&exit); 1154 __ bind(&exit);
1155 ExitCode(masm); 1155 ExitCode(masm);
1156 __ ret(0); 1156 __ ret(0);
1157 1157
1158 CodeDesc desc; 1158 CodeDesc desc;
1159 masm->GetCode(&desc); 1159 masm->GetCode(isolate, &desc);
1160 // Call the function from C++. 1160 // Call the function from C++.
1161 int result = FUNCTION_CAST<F0>(buffer)(); 1161 int result = FUNCTION_CAST<F0>(buffer)();
1162 CHECK_EQ(0, result); 1162 CHECK_EQ(0, result);
1163 } 1163 }
1164 1164
1165 1165
1166 1166
1167 void TestSmiMul(MacroAssembler* masm, Label* exit, int id, int x, int y) { 1167 void TestSmiMul(MacroAssembler* masm, Label* exit, int id, int x, int y) {
1168 int64_t result = static_cast<int64_t>(x) * static_cast<int64_t>(y); 1168 int64_t result = static_cast<int64_t>(x) * static_cast<int64_t>(y);
1169 bool negative_zero = (result == 0) && (x < 0 || y < 0); 1169 bool negative_zero = (result == 0) && (x < 0 || y < 0);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 TestSmiMul(masm, &exit, 0xc0, (Smi::kMaxValue / 2) + 1, 2); 1235 TestSmiMul(masm, &exit, 0xc0, (Smi::kMaxValue / 2) + 1, 2);
1236 TestSmiMul(masm, &exit, 0xd0, (Smi::kMinValue / 2), 2); 1236 TestSmiMul(masm, &exit, 0xd0, (Smi::kMinValue / 2), 2);
1237 TestSmiMul(masm, &exit, 0xe0, (Smi::kMinValue / 2) - 1, 2); 1237 TestSmiMul(masm, &exit, 0xe0, (Smi::kMinValue / 2) - 1, 2);
1238 1238
1239 __ xorq(rax, rax); // Success. 1239 __ xorq(rax, rax); // Success.
1240 __ bind(&exit); 1240 __ bind(&exit);
1241 ExitCode(masm); 1241 ExitCode(masm);
1242 __ ret(0); 1242 __ ret(0);
1243 1243
1244 CodeDesc desc; 1244 CodeDesc desc;
1245 masm->GetCode(&desc); 1245 masm->GetCode(isolate, &desc);
1246 // Call the function from C++. 1246 // Call the function from C++.
1247 int result = FUNCTION_CAST<F0>(buffer)(); 1247 int result = FUNCTION_CAST<F0>(buffer)();
1248 CHECK_EQ(0, result); 1248 CHECK_EQ(0, result);
1249 } 1249 }
1250 1250
1251 1251
1252 void TestSmiDiv(MacroAssembler* masm, Label* exit, int id, int x, int y) { 1252 void TestSmiDiv(MacroAssembler* masm, Label* exit, int id, int x, int y) {
1253 bool division_by_zero = (y == 0); 1253 bool division_by_zero = (y == 0);
1254 bool negative_zero = (x == 0 && y < 0); 1254 bool negative_zero = (x == 0 && y < 0);
1255 #if V8_TARGET_ARCH_X64 1255 #if V8_TARGET_ARCH_X64
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 1350
1351 __ xorq(r15, r15); // Success. 1351 __ xorq(r15, r15); // Success.
1352 __ bind(&exit); 1352 __ bind(&exit);
1353 __ movq(rax, r15); 1353 __ movq(rax, r15);
1354 __ popq(r15); 1354 __ popq(r15);
1355 __ popq(r14); 1355 __ popq(r14);
1356 ExitCode(masm); 1356 ExitCode(masm);
1357 __ ret(0); 1357 __ ret(0);
1358 1358
1359 CodeDesc desc; 1359 CodeDesc desc;
1360 masm->GetCode(&desc); 1360 masm->GetCode(isolate, &desc);
1361 // Call the function from C++. 1361 // Call the function from C++.
1362 int result = FUNCTION_CAST<F0>(buffer)(); 1362 int result = FUNCTION_CAST<F0>(buffer)();
1363 CHECK_EQ(0, result); 1363 CHECK_EQ(0, result);
1364 } 1364 }
1365 1365
1366 1366
1367 void TestSmiMod(MacroAssembler* masm, Label* exit, int id, int x, int y) { 1367 void TestSmiMod(MacroAssembler* masm, Label* exit, int id, int x, int y) {
1368 bool division_by_zero = (y == 0); 1368 bool division_by_zero = (y == 0);
1369 bool division_overflow = (x == Smi::kMinValue) && (y == -1); 1369 bool division_overflow = (x == Smi::kMinValue) && (y == -1);
1370 bool fraction = !division_by_zero && !division_overflow && ((x % y) != 0); 1370 bool fraction = !division_by_zero && !division_overflow && ((x % y) != 0);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 1458
1459 __ xorq(r15, r15); // Success. 1459 __ xorq(r15, r15); // Success.
1460 __ bind(&exit); 1460 __ bind(&exit);
1461 __ movq(rax, r15); 1461 __ movq(rax, r15);
1462 __ popq(r15); 1462 __ popq(r15);
1463 __ popq(r14); 1463 __ popq(r14);
1464 ExitCode(masm); 1464 ExitCode(masm);
1465 __ ret(0); 1465 __ ret(0);
1466 1466
1467 CodeDesc desc; 1467 CodeDesc desc;
1468 masm->GetCode(&desc); 1468 masm->GetCode(isolate, &desc);
1469 // Call the function from C++. 1469 // Call the function from C++.
1470 int result = FUNCTION_CAST<F0>(buffer)(); 1470 int result = FUNCTION_CAST<F0>(buffer)();
1471 CHECK_EQ(0, result); 1471 CHECK_EQ(0, result);
1472 } 1472 }
1473 1473
1474 1474
1475 void TestSmiIndex(MacroAssembler* masm, Label* exit, int id, int x) { 1475 void TestSmiIndex(MacroAssembler* masm, Label* exit, int id, int x) {
1476 __ movl(rax, Immediate(id)); 1476 __ movl(rax, Immediate(id));
1477 1477
1478 for (int i = 0; i < 8; i++) { 1478 for (int i = 0; i < 8; i++) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 TestSmiIndex(masm, &exit, 0x30, 100); 1533 TestSmiIndex(masm, &exit, 0x30, 100);
1534 TestSmiIndex(masm, &exit, 0x40, 1000); 1534 TestSmiIndex(masm, &exit, 0x40, 1000);
1535 TestSmiIndex(masm, &exit, 0x50, Smi::kMaxValue); 1535 TestSmiIndex(masm, &exit, 0x50, Smi::kMaxValue);
1536 1536
1537 __ xorq(rax, rax); // Success. 1537 __ xorq(rax, rax); // Success.
1538 __ bind(&exit); 1538 __ bind(&exit);
1539 ExitCode(masm); 1539 ExitCode(masm);
1540 __ ret(0); 1540 __ ret(0);
1541 1541
1542 CodeDesc desc; 1542 CodeDesc desc;
1543 masm->GetCode(&desc); 1543 masm->GetCode(isolate, &desc);
1544 // Call the function from C++. 1544 // Call the function from C++.
1545 int result = FUNCTION_CAST<F0>(buffer)(); 1545 int result = FUNCTION_CAST<F0>(buffer)();
1546 CHECK_EQ(0, result); 1546 CHECK_EQ(0, result);
1547 } 1547 }
1548 1548
1549 1549
1550 void TestSelectNonSmi(MacroAssembler* masm, Label* exit, int id, int x, int y) { 1550 void TestSelectNonSmi(MacroAssembler* masm, Label* exit, int id, int x, int y) {
1551 __ movl(rax, Immediate(id)); 1551 __ movl(rax, Immediate(id));
1552 __ Move(rcx, Smi::FromInt(x)); 1552 __ Move(rcx, Smi::FromInt(x));
1553 __ Move(rdx, Smi::FromInt(y)); 1553 __ Move(rdx, Smi::FromInt(y));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 TestSelectNonSmi(masm, &exit, 0x70, 1, 1); 1604 TestSelectNonSmi(masm, &exit, 0x70, 1, 1);
1605 TestSelectNonSmi(masm, &exit, 0x80, Smi::kMinValue, Smi::kMaxValue); 1605 TestSelectNonSmi(masm, &exit, 0x80, Smi::kMinValue, Smi::kMaxValue);
1606 TestSelectNonSmi(masm, &exit, 0x90, Smi::kMinValue, Smi::kMinValue); 1606 TestSelectNonSmi(masm, &exit, 0x90, Smi::kMinValue, Smi::kMinValue);
1607 1607
1608 __ xorq(rax, rax); // Success. 1608 __ xorq(rax, rax); // Success.
1609 __ bind(&exit); 1609 __ bind(&exit);
1610 ExitCode(masm); 1610 ExitCode(masm);
1611 __ ret(0); 1611 __ ret(0);
1612 1612
1613 CodeDesc desc; 1613 CodeDesc desc;
1614 masm->GetCode(&desc); 1614 masm->GetCode(isolate, &desc);
1615 // Call the function from C++. 1615 // Call the function from C++.
1616 int result = FUNCTION_CAST<F0>(buffer)(); 1616 int result = FUNCTION_CAST<F0>(buffer)();
1617 CHECK_EQ(0, result); 1617 CHECK_EQ(0, result);
1618 } 1618 }
1619 1619
1620 1620
1621 void TestSmiAnd(MacroAssembler* masm, Label* exit, int id, int x, int y) { 1621 void TestSmiAnd(MacroAssembler* masm, Label* exit, int id, int x, int y) {
1622 int result = x & y; 1622 int result = x & y;
1623 1623
1624 __ movl(rax, Immediate(id)); 1624 __ movl(rax, Immediate(id));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 TestSmiAnd(masm, &exit, 0x90, Smi::kMinValue, Smi::kMinValue); 1683 TestSmiAnd(masm, &exit, 0x90, Smi::kMinValue, Smi::kMinValue);
1684 TestSmiAnd(masm, &exit, 0xA0, Smi::kMinValue, -1); 1684 TestSmiAnd(masm, &exit, 0xA0, Smi::kMinValue, -1);
1685 TestSmiAnd(masm, &exit, 0xB0, Smi::kMinValue, -1); 1685 TestSmiAnd(masm, &exit, 0xB0, Smi::kMinValue, -1);
1686 1686
1687 __ xorq(rax, rax); // Success. 1687 __ xorq(rax, rax); // Success.
1688 __ bind(&exit); 1688 __ bind(&exit);
1689 ExitCode(masm); 1689 ExitCode(masm);
1690 __ ret(0); 1690 __ ret(0);
1691 1691
1692 CodeDesc desc; 1692 CodeDesc desc;
1693 masm->GetCode(&desc); 1693 masm->GetCode(isolate, &desc);
1694 // Call the function from C++. 1694 // Call the function from C++.
1695 int result = FUNCTION_CAST<F0>(buffer)(); 1695 int result = FUNCTION_CAST<F0>(buffer)();
1696 CHECK_EQ(0, result); 1696 CHECK_EQ(0, result);
1697 } 1697 }
1698 1698
1699 1699
1700 void TestSmiOr(MacroAssembler* masm, Label* exit, int id, int x, int y) { 1700 void TestSmiOr(MacroAssembler* masm, Label* exit, int id, int x, int y) {
1701 int result = x | y; 1701 int result = x | y;
1702 1702
1703 __ movl(rax, Immediate(id)); 1703 __ movl(rax, Immediate(id));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 TestSmiOr(masm, &exit, 0xB0, 0x05555555, 0x01234567); 1764 TestSmiOr(masm, &exit, 0xB0, 0x05555555, 0x01234567);
1765 TestSmiOr(masm, &exit, 0xC0, 0x05555555, 0x0fedcba9); 1765 TestSmiOr(masm, &exit, 0xC0, 0x05555555, 0x0fedcba9);
1766 TestSmiOr(masm, &exit, 0xD0, Smi::kMinValue, -1); 1766 TestSmiOr(masm, &exit, 0xD0, Smi::kMinValue, -1);
1767 1767
1768 __ xorq(rax, rax); // Success. 1768 __ xorq(rax, rax); // Success.
1769 __ bind(&exit); 1769 __ bind(&exit);
1770 ExitCode(masm); 1770 ExitCode(masm);
1771 __ ret(0); 1771 __ ret(0);
1772 1772
1773 CodeDesc desc; 1773 CodeDesc desc;
1774 masm->GetCode(&desc); 1774 masm->GetCode(isolate, &desc);
1775 // Call the function from C++. 1775 // Call the function from C++.
1776 int result = FUNCTION_CAST<F0>(buffer)(); 1776 int result = FUNCTION_CAST<F0>(buffer)();
1777 CHECK_EQ(0, result); 1777 CHECK_EQ(0, result);
1778 } 1778 }
1779 1779
1780 1780
1781 void TestSmiXor(MacroAssembler* masm, Label* exit, int id, int x, int y) { 1781 void TestSmiXor(MacroAssembler* masm, Label* exit, int id, int x, int y) {
1782 int result = x ^ y; 1782 int result = x ^ y;
1783 1783
1784 __ movl(rax, Immediate(id)); 1784 __ movl(rax, Immediate(id));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 TestSmiXor(masm, &exit, 0xB0, 0x5555555, 0x01234567); 1845 TestSmiXor(masm, &exit, 0xB0, 0x5555555, 0x01234567);
1846 TestSmiXor(masm, &exit, 0xC0, 0x5555555, 0x0fedcba9); 1846 TestSmiXor(masm, &exit, 0xC0, 0x5555555, 0x0fedcba9);
1847 TestSmiXor(masm, &exit, 0xD0, Smi::kMinValue, -1); 1847 TestSmiXor(masm, &exit, 0xD0, Smi::kMinValue, -1);
1848 1848
1849 __ xorq(rax, rax); // Success. 1849 __ xorq(rax, rax); // Success.
1850 __ bind(&exit); 1850 __ bind(&exit);
1851 ExitCode(masm); 1851 ExitCode(masm);
1852 __ ret(0); 1852 __ ret(0);
1853 1853
1854 CodeDesc desc; 1854 CodeDesc desc;
1855 masm->GetCode(&desc); 1855 masm->GetCode(isolate, &desc);
1856 // Call the function from C++. 1856 // Call the function from C++.
1857 int result = FUNCTION_CAST<F0>(buffer)(); 1857 int result = FUNCTION_CAST<F0>(buffer)();
1858 CHECK_EQ(0, result); 1858 CHECK_EQ(0, result);
1859 } 1859 }
1860 1860
1861 1861
1862 void TestSmiNot(MacroAssembler* masm, Label* exit, int id, int x) { 1862 void TestSmiNot(MacroAssembler* masm, Label* exit, int id, int x) {
1863 int result = ~x; 1863 int result = ~x;
1864 __ movl(rax, Immediate(id)); 1864 __ movl(rax, Immediate(id));
1865 1865
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 TestSmiNot(masm, &exit, 0x60, Smi::kMinValue); 1905 TestSmiNot(masm, &exit, 0x60, Smi::kMinValue);
1906 TestSmiNot(masm, &exit, 0x70, Smi::kMaxValue); 1906 TestSmiNot(masm, &exit, 0x70, Smi::kMaxValue);
1907 TestSmiNot(masm, &exit, 0x80, 0x05555555); 1907 TestSmiNot(masm, &exit, 0x80, 0x05555555);
1908 1908
1909 __ xorq(rax, rax); // Success. 1909 __ xorq(rax, rax); // Success.
1910 __ bind(&exit); 1910 __ bind(&exit);
1911 ExitCode(masm); 1911 ExitCode(masm);
1912 __ ret(0); 1912 __ ret(0);
1913 1913
1914 CodeDesc desc; 1914 CodeDesc desc;
1915 masm->GetCode(&desc); 1915 masm->GetCode(isolate, &desc);
1916 // Call the function from C++. 1916 // Call the function from C++.
1917 int result = FUNCTION_CAST<F0>(buffer)(); 1917 int result = FUNCTION_CAST<F0>(buffer)();
1918 CHECK_EQ(0, result); 1918 CHECK_EQ(0, result);
1919 } 1919 }
1920 1920
1921 1921
1922 void TestSmiShiftLeft(MacroAssembler* masm, Label* exit, int id, int x) { 1922 void TestSmiShiftLeft(MacroAssembler* masm, Label* exit, int id, int x) {
1923 const int shifts[] = { 0, 1, 7, 24, kSmiValueSize - 1}; 1923 const int shifts[] = { 0, 1, 7, 24, kSmiValueSize - 1};
1924 const int kNumShifts = 5; 1924 const int kNumShifts = 5;
1925 __ movl(rax, Immediate(id)); 1925 __ movl(rax, Immediate(id));
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 TestSmiShiftLeft(masm, &exit, 0x110, Smi::kMaxValue); 1998 TestSmiShiftLeft(masm, &exit, 0x110, Smi::kMaxValue);
1999 TestSmiShiftLeft(masm, &exit, 0x150, Smi::kMinValue); 1999 TestSmiShiftLeft(masm, &exit, 0x150, Smi::kMinValue);
2000 TestSmiShiftLeft(masm, &exit, 0x190, -1); 2000 TestSmiShiftLeft(masm, &exit, 0x190, -1);
2001 2001
2002 __ xorq(rax, rax); // Success. 2002 __ xorq(rax, rax); // Success.
2003 __ bind(&exit); 2003 __ bind(&exit);
2004 ExitCode(masm); 2004 ExitCode(masm);
2005 __ ret(0); 2005 __ ret(0);
2006 2006
2007 CodeDesc desc; 2007 CodeDesc desc;
2008 masm->GetCode(&desc); 2008 masm->GetCode(isolate, &desc);
2009 // Call the function from C++. 2009 // Call the function from C++.
2010 int result = FUNCTION_CAST<F0>(buffer)(); 2010 int result = FUNCTION_CAST<F0>(buffer)();
2011 CHECK_EQ(0, result); 2011 CHECK_EQ(0, result);
2012 } 2012 }
2013 2013
2014 2014
2015 void TestSmiShiftLogicalRight(MacroAssembler* masm, 2015 void TestSmiShiftLogicalRight(MacroAssembler* masm,
2016 Label* exit, 2016 Label* exit,
2017 int id, 2017 int id,
2018 int x) { 2018 int x) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 TestSmiShiftLogicalRight(masm, &exit, 0x90, Smi::kMaxValue); 2102 TestSmiShiftLogicalRight(masm, &exit, 0x90, Smi::kMaxValue);
2103 TestSmiShiftLogicalRight(masm, &exit, 0xB0, Smi::kMinValue); 2103 TestSmiShiftLogicalRight(masm, &exit, 0xB0, Smi::kMinValue);
2104 TestSmiShiftLogicalRight(masm, &exit, 0xD0, -1); 2104 TestSmiShiftLogicalRight(masm, &exit, 0xD0, -1);
2105 2105
2106 __ xorq(rax, rax); // Success. 2106 __ xorq(rax, rax); // Success.
2107 __ bind(&exit); 2107 __ bind(&exit);
2108 ExitCode(masm); 2108 ExitCode(masm);
2109 __ ret(0); 2109 __ ret(0);
2110 2110
2111 CodeDesc desc; 2111 CodeDesc desc;
2112 masm->GetCode(&desc); 2112 masm->GetCode(isolate, &desc);
2113 // Call the function from C++. 2113 // Call the function from C++.
2114 int result = FUNCTION_CAST<F0>(buffer)(); 2114 int result = FUNCTION_CAST<F0>(buffer)();
2115 CHECK_EQ(0, result); 2115 CHECK_EQ(0, result);
2116 } 2116 }
2117 2117
2118 2118
2119 void TestSmiShiftArithmeticRight(MacroAssembler* masm, 2119 void TestSmiShiftArithmeticRight(MacroAssembler* masm,
2120 Label* exit, 2120 Label* exit,
2121 int id, 2121 int id,
2122 int x) { 2122 int x) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 TestSmiShiftArithmeticRight(masm, &exit, 0x50, Smi::kMaxValue); 2169 TestSmiShiftArithmeticRight(masm, &exit, 0x50, Smi::kMaxValue);
2170 TestSmiShiftArithmeticRight(masm, &exit, 0x60, Smi::kMinValue); 2170 TestSmiShiftArithmeticRight(masm, &exit, 0x60, Smi::kMinValue);
2171 TestSmiShiftArithmeticRight(masm, &exit, 0x70, -1); 2171 TestSmiShiftArithmeticRight(masm, &exit, 0x70, -1);
2172 2172
2173 __ xorq(rax, rax); // Success. 2173 __ xorq(rax, rax); // Success.
2174 __ bind(&exit); 2174 __ bind(&exit);
2175 ExitCode(masm); 2175 ExitCode(masm);
2176 __ ret(0); 2176 __ ret(0);
2177 2177
2178 CodeDesc desc; 2178 CodeDesc desc;
2179 masm->GetCode(&desc); 2179 masm->GetCode(isolate, &desc);
2180 // Call the function from C++. 2180 // Call the function from C++.
2181 int result = FUNCTION_CAST<F0>(buffer)(); 2181 int result = FUNCTION_CAST<F0>(buffer)();
2182 CHECK_EQ(0, result); 2182 CHECK_EQ(0, result);
2183 } 2183 }
2184 2184
2185 2185
2186 void TestPositiveSmiPowerUp(MacroAssembler* masm, Label* exit, int id, int x) { 2186 void TestPositiveSmiPowerUp(MacroAssembler* masm, Label* exit, int id, int x) {
2187 CHECK(x >= 0); 2187 CHECK(x >= 0);
2188 int powers[] = { 0, 1, 2, 3, 8, 16, 24, 31 }; 2188 int powers[] = { 0, 1, 2, 3, 8, 16, 24, 31 };
2189 int power_count = 8; 2189 int power_count = 8;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 TestPositiveSmiPowerUp(masm, &exit, 0x100, 65535); 2233 TestPositiveSmiPowerUp(masm, &exit, 0x100, 65535);
2234 TestPositiveSmiPowerUp(masm, &exit, 0x120, 65536); 2234 TestPositiveSmiPowerUp(masm, &exit, 0x120, 65536);
2235 TestPositiveSmiPowerUp(masm, &exit, 0x140, Smi::kMaxValue); 2235 TestPositiveSmiPowerUp(masm, &exit, 0x140, Smi::kMaxValue);
2236 2236
2237 __ xorq(rax, rax); // Success. 2237 __ xorq(rax, rax); // Success.
2238 __ bind(&exit); 2238 __ bind(&exit);
2239 ExitCode(masm); 2239 ExitCode(masm);
2240 __ ret(0); 2240 __ ret(0);
2241 2241
2242 CodeDesc desc; 2242 CodeDesc desc;
2243 masm->GetCode(&desc); 2243 masm->GetCode(isolate, &desc);
2244 // Call the function from C++. 2244 // Call the function from C++.
2245 int result = FUNCTION_CAST<F0>(buffer)(); 2245 int result = FUNCTION_CAST<F0>(buffer)();
2246 CHECK_EQ(0, result); 2246 CHECK_EQ(0, result);
2247 } 2247 }
2248 2248
2249 2249
2250 TEST(OperandOffset) { 2250 TEST(OperandOffset) {
2251 uint32_t data[256]; 2251 uint32_t data[256];
2252 for (uint32_t i = 0; i < 256; i++) { data[i] = i * 0x01010101; } 2252 for (uint32_t i = 0; i < 256; i++) { data[i] = i * 0x01010101; }
2253 2253
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 __ leaq(rsp, Operand(rbp, kPointerSize)); 2587 __ leaq(rsp, Operand(rbp, kPointerSize));
2588 __ popq(rbp); 2588 __ popq(rbp);
2589 __ popq(rbx); 2589 __ popq(rbx);
2590 __ popq(r14); 2590 __ popq(r14);
2591 __ popq(r13); 2591 __ popq(r13);
2592 ExitCode(masm); 2592 ExitCode(masm);
2593 __ ret(0); 2593 __ ret(0);
2594 2594
2595 2595
2596 CodeDesc desc; 2596 CodeDesc desc;
2597 masm->GetCode(&desc); 2597 masm->GetCode(isolate, &desc);
2598 // Call the function from C++. 2598 // Call the function from C++.
2599 int result = FUNCTION_CAST<F0>(buffer)(); 2599 int result = FUNCTION_CAST<F0>(buffer)();
2600 CHECK_EQ(0, result); 2600 CHECK_EQ(0, result);
2601 } 2601 }
2602 2602
2603 2603
2604 TEST(LoadAndStoreWithRepresentation) { 2604 TEST(LoadAndStoreWithRepresentation) {
2605 // Allocate an executable page of memory. 2605 // Allocate an executable page of memory.
2606 size_t actual_size; 2606 size_t actual_size;
2607 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 2607 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2735 __ cmpq(rcx, rdx); 2735 __ cmpq(rcx, rdx);
2736 __ j(not_equal, &exit); 2736 __ j(not_equal, &exit);
2737 2737
2738 __ xorq(rax, rax); // Success. 2738 __ xorq(rax, rax); // Success.
2739 __ bind(&exit); 2739 __ bind(&exit);
2740 __ addq(rsp, Immediate(1 * kPointerSize)); 2740 __ addq(rsp, Immediate(1 * kPointerSize));
2741 ExitCode(masm); 2741 ExitCode(masm);
2742 __ ret(0); 2742 __ ret(0);
2743 2743
2744 CodeDesc desc; 2744 CodeDesc desc;
2745 masm->GetCode(&desc); 2745 masm->GetCode(isolate, &desc);
2746 // Call the function from C++. 2746 // Call the function from C++.
2747 int result = FUNCTION_CAST<F0>(buffer)(); 2747 int result = FUNCTION_CAST<F0>(buffer)();
2748 CHECK_EQ(0, result); 2748 CHECK_EQ(0, result);
2749 } 2749 }
2750 2750
2751 void TestFloat32x4Abs(MacroAssembler* masm, Label* exit, float x, float y, 2751 void TestFloat32x4Abs(MacroAssembler* masm, Label* exit, float x, float y,
2752 float z, float w) { 2752 float z, float w) {
2753 __ subq(rsp, Immediate(kSimd128Size)); 2753 __ subq(rsp, Immediate(kSimd128Size));
2754 2754
2755 __ Move(xmm1, x); 2755 __ Move(xmm1, x);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2890 TestFloat32x4Neg(masm, &exit, 1.5, -1.5, 0.5, -0.5); 2890 TestFloat32x4Neg(masm, &exit, 1.5, -1.5, 0.5, -0.5);
2891 TestFloat64x2Abs(masm, &exit, 1.75, -1.75); 2891 TestFloat64x2Abs(masm, &exit, 1.75, -1.75);
2892 TestFloat64x2Neg(masm, &exit, 1.75, -1.75); 2892 TestFloat64x2Neg(masm, &exit, 1.75, -1.75);
2893 2893
2894 __ xorq(rax, rax); // Success. 2894 __ xorq(rax, rax); // Success.
2895 __ bind(&exit); 2895 __ bind(&exit);
2896 ExitCode(masm); 2896 ExitCode(masm);
2897 __ ret(0); 2897 __ ret(0);
2898 2898
2899 CodeDesc desc; 2899 CodeDesc desc;
2900 masm->GetCode(&desc); 2900 masm->GetCode(isolate, &desc);
2901 // Call the function from C++. 2901 // Call the function from C++.
2902 int result = FUNCTION_CAST<F0>(buffer)(); 2902 int result = FUNCTION_CAST<F0>(buffer)();
2903 CHECK_EQ(0, result); 2903 CHECK_EQ(0, result);
2904 } 2904 }
2905 2905
2906 #undef __ 2906 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-macro-assembler-mips64.cc ('k') | test/cctest/test-run-wasm-relocation-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698