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

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

Issue 6685088: Merge isolates to bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-log-stack-tracer.cc ('k') | test/cctest/test-mark-compact.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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 __ movl(rax, Immediate(id)); 139 __ movl(rax, Immediate(id));
140 __ Move(rcx, Smi::FromInt(0)); 140 __ Move(rcx, Smi::FromInt(0));
141 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); 141 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0)));
142 __ cmpq(rcx, rdx); 142 __ cmpq(rcx, rdx);
143 __ j(not_equal, exit); 143 __ j(not_equal, exit);
144 } 144 }
145 145
146 146
147 // Test that we can move a Smi value literally into a register. 147 // Test that we can move a Smi value literally into a register.
148 TEST(SmiMove) { 148 TEST(SmiMove) {
149 v8::internal::V8::Initialize(NULL);
149 // Allocate an executable page of memory. 150 // Allocate an executable page of memory.
150 size_t actual_size; 151 size_t actual_size;
151 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 152 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
152 &actual_size, 153 &actual_size,
153 true)); 154 true));
154 CHECK(buffer); 155 CHECK(buffer);
155 HandleScope handles; 156 HandleScope handles;
156 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 157 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
157 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. 158 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
158 masm->set_allow_stub_calls(false); 159 masm->set_allow_stub_calls(false);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 __ j(not_equal, exit); 226 __ j(not_equal, exit);
226 __ incq(rax); 227 __ incq(rax);
227 __ cmpq(rcx, r8); 228 __ cmpq(rcx, r8);
228 __ j(not_equal, exit); 229 __ j(not_equal, exit);
229 } 230 }
230 } 231 }
231 232
232 233
233 // Test that we can compare smis for equality (and more). 234 // Test that we can compare smis for equality (and more).
234 TEST(SmiCompare) { 235 TEST(SmiCompare) {
235 v8::V8::Initialize(); 236 v8::internal::V8::Initialize(NULL);
236 // Allocate an executable page of memory. 237 // Allocate an executable page of memory.
237 size_t actual_size; 238 size_t actual_size;
238 byte* buffer = 239 byte* buffer =
239 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 240 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
240 &actual_size, 241 &actual_size,
241 true)); 242 true));
242 CHECK(buffer); 243 CHECK(buffer);
243 HandleScope handles; 244 HandleScope handles;
244 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 245 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
245 246
(...skipping 30 matching lines...) Expand all
276 CodeDesc desc; 277 CodeDesc desc;
277 masm->GetCode(&desc); 278 masm->GetCode(&desc);
278 // Call the function from C++. 279 // Call the function from C++.
279 int result = FUNCTION_CAST<F0>(buffer)(); 280 int result = FUNCTION_CAST<F0>(buffer)();
280 CHECK_EQ(0, result); 281 CHECK_EQ(0, result);
281 } 282 }
282 283
283 284
284 285
285 TEST(Integer32ToSmi) { 286 TEST(Integer32ToSmi) {
287 v8::internal::V8::Initialize(NULL);
286 // Allocate an executable page of memory. 288 // Allocate an executable page of memory.
287 size_t actual_size; 289 size_t actual_size;
288 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 290 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
289 &actual_size, 291 &actual_size,
290 true)); 292 true));
291 CHECK(buffer); 293 CHECK(buffer);
292 HandleScope handles; 294 HandleScope handles;
293 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 295 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
294 296
295 MacroAssembler* masm = &assembler; 297 MacroAssembler* masm = &assembler;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 __ j(not_equal, exit); 405 __ j(not_equal, exit);
404 406
405 __ incq(rax); 407 __ incq(rax);
406 __ Integer64PlusConstantToSmi(rcx, rcx, y); 408 __ Integer64PlusConstantToSmi(rcx, rcx, y);
407 __ cmpq(rcx, r8); 409 __ cmpq(rcx, r8);
408 __ j(not_equal, exit); 410 __ j(not_equal, exit);
409 } 411 }
410 412
411 413
412 TEST(Integer64PlusConstantToSmi) { 414 TEST(Integer64PlusConstantToSmi) {
415 v8::internal::V8::Initialize(NULL);
413 // Allocate an executable page of memory. 416 // Allocate an executable page of memory.
414 size_t actual_size; 417 size_t actual_size;
415 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 418 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
416 &actual_size, 419 &actual_size,
417 true)); 420 true));
418 CHECK(buffer); 421 CHECK(buffer);
419 HandleScope handles; 422 HandleScope handles;
420 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 423 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
421 424
422 MacroAssembler* masm = &assembler; 425 MacroAssembler* masm = &assembler;
(...skipping 23 matching lines...) Expand all
446 449
447 CodeDesc desc; 450 CodeDesc desc;
448 masm->GetCode(&desc); 451 masm->GetCode(&desc);
449 // Call the function from C++. 452 // Call the function from C++.
450 int result = FUNCTION_CAST<F0>(buffer)(); 453 int result = FUNCTION_CAST<F0>(buffer)();
451 CHECK_EQ(0, result); 454 CHECK_EQ(0, result);
452 } 455 }
453 456
454 457
455 TEST(SmiCheck) { 458 TEST(SmiCheck) {
459 v8::internal::V8::Initialize(NULL);
456 // Allocate an executable page of memory. 460 // Allocate an executable page of memory.
457 size_t actual_size; 461 size_t actual_size;
458 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 462 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
459 &actual_size, 463 &actual_size,
460 true)); 464 true));
461 CHECK(buffer); 465 CHECK(buffer);
462 HandleScope handles; 466 HandleScope handles;
463 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 467 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
464 468
465 MacroAssembler* masm = &assembler; 469 MacroAssembler* masm = &assembler;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 __ jmp(exit); 696 __ jmp(exit);
693 __ bind(&smi_ok2); 697 __ bind(&smi_ok2);
694 __ incq(rax); 698 __ incq(rax);
695 __ cmpq(rcx, r8); 699 __ cmpq(rcx, r8);
696 __ j(not_equal, exit); 700 __ j(not_equal, exit);
697 } 701 }
698 } 702 }
699 703
700 704
701 TEST(SmiNeg) { 705 TEST(SmiNeg) {
706 v8::internal::V8::Initialize(NULL);
702 // Allocate an executable page of memory. 707 // Allocate an executable page of memory.
703 size_t actual_size; 708 size_t actual_size;
704 byte* buffer = 709 byte* buffer =
705 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 710 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
706 &actual_size, 711 &actual_size,
707 true)); 712 true));
708 CHECK(buffer); 713 CHECK(buffer);
709 HandleScope handles; 714 HandleScope handles;
710 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 715 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
711 716
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 __ cmpq(r9, r8); 785 __ cmpq(r9, r8);
781 __ j(not_equal, exit); 786 __ j(not_equal, exit);
782 787
783 __ incq(rax); 788 __ incq(rax);
784 __ SmiAddConstant(rcx, rcx, Smi::FromInt(second), exit); 789 __ SmiAddConstant(rcx, rcx, Smi::FromInt(second), exit);
785 __ cmpq(rcx, r8); 790 __ cmpq(rcx, r8);
786 __ j(not_equal, exit); 791 __ j(not_equal, exit);
787 } 792 }
788 793
789 TEST(SmiAdd) { 794 TEST(SmiAdd) {
795 v8::internal::V8::Initialize(NULL);
790 // Allocate an executable page of memory. 796 // Allocate an executable page of memory.
791 size_t actual_size; 797 size_t actual_size;
792 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 798 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
793 &actual_size, 799 &actual_size,
794 true)); 800 true));
795 CHECK(buffer); 801 CHECK(buffer);
796 HandleScope handles; 802 HandleScope handles;
797 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 803 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
798 804
799 MacroAssembler* masm = &assembler; 805 MacroAssembler* masm = &assembler;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 __ jmp(exit); 974 __ jmp(exit);
969 __ bind(&overflow_ok); 975 __ bind(&overflow_ok);
970 __ incq(rax); 976 __ incq(rax);
971 __ cmpq(rcx, r11); 977 __ cmpq(rcx, r11);
972 __ j(not_equal, exit); 978 __ j(not_equal, exit);
973 } 979 }
974 } 980 }
975 981
976 982
977 TEST(SmiSub) { 983 TEST(SmiSub) {
984 v8::internal::V8::Initialize(NULL);
978 // Allocate an executable page of memory. 985 // Allocate an executable page of memory.
979 size_t actual_size; 986 size_t actual_size;
980 byte* buffer = 987 byte* buffer =
981 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 988 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
982 &actual_size, 989 &actual_size,
983 true)); 990 true));
984 CHECK(buffer); 991 CHECK(buffer);
985 HandleScope handles; 992 HandleScope handles;
986 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 993 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
987 994
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 __ bind(&overflow_ok2); 1065 __ bind(&overflow_ok2);
1059 // 31-bit version doesn't preserve rcx on failure. 1066 // 31-bit version doesn't preserve rcx on failure.
1060 // __ incq(rax); 1067 // __ incq(rax);
1061 // __ cmpq(r11, rcx); 1068 // __ cmpq(r11, rcx);
1062 // __ j(not_equal, exit); 1069 // __ j(not_equal, exit);
1063 } 1070 }
1064 } 1071 }
1065 1072
1066 1073
1067 TEST(SmiMul) { 1074 TEST(SmiMul) {
1075 v8::internal::V8::Initialize(NULL);
1068 // Allocate an executable page of memory. 1076 // Allocate an executable page of memory.
1069 size_t actual_size; 1077 size_t actual_size;
1070 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1078 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1071 &actual_size, 1079 &actual_size,
1072 true)); 1080 true));
1073 CHECK(buffer); 1081 CHECK(buffer);
1074 HandleScope handles; 1082 HandleScope handles;
1075 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 1083 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1076 1084
1077 MacroAssembler* masm = &assembler; 1085 MacroAssembler* masm = &assembler;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 __ bind(&fail_ok2); 1170 __ bind(&fail_ok2);
1163 1171
1164 __ incq(r15); 1172 __ incq(r15);
1165 __ cmpq(rcx, r11); 1173 __ cmpq(rcx, r11);
1166 __ j(not_equal, exit); 1174 __ j(not_equal, exit);
1167 } 1175 }
1168 } 1176 }
1169 1177
1170 1178
1171 TEST(SmiDiv) { 1179 TEST(SmiDiv) {
1180 v8::internal::V8::Initialize(NULL);
1172 // Allocate an executable page of memory. 1181 // Allocate an executable page of memory.
1173 size_t actual_size; 1182 size_t actual_size;
1174 byte* buffer = 1183 byte* buffer =
1175 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1184 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1176 &actual_size, 1185 &actual_size,
1177 true)); 1186 true));
1178 CHECK(buffer); 1187 CHECK(buffer);
1179 HandleScope handles; 1188 HandleScope handles;
1180 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 1189 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1181 1190
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 __ bind(&fail_ok2); 1280 __ bind(&fail_ok2);
1272 1281
1273 __ incq(r15); 1282 __ incq(r15);
1274 __ cmpq(rcx, r11); 1283 __ cmpq(rcx, r11);
1275 __ j(not_equal, exit); 1284 __ j(not_equal, exit);
1276 } 1285 }
1277 } 1286 }
1278 1287
1279 1288
1280 TEST(SmiMod) { 1289 TEST(SmiMod) {
1290 v8::internal::V8::Initialize(NULL);
1281 // Allocate an executable page of memory. 1291 // Allocate an executable page of memory.
1282 size_t actual_size; 1292 size_t actual_size;
1283 byte* buffer = 1293 byte* buffer =
1284 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1294 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1285 &actual_size, 1295 &actual_size,
1286 true)); 1296 true));
1287 CHECK(buffer); 1297 CHECK(buffer);
1288 HandleScope handles; 1298 HandleScope handles;
1289 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 1299 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1290 1300
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 ASSERT(index.reg.is(rcx)); 1376 ASSERT(index.reg.is(rcx));
1367 __ shl(rcx, Immediate(index.scale)); 1377 __ shl(rcx, Immediate(index.scale));
1368 __ Set(r8, static_cast<intptr_t>(-x) << i); 1378 __ Set(r8, static_cast<intptr_t>(-x) << i);
1369 __ cmpq(rcx, r8); 1379 __ cmpq(rcx, r8);
1370 __ j(not_equal, exit); 1380 __ j(not_equal, exit);
1371 __ incq(rax); 1381 __ incq(rax);
1372 } 1382 }
1373 } 1383 }
1374 1384
1375 TEST(SmiIndex) { 1385 TEST(SmiIndex) {
1386 v8::internal::V8::Initialize(NULL);
1376 // Allocate an executable page of memory. 1387 // Allocate an executable page of memory.
1377 size_t actual_size; 1388 size_t actual_size;
1378 byte* buffer = 1389 byte* buffer =
1379 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, 1390 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
1380 &actual_size, 1391 &actual_size,
1381 true)); 1392 true));
1382 CHECK(buffer); 1393 CHECK(buffer);
1383 HandleScope handles; 1394 HandleScope handles;
1384 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 1395 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1385 1396
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 __ Move(rdx, Smi::FromInt(y)); 1445 __ Move(rdx, Smi::FromInt(y));
1435 __ xor_(rcx, Immediate(kSmiTagMask)); 1446 __ xor_(rcx, Immediate(kSmiTagMask));
1436 __ xor_(rdx, Immediate(kSmiTagMask)); 1447 __ xor_(rdx, Immediate(kSmiTagMask));
1437 __ SelectNonSmi(r9, rcx, rdx, &fail_ok); 1448 __ SelectNonSmi(r9, rcx, rdx, &fail_ok);
1438 __ jmp(exit); 1449 __ jmp(exit);
1439 __ bind(&fail_ok); 1450 __ bind(&fail_ok);
1440 } 1451 }
1441 1452
1442 1453
1443 TEST(SmiSelectNonSmi) { 1454 TEST(SmiSelectNonSmi) {
1455 v8::internal::V8::Initialize(NULL);
1444 // Allocate an executable page of memory. 1456 // Allocate an executable page of memory.
1445 size_t actual_size; 1457 size_t actual_size;
1446 byte* buffer = 1458 byte* buffer =
1447 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1459 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1448 &actual_size, 1460 &actual_size,
1449 true)); 1461 true));
1450 CHECK(buffer); 1462 CHECK(buffer);
1451 HandleScope handles; 1463 HandleScope handles;
1452 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 1464 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1453 1465
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 __ j(not_equal, exit); 1524 __ j(not_equal, exit);
1513 1525
1514 __ incq(rax); 1526 __ incq(rax);
1515 __ SmiAndConstant(rcx, rcx, Smi::FromInt(y)); 1527 __ SmiAndConstant(rcx, rcx, Smi::FromInt(y));
1516 __ cmpq(r8, rcx); 1528 __ cmpq(r8, rcx);
1517 __ j(not_equal, exit); 1529 __ j(not_equal, exit);
1518 } 1530 }
1519 1531
1520 1532
1521 TEST(SmiAnd) { 1533 TEST(SmiAnd) {
1534 v8::internal::V8::Initialize(NULL);
1522 // Allocate an executable page of memory. 1535 // Allocate an executable page of memory.
1523 size_t actual_size; 1536 size_t actual_size;
1524 byte* buffer = 1537 byte* buffer =
1525 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1538 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1526 &actual_size, 1539 &actual_size,
1527 true)); 1540 true));
1528 CHECK(buffer); 1541 CHECK(buffer);
1529 HandleScope handles; 1542 HandleScope handles;
1530 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 1543 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1531 1544
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 __ j(not_equal, exit); 1605 __ j(not_equal, exit);
1593 1606
1594 __ incq(rax); 1607 __ incq(rax);
1595 __ SmiOrConstant(rcx, rcx, Smi::FromInt(y)); 1608 __ SmiOrConstant(rcx, rcx, Smi::FromInt(y));
1596 __ cmpq(r8, rcx); 1609 __ cmpq(r8, rcx);
1597 __ j(not_equal, exit); 1610 __ j(not_equal, exit);
1598 } 1611 }
1599 1612
1600 1613
1601 TEST(SmiOr) { 1614 TEST(SmiOr) {
1615 v8::internal::V8::Initialize(NULL);
1602 // Allocate an executable page of memory. 1616 // Allocate an executable page of memory.
1603 size_t actual_size; 1617 size_t actual_size;
1604 byte* buffer = 1618 byte* buffer =
1605 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1619 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1606 &actual_size, 1620 &actual_size,
1607 true)); 1621 true));
1608 CHECK(buffer); 1622 CHECK(buffer);
1609 HandleScope handles; 1623 HandleScope handles;
1610 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 1624 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1611 1625
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 __ j(not_equal, exit); 1688 __ j(not_equal, exit);
1675 1689
1676 __ incq(rax); 1690 __ incq(rax);
1677 __ SmiXorConstant(rcx, rcx, Smi::FromInt(y)); 1691 __ SmiXorConstant(rcx, rcx, Smi::FromInt(y));
1678 __ cmpq(r8, rcx); 1692 __ cmpq(r8, rcx);
1679 __ j(not_equal, exit); 1693 __ j(not_equal, exit);
1680 } 1694 }
1681 1695
1682 1696
1683 TEST(SmiXor) { 1697 TEST(SmiXor) {
1698 v8::internal::V8::Initialize(NULL);
1684 // Allocate an executable page of memory. 1699 // Allocate an executable page of memory.
1685 size_t actual_size; 1700 size_t actual_size;
1686 byte* buffer = 1701 byte* buffer =
1687 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1702 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1688 &actual_size, 1703 &actual_size,
1689 true)); 1704 true));
1690 CHECK(buffer); 1705 CHECK(buffer);
1691 HandleScope handles; 1706 HandleScope handles;
1692 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 1707 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1693 1708
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 __ j(not_equal, exit); 1755 __ j(not_equal, exit);
1741 1756
1742 __ incq(rax); 1757 __ incq(rax);
1743 __ SmiNot(rcx, rcx); 1758 __ SmiNot(rcx, rcx);
1744 __ cmpq(rcx, r8); 1759 __ cmpq(rcx, r8);
1745 __ j(not_equal, exit); 1760 __ j(not_equal, exit);
1746 } 1761 }
1747 1762
1748 1763
1749 TEST(SmiNot) { 1764 TEST(SmiNot) {
1765 v8::internal::V8::Initialize(NULL);
1750 // Allocate an executable page of memory. 1766 // Allocate an executable page of memory.
1751 size_t actual_size; 1767 size_t actual_size;
1752 byte* buffer = 1768 byte* buffer =
1753 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1769 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1754 &actual_size, 1770 &actual_size,
1755 true)); 1771 true));
1756 CHECK(buffer); 1772 CHECK(buffer);
1757 HandleScope handles; 1773 HandleScope handles;
1758 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 1774 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1759 1775
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 __ incq(rax); 1851 __ incq(rax);
1836 __ cmpq(rdx, r8); 1852 __ cmpq(rdx, r8);
1837 __ j(not_equal, exit); 1853 __ j(not_equal, exit);
1838 1854
1839 __ incq(rax); 1855 __ incq(rax);
1840 } 1856 }
1841 } 1857 }
1842 1858
1843 1859
1844 TEST(SmiShiftLeft) { 1860 TEST(SmiShiftLeft) {
1861 v8::internal::V8::Initialize(NULL);
1845 // Allocate an executable page of memory. 1862 // Allocate an executable page of memory.
1846 size_t actual_size; 1863 size_t actual_size;
1847 byte* buffer = 1864 byte* buffer =
1848 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, 1865 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
1849 &actual_size, 1866 &actual_size,
1850 true)); 1867 true));
1851 CHECK(buffer); 1868 CHECK(buffer);
1852 HandleScope handles; 1869 HandleScope handles;
1853 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 1870 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1854 1871
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 __ cmpq(rcx, r11); 1957 __ cmpq(rcx, r11);
1941 __ j(not_equal, exit); 1958 __ j(not_equal, exit);
1942 1959
1943 __ addq(rax, Immediate(3)); 1960 __ addq(rax, Immediate(3));
1944 } 1961 }
1945 } 1962 }
1946 } 1963 }
1947 1964
1948 1965
1949 TEST(SmiShiftLogicalRight) { 1966 TEST(SmiShiftLogicalRight) {
1967 v8::internal::V8::Initialize(NULL);
1950 // Allocate an executable page of memory. 1968 // Allocate an executable page of memory.
1951 size_t actual_size; 1969 size_t actual_size;
1952 byte* buffer = 1970 byte* buffer =
1953 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, 1971 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
1954 &actual_size, 1972 &actual_size,
1955 true)); 1973 true));
1956 CHECK(buffer); 1974 CHECK(buffer);
1957 HandleScope handles; 1975 HandleScope handles;
1958 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 1976 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1959 1977
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 2026
2009 __ cmpq(rdx, r8); 2027 __ cmpq(rdx, r8);
2010 __ j(not_equal, exit); 2028 __ j(not_equal, exit);
2011 2029
2012 __ incq(rax); 2030 __ incq(rax);
2013 } 2031 }
2014 } 2032 }
2015 2033
2016 2034
2017 TEST(SmiShiftArithmeticRight) { 2035 TEST(SmiShiftArithmeticRight) {
2036 v8::internal::V8::Initialize(NULL);
2018 // Allocate an executable page of memory. 2037 // Allocate an executable page of memory.
2019 size_t actual_size; 2038 size_t actual_size;
2020 byte* buffer = 2039 byte* buffer =
2021 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 2040 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2022 &actual_size, 2041 &actual_size,
2023 true)); 2042 true));
2024 CHECK(buffer); 2043 CHECK(buffer);
2025 HandleScope handles; 2044 HandleScope handles;
2026 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 2045 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
2027 2046
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 __ incq(rax); 2090 __ incq(rax);
2072 __ PositiveSmiTimesPowerOfTwoToInteger64(rcx, rcx, power); 2091 __ PositiveSmiTimesPowerOfTwoToInteger64(rcx, rcx, power);
2073 __ cmpq(rdx, r8); 2092 __ cmpq(rdx, r8);
2074 __ j(not_equal, exit); 2093 __ j(not_equal, exit);
2075 __ incq(rax); 2094 __ incq(rax);
2076 } 2095 }
2077 } 2096 }
2078 2097
2079 2098
2080 TEST(PositiveSmiTimesPowerOfTwoToInteger64) { 2099 TEST(PositiveSmiTimesPowerOfTwoToInteger64) {
2081 v8::V8::Initialize(); 2100 v8::internal::V8::Initialize(NULL);
2082 // Allocate an executable page of memory. 2101 // Allocate an executable page of memory.
2083 size_t actual_size; 2102 size_t actual_size;
2084 byte* buffer = 2103 byte* buffer =
2085 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, 2104 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
2086 &actual_size, 2105 &actual_size,
2087 true)); 2106 true));
2088 CHECK(buffer); 2107 CHECK(buffer);
2089 HandleScope handles; 2108 HandleScope handles;
2090 MacroAssembler assembler(buffer, static_cast<int>(actual_size)); 2109 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
2091 2110
(...skipping 19 matching lines...) Expand all
2111 2130
2112 CodeDesc desc; 2131 CodeDesc desc;
2113 masm->GetCode(&desc); 2132 masm->GetCode(&desc);
2114 // Call the function from C++. 2133 // Call the function from C++.
2115 int result = FUNCTION_CAST<F0>(buffer)(); 2134 int result = FUNCTION_CAST<F0>(buffer)();
2116 CHECK_EQ(0, result); 2135 CHECK_EQ(0, result);
2117 } 2136 }
2118 2137
2119 2138
2120 TEST(OperandOffset) { 2139 TEST(OperandOffset) {
2140 v8::internal::V8::Initialize(NULL);
2121 int data[256]; 2141 int data[256];
2122 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; } 2142 for (int i = 0; i < 256; i++) { data[i] = i * 0x01010101; }
2123 2143
2124 // Allocate an executable page of memory. 2144 // Allocate an executable page of memory.
2125 size_t actual_size; 2145 size_t actual_size;
2126 byte* buffer = 2146 byte* buffer =
2127 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 2147 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2128 &actual_size, 2148 &actual_size,
2129 true)); 2149 true));
2130 CHECK(buffer); 2150 CHECK(buffer);
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 CodeDesc desc; 2487 CodeDesc desc;
2468 masm->GetCode(&desc); 2488 masm->GetCode(&desc);
2469 // Call the function from C++. 2489 // Call the function from C++.
2470 int result = FUNCTION_CAST<F0>(buffer)(); 2490 int result = FUNCTION_CAST<F0>(buffer)();
2471 CHECK_EQ(0, result); 2491 CHECK_EQ(0, result);
2472 } 2492 }
2473 2493
2474 2494
2475 2495
2476 #undef __ 2496 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-log-stack-tracer.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698