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

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

Issue 583153002: Reland 24052 - Require V8 to be explicitly initialized before an Isolate is created (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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-macro-assembler-ia32.cc ('k') | test/cctest/test-macro-assembler-x87.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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 __ movl(rax, Immediate(id)); 146 __ movl(rax, Immediate(id));
147 __ Move(rcx, value); 147 __ Move(rcx, value);
148 __ Set(rdx, reinterpret_cast<intptr_t>(value)); 148 __ Set(rdx, reinterpret_cast<intptr_t>(value));
149 __ cmpq(rcx, rdx); 149 __ cmpq(rcx, rdx);
150 __ j(not_equal, exit); 150 __ j(not_equal, exit);
151 } 151 }
152 152
153 153
154 // Test that we can move a Smi value literally into a register. 154 // Test that we can move a Smi value literally into a register.
155 TEST(SmiMove) { 155 TEST(SmiMove) {
156 i::V8::Initialize(NULL);
157 // Allocate an executable page of memory. 156 // Allocate an executable page of memory.
158 size_t actual_size; 157 size_t actual_size;
159 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 158 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
160 Assembler::kMinimalBufferSize, &actual_size, true)); 159 Assembler::kMinimalBufferSize, &actual_size, true));
161 CHECK(buffer); 160 CHECK(buffer);
162 Isolate* isolate = CcTest::i_isolate(); 161 Isolate* isolate = CcTest::i_isolate();
163 HandleScope handles(isolate); 162 HandleScope handles(isolate);
164 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 163 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
165 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. 164 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
166 EntryCode(masm); 165 EntryCode(masm);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 __ j(not_equal, exit); 231 __ j(not_equal, exit);
233 __ incq(rax); 232 __ incq(rax);
234 __ cmpq(rcx, r8); 233 __ cmpq(rcx, r8);
235 __ j(not_equal, exit); 234 __ j(not_equal, exit);
236 } 235 }
237 } 236 }
238 237
239 238
240 // Test that we can compare smis for equality (and more). 239 // Test that we can compare smis for equality (and more).
241 TEST(SmiCompare) { 240 TEST(SmiCompare) {
242 i::V8::Initialize(NULL);
243 // Allocate an executable page of memory. 241 // Allocate an executable page of memory.
244 size_t actual_size; 242 size_t actual_size;
245 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 243 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
246 Assembler::kMinimalBufferSize * 2, &actual_size, true)); 244 Assembler::kMinimalBufferSize * 2, &actual_size, true));
247 CHECK(buffer); 245 CHECK(buffer);
248 Isolate* isolate = CcTest::i_isolate(); 246 Isolate* isolate = CcTest::i_isolate();
249 HandleScope handles(isolate); 247 HandleScope handles(isolate);
250 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 248 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
251 249
252 MacroAssembler* masm = &assembler; 250 MacroAssembler* masm = &assembler;
(...skipping 28 matching lines...) Expand all
281 CodeDesc desc; 279 CodeDesc desc;
282 masm->GetCode(&desc); 280 masm->GetCode(&desc);
283 // Call the function from C++. 281 // Call the function from C++.
284 int result = FUNCTION_CAST<F0>(buffer)(); 282 int result = FUNCTION_CAST<F0>(buffer)();
285 CHECK_EQ(0, result); 283 CHECK_EQ(0, result);
286 } 284 }
287 285
288 286
289 287
290 TEST(Integer32ToSmi) { 288 TEST(Integer32ToSmi) {
291 i::V8::Initialize(NULL);
292 // Allocate an executable page of memory. 289 // Allocate an executable page of memory.
293 size_t actual_size; 290 size_t actual_size;
294 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 291 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
295 Assembler::kMinimalBufferSize, &actual_size, true)); 292 Assembler::kMinimalBufferSize, &actual_size, true));
296 CHECK(buffer); 293 CHECK(buffer);
297 Isolate* isolate = CcTest::i_isolate(); 294 Isolate* isolate = CcTest::i_isolate();
298 HandleScope handles(isolate); 295 HandleScope handles(isolate);
299 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 296 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
300 297
301 MacroAssembler* masm = &assembler; 298 MacroAssembler* masm = &assembler;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 __ j(not_equal, exit); 405 __ j(not_equal, exit);
409 406
410 __ incq(rax); 407 __ incq(rax);
411 __ Integer64PlusConstantToSmi(rcx, rcx, y); 408 __ Integer64PlusConstantToSmi(rcx, rcx, y);
412 __ cmpq(rcx, r8); 409 __ cmpq(rcx, r8);
413 __ j(not_equal, exit); 410 __ j(not_equal, exit);
414 } 411 }
415 412
416 413
417 TEST(Integer64PlusConstantToSmi) { 414 TEST(Integer64PlusConstantToSmi) {
418 i::V8::Initialize(NULL);
419 // Allocate an executable page of memory. 415 // Allocate an executable page of memory.
420 size_t actual_size; 416 size_t actual_size;
421 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 417 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
422 Assembler::kMinimalBufferSize, &actual_size, true)); 418 Assembler::kMinimalBufferSize, &actual_size, true));
423 CHECK(buffer); 419 CHECK(buffer);
424 Isolate* isolate = CcTest::i_isolate(); 420 Isolate* isolate = CcTest::i_isolate();
425 HandleScope handles(isolate); 421 HandleScope handles(isolate);
426 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 422 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
427 423
428 MacroAssembler* masm = &assembler; 424 MacroAssembler* masm = &assembler;
(...skipping 22 matching lines...) Expand all
451 447
452 CodeDesc desc; 448 CodeDesc desc;
453 masm->GetCode(&desc); 449 masm->GetCode(&desc);
454 // Call the function from C++. 450 // Call the function from C++.
455 int result = FUNCTION_CAST<F0>(buffer)(); 451 int result = FUNCTION_CAST<F0>(buffer)();
456 CHECK_EQ(0, result); 452 CHECK_EQ(0, result);
457 } 453 }
458 454
459 455
460 TEST(SmiCheck) { 456 TEST(SmiCheck) {
461 i::V8::Initialize(NULL);
462 // Allocate an executable page of memory. 457 // Allocate an executable page of memory.
463 size_t actual_size; 458 size_t actual_size;
464 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 459 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
465 Assembler::kMinimalBufferSize, &actual_size, true)); 460 Assembler::kMinimalBufferSize, &actual_size, true));
466 CHECK(buffer); 461 CHECK(buffer);
467 Isolate* isolate = CcTest::i_isolate(); 462 Isolate* isolate = CcTest::i_isolate();
468 HandleScope handles(isolate); 463 HandleScope handles(isolate);
469 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 464 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
470 465
471 MacroAssembler* masm = &assembler; 466 MacroAssembler* masm = &assembler;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 __ jmp(exit); 692 __ jmp(exit);
698 __ bind(&smi_ok2); 693 __ bind(&smi_ok2);
699 __ incq(rax); 694 __ incq(rax);
700 __ cmpq(rcx, r8); 695 __ cmpq(rcx, r8);
701 __ j(not_equal, exit); 696 __ j(not_equal, exit);
702 } 697 }
703 } 698 }
704 699
705 700
706 TEST(SmiNeg) { 701 TEST(SmiNeg) {
707 i::V8::Initialize(NULL);
708 // Allocate an executable page of memory. 702 // Allocate an executable page of memory.
709 size_t actual_size; 703 size_t actual_size;
710 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 704 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
711 Assembler::kMinimalBufferSize, &actual_size, true)); 705 Assembler::kMinimalBufferSize, &actual_size, true));
712 CHECK(buffer); 706 CHECK(buffer);
713 Isolate* isolate = CcTest::i_isolate(); 707 Isolate* isolate = CcTest::i_isolate();
714 HandleScope handles(isolate); 708 HandleScope handles(isolate);
715 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 709 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
716 710
717 MacroAssembler* masm = &assembler; 711 MacroAssembler* masm = &assembler;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 __ jmp(exit); 905 __ jmp(exit);
912 __ bind(&overflow_ok); 906 __ bind(&overflow_ok);
913 __ incq(rax); 907 __ incq(rax);
914 __ cmpq(rcx, r11); 908 __ cmpq(rcx, r11);
915 __ j(equal, exit); 909 __ j(equal, exit);
916 } 910 }
917 } 911 }
918 912
919 913
920 TEST(SmiAdd) { 914 TEST(SmiAdd) {
921 i::V8::Initialize(NULL);
922 // Allocate an executable page of memory. 915 // Allocate an executable page of memory.
923 size_t actual_size; 916 size_t actual_size;
924 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 917 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
925 Assembler::kMinimalBufferSize * 3, &actual_size, true)); 918 Assembler::kMinimalBufferSize * 3, &actual_size, true));
926 CHECK(buffer); 919 CHECK(buffer);
927 Isolate* isolate = CcTest::i_isolate(); 920 Isolate* isolate = CcTest::i_isolate();
928 HandleScope handles(isolate); 921 HandleScope handles(isolate);
929 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 922 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
930 923
931 MacroAssembler* masm = &assembler; 924 MacroAssembler* masm = &assembler;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 __ jmp(exit); 1123 __ jmp(exit);
1131 __ bind(&overflow_ok); 1124 __ bind(&overflow_ok);
1132 __ incq(rax); 1125 __ incq(rax);
1133 __ cmpq(rcx, r11); 1126 __ cmpq(rcx, r11);
1134 __ j(equal, exit); 1127 __ j(equal, exit);
1135 } 1128 }
1136 } 1129 }
1137 1130
1138 1131
1139 TEST(SmiSub) { 1132 TEST(SmiSub) {
1140 i::V8::Initialize(NULL);
1141 // Allocate an executable page of memory. 1133 // Allocate an executable page of memory.
1142 size_t actual_size; 1134 size_t actual_size;
1143 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 1135 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
1144 Assembler::kMinimalBufferSize * 4, &actual_size, true)); 1136 Assembler::kMinimalBufferSize * 4, &actual_size, true));
1145 CHECK(buffer); 1137 CHECK(buffer);
1146 Isolate* isolate = CcTest::i_isolate(); 1138 Isolate* isolate = CcTest::i_isolate();
1147 HandleScope handles(isolate); 1139 HandleScope handles(isolate);
1148 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1140 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1149 1141
1150 MacroAssembler* masm = &assembler; 1142 MacroAssembler* masm = &assembler;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 __ bind(&overflow_ok2); 1211 __ bind(&overflow_ok2);
1220 // 31-bit version doesn't preserve rcx on failure. 1212 // 31-bit version doesn't preserve rcx on failure.
1221 // __ incq(rax); 1213 // __ incq(rax);
1222 // __ cmpq(r11, rcx); 1214 // __ cmpq(r11, rcx);
1223 // __ j(not_equal, exit); 1215 // __ j(not_equal, exit);
1224 } 1216 }
1225 } 1217 }
1226 1218
1227 1219
1228 TEST(SmiMul) { 1220 TEST(SmiMul) {
1229 i::V8::Initialize(NULL);
1230 // Allocate an executable page of memory. 1221 // Allocate an executable page of memory.
1231 size_t actual_size; 1222 size_t actual_size;
1232 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 1223 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
1233 Assembler::kMinimalBufferSize, &actual_size, true)); 1224 Assembler::kMinimalBufferSize, &actual_size, true));
1234 CHECK(buffer); 1225 CHECK(buffer);
1235 Isolate* isolate = CcTest::i_isolate(); 1226 Isolate* isolate = CcTest::i_isolate();
1236 HandleScope handles(isolate); 1227 HandleScope handles(isolate);
1237 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1228 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1238 1229
1239 MacroAssembler* masm = &assembler; 1230 MacroAssembler* masm = &assembler;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 __ bind(&fail_ok2); 1314 __ bind(&fail_ok2);
1324 1315
1325 __ incq(r15); 1316 __ incq(r15);
1326 __ cmpq(rcx, r11); 1317 __ cmpq(rcx, r11);
1327 __ j(not_equal, exit); 1318 __ j(not_equal, exit);
1328 } 1319 }
1329 } 1320 }
1330 1321
1331 1322
1332 TEST(SmiDiv) { 1323 TEST(SmiDiv) {
1333 i::V8::Initialize(NULL);
1334 // Allocate an executable page of memory. 1324 // Allocate an executable page of memory.
1335 size_t actual_size; 1325 size_t actual_size;
1336 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 1326 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
1337 Assembler::kMinimalBufferSize * 2, &actual_size, true)); 1327 Assembler::kMinimalBufferSize * 2, &actual_size, true));
1338 CHECK(buffer); 1328 CHECK(buffer);
1339 Isolate* isolate = CcTest::i_isolate(); 1329 Isolate* isolate = CcTest::i_isolate();
1340 HandleScope handles(isolate); 1330 HandleScope handles(isolate);
1341 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1331 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1342 1332
1343 MacroAssembler* masm = &assembler; 1333 MacroAssembler* masm = &assembler;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 __ bind(&fail_ok2); 1421 __ bind(&fail_ok2);
1432 1422
1433 __ incq(r15); 1423 __ incq(r15);
1434 __ cmpq(rcx, r11); 1424 __ cmpq(rcx, r11);
1435 __ j(not_equal, exit); 1425 __ j(not_equal, exit);
1436 } 1426 }
1437 } 1427 }
1438 1428
1439 1429
1440 TEST(SmiMod) { 1430 TEST(SmiMod) {
1441 i::V8::Initialize(NULL);
1442 // Allocate an executable page of memory. 1431 // Allocate an executable page of memory.
1443 size_t actual_size; 1432 size_t actual_size;
1444 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 1433 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
1445 Assembler::kMinimalBufferSize * 2, &actual_size, true)); 1434 Assembler::kMinimalBufferSize * 2, &actual_size, true));
1446 CHECK(buffer); 1435 CHECK(buffer);
1447 Isolate* isolate = CcTest::i_isolate(); 1436 Isolate* isolate = CcTest::i_isolate();
1448 HandleScope handles(isolate); 1437 HandleScope handles(isolate);
1449 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1438 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1450 1439
1451 MacroAssembler* masm = &assembler; 1440 MacroAssembler* masm = &assembler;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 __ shlq(rcx, Immediate(index.scale)); 1515 __ shlq(rcx, Immediate(index.scale));
1527 __ Set(r8, static_cast<intptr_t>(-x) << i); 1516 __ Set(r8, static_cast<intptr_t>(-x) << i);
1528 __ cmpq(rcx, r8); 1517 __ cmpq(rcx, r8);
1529 __ j(not_equal, exit); 1518 __ j(not_equal, exit);
1530 __ incq(rax); 1519 __ incq(rax);
1531 } 1520 }
1532 } 1521 }
1533 1522
1534 1523
1535 TEST(SmiIndex) { 1524 TEST(SmiIndex) {
1536 i::V8::Initialize(NULL);
1537 // Allocate an executable page of memory. 1525 // Allocate an executable page of memory.
1538 size_t actual_size; 1526 size_t actual_size;
1539 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 1527 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
1540 Assembler::kMinimalBufferSize * 5, &actual_size, true)); 1528 Assembler::kMinimalBufferSize * 5, &actual_size, true));
1541 CHECK(buffer); 1529 CHECK(buffer);
1542 Isolate* isolate = CcTest::i_isolate(); 1530 Isolate* isolate = CcTest::i_isolate();
1543 HandleScope handles(isolate); 1531 HandleScope handles(isolate);
1544 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1532 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1545 1533
1546 MacroAssembler* masm = &assembler; 1534 MacroAssembler* masm = &assembler;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 __ Move(rdx, Smi::FromInt(y)); 1581 __ Move(rdx, Smi::FromInt(y));
1594 __ xorq(rcx, Immediate(kSmiTagMask)); 1582 __ xorq(rcx, Immediate(kSmiTagMask));
1595 __ xorq(rdx, Immediate(kSmiTagMask)); 1583 __ xorq(rdx, Immediate(kSmiTagMask));
1596 __ SelectNonSmi(r9, rcx, rdx, &fail_ok); 1584 __ SelectNonSmi(r9, rcx, rdx, &fail_ok);
1597 __ jmp(exit); 1585 __ jmp(exit);
1598 __ bind(&fail_ok); 1586 __ bind(&fail_ok);
1599 } 1587 }
1600 1588
1601 1589
1602 TEST(SmiSelectNonSmi) { 1590 TEST(SmiSelectNonSmi) {
1603 i::V8::Initialize(NULL);
1604 // Allocate an executable page of memory. 1591 // Allocate an executable page of memory.
1605 size_t actual_size; 1592 size_t actual_size;
1606 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 1593 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
1607 Assembler::kMinimalBufferSize * 2, &actual_size, true)); 1594 Assembler::kMinimalBufferSize * 2, &actual_size, true));
1608 CHECK(buffer); 1595 CHECK(buffer);
1609 Isolate* isolate = CcTest::i_isolate(); 1596 Isolate* isolate = CcTest::i_isolate();
1610 HandleScope handles(isolate); 1597 HandleScope handles(isolate);
1611 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1598 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1612 1599
1613 MacroAssembler* masm = &assembler; 1600 MacroAssembler* masm = &assembler;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 __ j(not_equal, exit); 1657 __ j(not_equal, exit);
1671 1658
1672 __ incq(rax); 1659 __ incq(rax);
1673 __ SmiAndConstant(rcx, rcx, Smi::FromInt(y)); 1660 __ SmiAndConstant(rcx, rcx, Smi::FromInt(y));
1674 __ cmpq(r8, rcx); 1661 __ cmpq(r8, rcx);
1675 __ j(not_equal, exit); 1662 __ j(not_equal, exit);
1676 } 1663 }
1677 1664
1678 1665
1679 TEST(SmiAnd) { 1666 TEST(SmiAnd) {
1680 i::V8::Initialize(NULL);
1681 // Allocate an executable page of memory. 1667 // Allocate an executable page of memory.
1682 size_t actual_size; 1668 size_t actual_size;
1683 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 1669 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
1684 Assembler::kMinimalBufferSize * 2, &actual_size, true)); 1670 Assembler::kMinimalBufferSize * 2, &actual_size, true));
1685 CHECK(buffer); 1671 CHECK(buffer);
1686 Isolate* isolate = CcTest::i_isolate(); 1672 Isolate* isolate = CcTest::i_isolate();
1687 HandleScope handles(isolate); 1673 HandleScope handles(isolate);
1688 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1674 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1689 1675
1690 MacroAssembler* masm = &assembler; 1676 MacroAssembler* masm = &assembler;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 __ j(not_equal, exit); 1735 __ j(not_equal, exit);
1750 1736
1751 __ incq(rax); 1737 __ incq(rax);
1752 __ SmiOrConstant(rcx, rcx, Smi::FromInt(y)); 1738 __ SmiOrConstant(rcx, rcx, Smi::FromInt(y));
1753 __ cmpq(r8, rcx); 1739 __ cmpq(r8, rcx);
1754 __ j(not_equal, exit); 1740 __ j(not_equal, exit);
1755 } 1741 }
1756 1742
1757 1743
1758 TEST(SmiOr) { 1744 TEST(SmiOr) {
1759 i::V8::Initialize(NULL);
1760 // Allocate an executable page of memory. 1745 // Allocate an executable page of memory.
1761 size_t actual_size; 1746 size_t actual_size;
1762 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 1747 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
1763 Assembler::kMinimalBufferSize * 2, &actual_size, true)); 1748 Assembler::kMinimalBufferSize * 2, &actual_size, true));
1764 CHECK(buffer); 1749 CHECK(buffer);
1765 Isolate* isolate = CcTest::i_isolate(); 1750 Isolate* isolate = CcTest::i_isolate();
1766 HandleScope handles(isolate); 1751 HandleScope handles(isolate);
1767 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1752 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1768 1753
1769 MacroAssembler* masm = &assembler; 1754 MacroAssembler* masm = &assembler;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 __ j(not_equal, exit); 1815 __ j(not_equal, exit);
1831 1816
1832 __ incq(rax); 1817 __ incq(rax);
1833 __ SmiXorConstant(rcx, rcx, Smi::FromInt(y)); 1818 __ SmiXorConstant(rcx, rcx, Smi::FromInt(y));
1834 __ cmpq(r8, rcx); 1819 __ cmpq(r8, rcx);
1835 __ j(not_equal, exit); 1820 __ j(not_equal, exit);
1836 } 1821 }
1837 1822
1838 1823
1839 TEST(SmiXor) { 1824 TEST(SmiXor) {
1840 i::V8::Initialize(NULL);
1841 // Allocate an executable page of memory. 1825 // Allocate an executable page of memory.
1842 size_t actual_size; 1826 size_t actual_size;
1843 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 1827 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
1844 Assembler::kMinimalBufferSize * 2, &actual_size, true)); 1828 Assembler::kMinimalBufferSize * 2, &actual_size, true));
1845 CHECK(buffer); 1829 CHECK(buffer);
1846 Isolate* isolate = CcTest::i_isolate(); 1830 Isolate* isolate = CcTest::i_isolate();
1847 HandleScope handles(isolate); 1831 HandleScope handles(isolate);
1848 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1832 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1849 1833
1850 MacroAssembler* masm = &assembler; 1834 MacroAssembler* masm = &assembler;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 __ j(not_equal, exit); 1879 __ j(not_equal, exit);
1896 1880
1897 __ incq(rax); 1881 __ incq(rax);
1898 __ SmiNot(rcx, rcx); 1882 __ SmiNot(rcx, rcx);
1899 __ cmpq(rcx, r8); 1883 __ cmpq(rcx, r8);
1900 __ j(not_equal, exit); 1884 __ j(not_equal, exit);
1901 } 1885 }
1902 1886
1903 1887
1904 TEST(SmiNot) { 1888 TEST(SmiNot) {
1905 i::V8::Initialize(NULL);
1906 // Allocate an executable page of memory. 1889 // Allocate an executable page of memory.
1907 size_t actual_size; 1890 size_t actual_size;
1908 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 1891 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
1909 Assembler::kMinimalBufferSize, &actual_size, true)); 1892 Assembler::kMinimalBufferSize, &actual_size, true));
1910 CHECK(buffer); 1893 CHECK(buffer);
1911 Isolate* isolate = CcTest::i_isolate(); 1894 Isolate* isolate = CcTest::i_isolate();
1912 HandleScope handles(isolate); 1895 HandleScope handles(isolate);
1913 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1896 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1914 1897
1915 MacroAssembler* masm = &assembler; 1898 MacroAssembler* masm = &assembler;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 __ incq(rax); 1972 __ incq(rax);
1990 __ cmpq(rdx, r8); 1973 __ cmpq(rdx, r8);
1991 __ j(not_equal, exit); 1974 __ j(not_equal, exit);
1992 1975
1993 __ incq(rax); 1976 __ incq(rax);
1994 } 1977 }
1995 } 1978 }
1996 1979
1997 1980
1998 TEST(SmiShiftLeft) { 1981 TEST(SmiShiftLeft) {
1999 i::V8::Initialize(NULL);
2000 // Allocate an executable page of memory. 1982 // Allocate an executable page of memory.
2001 size_t actual_size; 1983 size_t actual_size;
2002 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 1984 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
2003 Assembler::kMinimalBufferSize * 7, &actual_size, true)); 1985 Assembler::kMinimalBufferSize * 7, &actual_size, true));
2004 CHECK(buffer); 1986 CHECK(buffer);
2005 Isolate* isolate = CcTest::i_isolate(); 1987 Isolate* isolate = CcTest::i_isolate();
2006 HandleScope handles(isolate); 1988 HandleScope handles(isolate);
2007 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1989 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2008 1990
2009 MacroAssembler* masm = &assembler; 1991 MacroAssembler* masm = &assembler;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 __ cmpq(rcx, r11); 2075 __ cmpq(rcx, r11);
2094 __ j(not_equal, exit); 2076 __ j(not_equal, exit);
2095 2077
2096 __ addq(rax, Immediate(3)); 2078 __ addq(rax, Immediate(3));
2097 } 2079 }
2098 } 2080 }
2099 } 2081 }
2100 2082
2101 2083
2102 TEST(SmiShiftLogicalRight) { 2084 TEST(SmiShiftLogicalRight) {
2103 i::V8::Initialize(NULL);
2104 // Allocate an executable page of memory. 2085 // Allocate an executable page of memory.
2105 size_t actual_size; 2086 size_t actual_size;
2106 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 2087 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
2107 Assembler::kMinimalBufferSize * 5, &actual_size, true)); 2088 Assembler::kMinimalBufferSize * 5, &actual_size, true));
2108 CHECK(buffer); 2089 CHECK(buffer);
2109 Isolate* isolate = CcTest::i_isolate(); 2090 Isolate* isolate = CcTest::i_isolate();
2110 HandleScope handles(isolate); 2091 HandleScope handles(isolate);
2111 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 2092 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2112 2093
2113 MacroAssembler* masm = &assembler; 2094 MacroAssembler* masm = &assembler;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 2141
2161 __ cmpq(rdx, r8); 2142 __ cmpq(rdx, r8);
2162 __ j(not_equal, exit); 2143 __ j(not_equal, exit);
2163 2144
2164 __ incq(rax); 2145 __ incq(rax);
2165 } 2146 }
2166 } 2147 }
2167 2148
2168 2149
2169 TEST(SmiShiftArithmeticRight) { 2150 TEST(SmiShiftArithmeticRight) {
2170 i::V8::Initialize(NULL);
2171 // Allocate an executable page of memory. 2151 // Allocate an executable page of memory.
2172 size_t actual_size; 2152 size_t actual_size;
2173 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 2153 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
2174 Assembler::kMinimalBufferSize * 3, &actual_size, true)); 2154 Assembler::kMinimalBufferSize * 3, &actual_size, true));
2175 CHECK(buffer); 2155 CHECK(buffer);
2176 Isolate* isolate = CcTest::i_isolate(); 2156 Isolate* isolate = CcTest::i_isolate();
2177 HandleScope handles(isolate); 2157 HandleScope handles(isolate);
2178 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 2158 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2179 2159
2180 MacroAssembler* masm = &assembler; 2160 MacroAssembler* masm = &assembler;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 __ incq(rax); 2202 __ incq(rax);
2223 __ PositiveSmiTimesPowerOfTwoToInteger64(rcx, rcx, power); 2203 __ PositiveSmiTimesPowerOfTwoToInteger64(rcx, rcx, power);
2224 __ cmpq(rdx, r8); 2204 __ cmpq(rdx, r8);
2225 __ j(not_equal, exit); 2205 __ j(not_equal, exit);
2226 __ incq(rax); 2206 __ incq(rax);
2227 } 2207 }
2228 } 2208 }
2229 2209
2230 2210
2231 TEST(PositiveSmiTimesPowerOfTwoToInteger64) { 2211 TEST(PositiveSmiTimesPowerOfTwoToInteger64) {
2232 i::V8::Initialize(NULL);
2233 // Allocate an executable page of memory. 2212 // Allocate an executable page of memory.
2234 size_t actual_size; 2213 size_t actual_size;
2235 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 2214 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
2236 Assembler::kMinimalBufferSize * 4, &actual_size, true)); 2215 Assembler::kMinimalBufferSize * 4, &actual_size, true));
2237 CHECK(buffer); 2216 CHECK(buffer);
2238 Isolate* isolate = CcTest::i_isolate(); 2217 Isolate* isolate = CcTest::i_isolate();
2239 HandleScope handles(isolate); 2218 HandleScope handles(isolate);
2240 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 2219 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2241 2220
2242 MacroAssembler* masm = &assembler; 2221 MacroAssembler* masm = &assembler;
(...skipping 17 matching lines...) Expand all
2260 2239
2261 CodeDesc desc; 2240 CodeDesc desc;
2262 masm->GetCode(&desc); 2241 masm->GetCode(&desc);
2263 // Call the function from C++. 2242 // Call the function from C++.
2264 int result = FUNCTION_CAST<F0>(buffer)(); 2243 int result = FUNCTION_CAST<F0>(buffer)();
2265 CHECK_EQ(0, result); 2244 CHECK_EQ(0, result);
2266 } 2245 }
2267 2246
2268 2247
2269 TEST(OperandOffset) { 2248 TEST(OperandOffset) {
2270 i::V8::Initialize(NULL);
2271 uint32_t data[256]; 2249 uint32_t data[256];
2272 for (uint32_t i = 0; i < 256; i++) { data[i] = i * 0x01010101; } 2250 for (uint32_t i = 0; i < 256; i++) { data[i] = i * 0x01010101; }
2273 2251
2274 // Allocate an executable page of memory. 2252 // Allocate an executable page of memory.
2275 size_t actual_size; 2253 size_t actual_size;
2276 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 2254 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
2277 Assembler::kMinimalBufferSize * 2, &actual_size, true)); 2255 Assembler::kMinimalBufferSize * 2, &actual_size, true));
2278 CHECK(buffer); 2256 CHECK(buffer);
2279 Isolate* isolate = CcTest::i_isolate(); 2257 Isolate* isolate = CcTest::i_isolate();
2280 HandleScope handles(isolate); 2258 HandleScope handles(isolate);
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2614 2592
2615 CodeDesc desc; 2593 CodeDesc desc;
2616 masm->GetCode(&desc); 2594 masm->GetCode(&desc);
2617 // Call the function from C++. 2595 // Call the function from C++.
2618 int result = FUNCTION_CAST<F0>(buffer)(); 2596 int result = FUNCTION_CAST<F0>(buffer)();
2619 CHECK_EQ(0, result); 2597 CHECK_EQ(0, result);
2620 } 2598 }
2621 2599
2622 2600
2623 TEST(LoadAndStoreWithRepresentation) { 2601 TEST(LoadAndStoreWithRepresentation) {
2624 v8::internal::V8::Initialize(NULL);
2625
2626 // Allocate an executable page of memory. 2602 // Allocate an executable page of memory.
2627 size_t actual_size; 2603 size_t actual_size;
2628 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate( 2604 byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
2629 Assembler::kMinimalBufferSize, &actual_size, true)); 2605 Assembler::kMinimalBufferSize, &actual_size, true));
2630 CHECK(buffer); 2606 CHECK(buffer);
2631 Isolate* isolate = CcTest::i_isolate(); 2607 Isolate* isolate = CcTest::i_isolate();
2632 HandleScope handles(isolate); 2608 HandleScope handles(isolate);
2633 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 2609 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2634 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. 2610 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
2635 EntryCode(masm); 2611 EntryCode(masm);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2763 2739
2764 CodeDesc desc; 2740 CodeDesc desc;
2765 masm->GetCode(&desc); 2741 masm->GetCode(&desc);
2766 // Call the function from C++. 2742 // Call the function from C++.
2767 int result = FUNCTION_CAST<F0>(buffer)(); 2743 int result = FUNCTION_CAST<F0>(buffer)();
2768 CHECK_EQ(0, result); 2744 CHECK_EQ(0, result);
2769 } 2745 }
2770 2746
2771 2747
2772 #undef __ 2748 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-macro-assembler-ia32.cc ('k') | test/cctest/test-macro-assembler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698