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

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

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