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

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

Issue 96853003: Drop IsPregenerated() and allow_stub_calls flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Also ditch the fixed register hack that was required for RecordWriteStub. Created 7 years 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') | no next file » | 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // Allocate an executable page of memory. 158 // Allocate an executable page of memory.
159 size_t actual_size; 159 size_t actual_size;
160 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 160 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
161 &actual_size, 161 &actual_size,
162 true)); 162 true));
163 CHECK(buffer); 163 CHECK(buffer);
164 Isolate* isolate = CcTest::i_isolate(); 164 Isolate* isolate = CcTest::i_isolate();
165 HandleScope handles(isolate); 165 HandleScope handles(isolate);
166 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 166 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
167 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. 167 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
168 masm->set_allow_stub_calls(false);
169 EntryCode(masm); 168 EntryCode(masm);
170 Label exit; 169 Label exit;
171 170
172 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0)); 171 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0));
173 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127)); 172 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127));
174 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128)); 173 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128));
175 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255)); 174 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255));
176 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256)); 175 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256));
177 TestMoveSmi(masm, &exit, 6, Smi::FromInt(Smi::kMaxValue)); 176 TestMoveSmi(masm, &exit, 6, Smi::FromInt(Smi::kMaxValue));
178 TestMoveSmi(masm, &exit, 7, Smi::FromInt(-1)); 177 TestMoveSmi(masm, &exit, 7, Smi::FromInt(-1));
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 byte* buffer = 247 byte* buffer =
249 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 248 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
250 &actual_size, 249 &actual_size,
251 true)); 250 true));
252 CHECK(buffer); 251 CHECK(buffer);
253 Isolate* isolate = CcTest::i_isolate(); 252 Isolate* isolate = CcTest::i_isolate();
254 HandleScope handles(isolate); 253 HandleScope handles(isolate);
255 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 254 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
256 255
257 MacroAssembler* masm = &assembler; 256 MacroAssembler* masm = &assembler;
258 masm->set_allow_stub_calls(false);
259 EntryCode(masm); 257 EntryCode(masm);
260 Label exit; 258 Label exit;
261 259
262 TestSmiCompare(masm, &exit, 0x10, 0, 0); 260 TestSmiCompare(masm, &exit, 0x10, 0, 0);
263 TestSmiCompare(masm, &exit, 0x20, 0, 1); 261 TestSmiCompare(masm, &exit, 0x20, 0, 1);
264 TestSmiCompare(masm, &exit, 0x30, 1, 0); 262 TestSmiCompare(masm, &exit, 0x30, 1, 0);
265 TestSmiCompare(masm, &exit, 0x40, 1, 1); 263 TestSmiCompare(masm, &exit, 0x40, 1, 1);
266 TestSmiCompare(masm, &exit, 0x50, 0, -1); 264 TestSmiCompare(masm, &exit, 0x50, 0, -1);
267 TestSmiCompare(masm, &exit, 0x60, -1, 0); 265 TestSmiCompare(masm, &exit, 0x60, -1, 0);
268 TestSmiCompare(masm, &exit, 0x70, -1, -1); 266 TestSmiCompare(masm, &exit, 0x70, -1, -1);
(...skipping 30 matching lines...) Expand all
299 size_t actual_size; 297 size_t actual_size;
300 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 298 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
301 &actual_size, 299 &actual_size,
302 true)); 300 true));
303 CHECK(buffer); 301 CHECK(buffer);
304 Isolate* isolate = CcTest::i_isolate(); 302 Isolate* isolate = CcTest::i_isolate();
305 HandleScope handles(isolate); 303 HandleScope handles(isolate);
306 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 304 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
307 305
308 MacroAssembler* masm = &assembler; 306 MacroAssembler* masm = &assembler;
309 masm->set_allow_stub_calls(false);
310 EntryCode(masm); 307 EntryCode(masm);
311 Label exit; 308 Label exit;
312 309
313 __ movq(rax, Immediate(1)); // Test number. 310 __ movq(rax, Immediate(1)); // Test number.
314 __ movl(rcx, Immediate(0)); 311 __ movl(rcx, Immediate(0));
315 __ Integer32ToSmi(rcx, rcx); 312 __ Integer32ToSmi(rcx, rcx);
316 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); 313 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0)));
317 __ cmpq(rcx, rdx); 314 __ cmpq(rcx, rdx);
318 __ j(not_equal, &exit); 315 __ j(not_equal, &exit);
319 316
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 size_t actual_size; 425 size_t actual_size;
429 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 426 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
430 &actual_size, 427 &actual_size,
431 true)); 428 true));
432 CHECK(buffer); 429 CHECK(buffer);
433 Isolate* isolate = CcTest::i_isolate(); 430 Isolate* isolate = CcTest::i_isolate();
434 HandleScope handles(isolate); 431 HandleScope handles(isolate);
435 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 432 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
436 433
437 MacroAssembler* masm = &assembler; 434 MacroAssembler* masm = &assembler;
438 masm->set_allow_stub_calls(false);
439 EntryCode(masm); 435 EntryCode(masm);
440 Label exit; 436 Label exit;
441 437
442 int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2; 438 int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2;
443 439
444 TestI64PlusConstantToSmi(masm, &exit, 0x10, 0, 0); 440 TestI64PlusConstantToSmi(masm, &exit, 0x10, 0, 0);
445 TestI64PlusConstantToSmi(masm, &exit, 0x20, 0, 1); 441 TestI64PlusConstantToSmi(masm, &exit, 0x20, 0, 1);
446 TestI64PlusConstantToSmi(masm, &exit, 0x30, 1, 0); 442 TestI64PlusConstantToSmi(masm, &exit, 0x30, 1, 0);
447 TestI64PlusConstantToSmi(masm, &exit, 0x40, Smi::kMaxValue - 5, 5); 443 TestI64PlusConstantToSmi(masm, &exit, 0x40, Smi::kMaxValue - 5, 5);
448 TestI64PlusConstantToSmi(masm, &exit, 0x50, Smi::kMinValue + 5, 5); 444 TestI64PlusConstantToSmi(masm, &exit, 0x50, Smi::kMinValue + 5, 5);
(...skipping 24 matching lines...) Expand all
473 size_t actual_size; 469 size_t actual_size;
474 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 470 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
475 &actual_size, 471 &actual_size,
476 true)); 472 true));
477 CHECK(buffer); 473 CHECK(buffer);
478 Isolate* isolate = CcTest::i_isolate(); 474 Isolate* isolate = CcTest::i_isolate();
479 HandleScope handles(isolate); 475 HandleScope handles(isolate);
480 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 476 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
481 477
482 MacroAssembler* masm = &assembler; 478 MacroAssembler* masm = &assembler;
483 masm->set_allow_stub_calls(false);
484 EntryCode(masm); 479 EntryCode(masm);
485 Label exit; 480 Label exit;
486 Condition cond; 481 Condition cond;
487 482
488 __ movl(rax, Immediate(1)); // Test number. 483 __ movl(rax, Immediate(1)); // Test number.
489 484
490 // CheckSmi 485 // CheckSmi
491 486
492 __ movl(rcx, Immediate(0)); 487 __ movl(rcx, Immediate(0));
493 __ Integer32ToSmi(rcx, rcx); 488 __ Integer32ToSmi(rcx, rcx);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 byte* buffer = 717 byte* buffer =
723 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 718 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
724 &actual_size, 719 &actual_size,
725 true)); 720 true));
726 CHECK(buffer); 721 CHECK(buffer);
727 Isolate* isolate = CcTest::i_isolate(); 722 Isolate* isolate = CcTest::i_isolate();
728 HandleScope handles(isolate); 723 HandleScope handles(isolate);
729 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 724 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
730 725
731 MacroAssembler* masm = &assembler; 726 MacroAssembler* masm = &assembler;
732 masm->set_allow_stub_calls(false);
733 EntryCode(masm); 727 EntryCode(masm);
734 Label exit; 728 Label exit;
735 729
736 TestSmiNeg(masm, &exit, 0x10, 0); 730 TestSmiNeg(masm, &exit, 0x10, 0);
737 TestSmiNeg(masm, &exit, 0x20, 1); 731 TestSmiNeg(masm, &exit, 0x20, 1);
738 TestSmiNeg(masm, &exit, 0x30, -1); 732 TestSmiNeg(masm, &exit, 0x30, -1);
739 TestSmiNeg(masm, &exit, 0x40, 127); 733 TestSmiNeg(masm, &exit, 0x40, 127);
740 TestSmiNeg(masm, &exit, 0x50, 65535); 734 TestSmiNeg(masm, &exit, 0x50, 65535);
741 TestSmiNeg(masm, &exit, 0x60, Smi::kMinValue); 735 TestSmiNeg(masm, &exit, 0x60, Smi::kMinValue);
742 TestSmiNeg(masm, &exit, 0x70, Smi::kMaxValue); 736 TestSmiNeg(masm, &exit, 0x70, Smi::kMaxValue);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 __ j(equal, exit); 924 __ j(equal, exit);
931 } 925 }
932 } 926 }
933 927
934 928
935 TEST(SmiAdd) { 929 TEST(SmiAdd) {
936 i::V8::Initialize(NULL); 930 i::V8::Initialize(NULL);
937 // Allocate an executable page of memory. 931 // Allocate an executable page of memory.
938 size_t actual_size; 932 size_t actual_size;
939 byte* buffer = 933 byte* buffer =
940 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 934 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
941 &actual_size, 935 &actual_size,
942 true)); 936 true));
943 CHECK(buffer); 937 CHECK(buffer);
944 Isolate* isolate = CcTest::i_isolate(); 938 Isolate* isolate = CcTest::i_isolate();
945 HandleScope handles(isolate); 939 HandleScope handles(isolate);
946 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 940 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
947 941
948 MacroAssembler* masm = &assembler; 942 MacroAssembler* masm = &assembler;
949 masm->set_allow_stub_calls(false);
950 EntryCode(masm); 943 EntryCode(masm);
951 Label exit; 944 Label exit;
952 945
953 // No-overflow tests. 946 // No-overflow tests.
954 SmiAddTest(masm, &exit, 0x10, 1, 2); 947 SmiAddTest(masm, &exit, 0x10, 1, 2);
955 SmiAddTest(masm, &exit, 0x20, 1, -2); 948 SmiAddTest(masm, &exit, 0x20, 1, -2);
956 SmiAddTest(masm, &exit, 0x30, -1, 2); 949 SmiAddTest(masm, &exit, 0x30, -1, 2);
957 SmiAddTest(masm, &exit, 0x40, -1, -2); 950 SmiAddTest(masm, &exit, 0x40, -1, -2);
958 SmiAddTest(masm, &exit, 0x50, 0x1000, 0x2000); 951 SmiAddTest(masm, &exit, 0x50, 0x1000, 0x2000);
959 SmiAddTest(masm, &exit, 0x60, Smi::kMinValue, 5); 952 SmiAddTest(masm, &exit, 0x60, Smi::kMinValue, 5);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 __ j(equal, exit); 1145 __ j(equal, exit);
1153 } 1146 }
1154 } 1147 }
1155 1148
1156 1149
1157 TEST(SmiSub) { 1150 TEST(SmiSub) {
1158 i::V8::Initialize(NULL); 1151 i::V8::Initialize(NULL);
1159 // Allocate an executable page of memory. 1152 // Allocate an executable page of memory.
1160 size_t actual_size; 1153 size_t actual_size;
1161 byte* buffer = 1154 byte* buffer =
1162 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1155 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
1163 &actual_size, 1156 &actual_size,
1164 true)); 1157 true));
1165 CHECK(buffer); 1158 CHECK(buffer);
1166 Isolate* isolate = CcTest::i_isolate(); 1159 Isolate* isolate = CcTest::i_isolate();
1167 HandleScope handles(isolate); 1160 HandleScope handles(isolate);
1168 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1161 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1169 1162
1170 MacroAssembler* masm = &assembler; 1163 MacroAssembler* masm = &assembler;
1171 masm->set_allow_stub_calls(false);
1172 EntryCode(masm); 1164 EntryCode(masm);
1173 Label exit; 1165 Label exit;
1174 1166
1175 SmiSubTest(masm, &exit, 0x10, 1, 2); 1167 SmiSubTest(masm, &exit, 0x10, 1, 2);
1176 SmiSubTest(masm, &exit, 0x20, 1, -2); 1168 SmiSubTest(masm, &exit, 0x20, 1, -2);
1177 SmiSubTest(masm, &exit, 0x30, -1, 2); 1169 SmiSubTest(masm, &exit, 0x30, -1, 2);
1178 SmiSubTest(masm, &exit, 0x40, -1, -2); 1170 SmiSubTest(masm, &exit, 0x40, -1, -2);
1179 SmiSubTest(masm, &exit, 0x50, 0x1000, 0x2000); 1171 SmiSubTest(masm, &exit, 0x50, 0x1000, 0x2000);
1180 SmiSubTest(masm, &exit, 0x60, Smi::kMinValue, -5); 1172 SmiSubTest(masm, &exit, 0x60, Smi::kMinValue, -5);
1181 SmiSubTest(masm, &exit, 0x70, Smi::kMaxValue, 5); 1173 SmiSubTest(masm, &exit, 0x70, Smi::kMaxValue, 5);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 size_t actual_size; 1244 size_t actual_size;
1253 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1245 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1254 &actual_size, 1246 &actual_size,
1255 true)); 1247 true));
1256 CHECK(buffer); 1248 CHECK(buffer);
1257 Isolate* isolate = CcTest::i_isolate(); 1249 Isolate* isolate = CcTest::i_isolate();
1258 HandleScope handles(isolate); 1250 HandleScope handles(isolate);
1259 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1251 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1260 1252
1261 MacroAssembler* masm = &assembler; 1253 MacroAssembler* masm = &assembler;
1262 masm->set_allow_stub_calls(false);
1263 EntryCode(masm); 1254 EntryCode(masm);
1264 Label exit; 1255 Label exit;
1265 1256
1266 TestSmiMul(masm, &exit, 0x10, 0, 0); 1257 TestSmiMul(masm, &exit, 0x10, 0, 0);
1267 TestSmiMul(masm, &exit, 0x20, -1, 0); 1258 TestSmiMul(masm, &exit, 0x20, -1, 0);
1268 TestSmiMul(masm, &exit, 0x30, 0, -1); 1259 TestSmiMul(masm, &exit, 0x30, 0, -1);
1269 TestSmiMul(masm, &exit, 0x40, -1, -1); 1260 TestSmiMul(masm, &exit, 0x40, -1, -1);
1270 TestSmiMul(masm, &exit, 0x50, 0x10000, 0x10000); 1261 TestSmiMul(masm, &exit, 0x50, 0x10000, 0x10000);
1271 TestSmiMul(masm, &exit, 0x60, 0x10000, 0xffff); 1262 TestSmiMul(masm, &exit, 0x60, 0x10000, 0xffff);
1272 TestSmiMul(masm, &exit, 0x70, 0x10000, 0xffff); 1263 TestSmiMul(masm, &exit, 0x70, 0x10000, 0xffff);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 byte* buffer = 1350 byte* buffer =
1360 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1351 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1361 &actual_size, 1352 &actual_size,
1362 true)); 1353 true));
1363 CHECK(buffer); 1354 CHECK(buffer);
1364 Isolate* isolate = CcTest::i_isolate(); 1355 Isolate* isolate = CcTest::i_isolate();
1365 HandleScope handles(isolate); 1356 HandleScope handles(isolate);
1366 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1357 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1367 1358
1368 MacroAssembler* masm = &assembler; 1359 MacroAssembler* masm = &assembler;
1369 masm->set_allow_stub_calls(false);
1370 EntryCode(masm); 1360 EntryCode(masm);
1371 Label exit; 1361 Label exit;
1372 1362
1373 __ push(r14); 1363 __ push(r14);
1374 __ push(r15); 1364 __ push(r15);
1375 TestSmiDiv(masm, &exit, 0x10, 1, 1); 1365 TestSmiDiv(masm, &exit, 0x10, 1, 1);
1376 TestSmiDiv(masm, &exit, 0x20, 1, 0); 1366 TestSmiDiv(masm, &exit, 0x20, 1, 0);
1377 TestSmiDiv(masm, &exit, 0x30, -1, 0); 1367 TestSmiDiv(masm, &exit, 0x30, -1, 0);
1378 TestSmiDiv(masm, &exit, 0x40, 0, 1); 1368 TestSmiDiv(masm, &exit, 0x40, 0, 1);
1379 TestSmiDiv(masm, &exit, 0x50, 0, -1); 1369 TestSmiDiv(masm, &exit, 0x50, 0, -1);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 byte* buffer = 1460 byte* buffer =
1471 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1461 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1472 &actual_size, 1462 &actual_size,
1473 true)); 1463 true));
1474 CHECK(buffer); 1464 CHECK(buffer);
1475 Isolate* isolate = CcTest::i_isolate(); 1465 Isolate* isolate = CcTest::i_isolate();
1476 HandleScope handles(isolate); 1466 HandleScope handles(isolate);
1477 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1467 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1478 1468
1479 MacroAssembler* masm = &assembler; 1469 MacroAssembler* masm = &assembler;
1480 masm->set_allow_stub_calls(false);
1481 EntryCode(masm); 1470 EntryCode(masm);
1482 Label exit; 1471 Label exit;
1483 1472
1484 __ push(r14); 1473 __ push(r14);
1485 __ push(r15); 1474 __ push(r15);
1486 TestSmiMod(masm, &exit, 0x10, 1, 1); 1475 TestSmiMod(masm, &exit, 0x10, 1, 1);
1487 TestSmiMod(masm, &exit, 0x20, 1, 0); 1476 TestSmiMod(masm, &exit, 0x20, 1, 0);
1488 TestSmiMod(masm, &exit, 0x30, -1, 0); 1477 TestSmiMod(masm, &exit, 0x30, -1, 0);
1489 TestSmiMod(masm, &exit, 0x40, 0, 1); 1478 TestSmiMod(masm, &exit, 0x40, 0, 1);
1490 TestSmiMod(masm, &exit, 0x50, 0, -1); 1479 TestSmiMod(masm, &exit, 0x50, 0, -1);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 __ incq(rax); 1548 __ incq(rax);
1560 } 1549 }
1561 } 1550 }
1562 1551
1563 1552
1564 TEST(SmiIndex) { 1553 TEST(SmiIndex) {
1565 i::V8::Initialize(NULL); 1554 i::V8::Initialize(NULL);
1566 // Allocate an executable page of memory. 1555 // Allocate an executable page of memory.
1567 size_t actual_size; 1556 size_t actual_size;
1568 byte* buffer = 1557 byte* buffer =
1569 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, 1558 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
1570 &actual_size, 1559 &actual_size,
1571 true)); 1560 true));
1572 CHECK(buffer); 1561 CHECK(buffer);
1573 Isolate* isolate = CcTest::i_isolate(); 1562 Isolate* isolate = CcTest::i_isolate();
1574 HandleScope handles(isolate); 1563 HandleScope handles(isolate);
1575 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1564 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1576 1565
1577 MacroAssembler* masm = &assembler; 1566 MacroAssembler* masm = &assembler;
1578 masm->set_allow_stub_calls(false);
1579 EntryCode(masm); 1567 EntryCode(masm);
1580 Label exit; 1568 Label exit;
1581 1569
1582 TestSmiIndex(masm, &exit, 0x10, 0); 1570 TestSmiIndex(masm, &exit, 0x10, 0);
1583 TestSmiIndex(masm, &exit, 0x20, 1); 1571 TestSmiIndex(masm, &exit, 0x20, 1);
1584 TestSmiIndex(masm, &exit, 0x30, 100); 1572 TestSmiIndex(masm, &exit, 0x30, 100);
1585 TestSmiIndex(masm, &exit, 0x40, 1000); 1573 TestSmiIndex(masm, &exit, 0x40, 1000);
1586 TestSmiIndex(masm, &exit, 0x50, Smi::kMaxValue); 1574 TestSmiIndex(masm, &exit, 0x50, Smi::kMaxValue);
1587 1575
1588 __ xor_(rax, rax); // Success. 1576 __ xor_(rax, rax); // Success.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 __ jmp(exit); 1617 __ jmp(exit);
1630 __ bind(&fail_ok); 1618 __ bind(&fail_ok);
1631 } 1619 }
1632 1620
1633 1621
1634 TEST(SmiSelectNonSmi) { 1622 TEST(SmiSelectNonSmi) {
1635 i::V8::Initialize(NULL); 1623 i::V8::Initialize(NULL);
1636 // Allocate an executable page of memory. 1624 // Allocate an executable page of memory.
1637 size_t actual_size; 1625 size_t actual_size;
1638 byte* buffer = 1626 byte* buffer =
1639 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1627 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1640 &actual_size, 1628 &actual_size,
1641 true)); 1629 true));
1642 CHECK(buffer); 1630 CHECK(buffer);
1643 Isolate* isolate = CcTest::i_isolate(); 1631 Isolate* isolate = CcTest::i_isolate();
1644 HandleScope handles(isolate); 1632 HandleScope handles(isolate);
1645 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1633 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1646 1634
1647 MacroAssembler* masm = &assembler; 1635 MacroAssembler* masm = &assembler;
1648 masm->set_allow_stub_calls(false); // Avoid inline checks.
1649 EntryCode(masm); 1636 EntryCode(masm);
1650 Label exit; 1637 Label exit;
1651 1638
1652 TestSelectNonSmi(masm, &exit, 0x10, 0, 0); 1639 TestSelectNonSmi(masm, &exit, 0x10, 0, 0);
1653 TestSelectNonSmi(masm, &exit, 0x20, 0, 1); 1640 TestSelectNonSmi(masm, &exit, 0x20, 0, 1);
1654 TestSelectNonSmi(masm, &exit, 0x30, 1, 0); 1641 TestSelectNonSmi(masm, &exit, 0x30, 1, 0);
1655 TestSelectNonSmi(masm, &exit, 0x40, 0, -1); 1642 TestSelectNonSmi(masm, &exit, 0x40, 0, -1);
1656 TestSelectNonSmi(masm, &exit, 0x50, -1, 0); 1643 TestSelectNonSmi(masm, &exit, 0x50, -1, 0);
1657 TestSelectNonSmi(masm, &exit, 0x60, -1, -1); 1644 TestSelectNonSmi(masm, &exit, 0x60, -1, -1);
1658 TestSelectNonSmi(masm, &exit, 0x70, 1, 1); 1645 TestSelectNonSmi(masm, &exit, 0x70, 1, 1);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 __ cmpq(r8, rcx); 1696 __ cmpq(r8, rcx);
1710 __ j(not_equal, exit); 1697 __ j(not_equal, exit);
1711 } 1698 }
1712 1699
1713 1700
1714 TEST(SmiAnd) { 1701 TEST(SmiAnd) {
1715 i::V8::Initialize(NULL); 1702 i::V8::Initialize(NULL);
1716 // Allocate an executable page of memory. 1703 // Allocate an executable page of memory.
1717 size_t actual_size; 1704 size_t actual_size;
1718 byte* buffer = 1705 byte* buffer =
1719 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1706 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1720 &actual_size, 1707 &actual_size,
1721 true)); 1708 true));
1722 CHECK(buffer); 1709 CHECK(buffer);
1723 Isolate* isolate = CcTest::i_isolate(); 1710 Isolate* isolate = CcTest::i_isolate();
1724 HandleScope handles(isolate); 1711 HandleScope handles(isolate);
1725 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1712 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1726 1713
1727 MacroAssembler* masm = &assembler; 1714 MacroAssembler* masm = &assembler;
1728 masm->set_allow_stub_calls(false);
1729 EntryCode(masm); 1715 EntryCode(masm);
1730 Label exit; 1716 Label exit;
1731 1717
1732 TestSmiAnd(masm, &exit, 0x10, 0, 0); 1718 TestSmiAnd(masm, &exit, 0x10, 0, 0);
1733 TestSmiAnd(masm, &exit, 0x20, 0, 1); 1719 TestSmiAnd(masm, &exit, 0x20, 0, 1);
1734 TestSmiAnd(masm, &exit, 0x30, 1, 0); 1720 TestSmiAnd(masm, &exit, 0x30, 1, 0);
1735 TestSmiAnd(masm, &exit, 0x40, 0, -1); 1721 TestSmiAnd(masm, &exit, 0x40, 0, -1);
1736 TestSmiAnd(masm, &exit, 0x50, -1, 0); 1722 TestSmiAnd(masm, &exit, 0x50, -1, 0);
1737 TestSmiAnd(masm, &exit, 0x60, -1, -1); 1723 TestSmiAnd(masm, &exit, 0x60, -1, -1);
1738 TestSmiAnd(masm, &exit, 0x70, 1, 1); 1724 TestSmiAnd(masm, &exit, 0x70, 1, 1);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 __ cmpq(r8, rcx); 1777 __ cmpq(r8, rcx);
1792 __ j(not_equal, exit); 1778 __ j(not_equal, exit);
1793 } 1779 }
1794 1780
1795 1781
1796 TEST(SmiOr) { 1782 TEST(SmiOr) {
1797 i::V8::Initialize(NULL); 1783 i::V8::Initialize(NULL);
1798 // Allocate an executable page of memory. 1784 // Allocate an executable page of memory.
1799 size_t actual_size; 1785 size_t actual_size;
1800 byte* buffer = 1786 byte* buffer =
1801 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1787 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1802 &actual_size, 1788 &actual_size,
1803 true)); 1789 true));
1804 CHECK(buffer); 1790 CHECK(buffer);
1805 Isolate* isolate = CcTest::i_isolate(); 1791 Isolate* isolate = CcTest::i_isolate();
1806 HandleScope handles(isolate); 1792 HandleScope handles(isolate);
1807 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1793 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1808 1794
1809 MacroAssembler* masm = &assembler; 1795 MacroAssembler* masm = &assembler;
1810 masm->set_allow_stub_calls(false);
1811 EntryCode(masm); 1796 EntryCode(masm);
1812 Label exit; 1797 Label exit;
1813 1798
1814 TestSmiOr(masm, &exit, 0x10, 0, 0); 1799 TestSmiOr(masm, &exit, 0x10, 0, 0);
1815 TestSmiOr(masm, &exit, 0x20, 0, 1); 1800 TestSmiOr(masm, &exit, 0x20, 0, 1);
1816 TestSmiOr(masm, &exit, 0x30, 1, 0); 1801 TestSmiOr(masm, &exit, 0x30, 1, 0);
1817 TestSmiOr(masm, &exit, 0x40, 0, -1); 1802 TestSmiOr(masm, &exit, 0x40, 0, -1);
1818 TestSmiOr(masm, &exit, 0x50, -1, 0); 1803 TestSmiOr(masm, &exit, 0x50, -1, 0);
1819 TestSmiOr(masm, &exit, 0x60, -1, -1); 1804 TestSmiOr(masm, &exit, 0x60, -1, -1);
1820 TestSmiOr(masm, &exit, 0x70, 1, 1); 1805 TestSmiOr(masm, &exit, 0x70, 1, 1);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 __ cmpq(r8, rcx); 1860 __ cmpq(r8, rcx);
1876 __ j(not_equal, exit); 1861 __ j(not_equal, exit);
1877 } 1862 }
1878 1863
1879 1864
1880 TEST(SmiXor) { 1865 TEST(SmiXor) {
1881 i::V8::Initialize(NULL); 1866 i::V8::Initialize(NULL);
1882 // Allocate an executable page of memory. 1867 // Allocate an executable page of memory.
1883 size_t actual_size; 1868 size_t actual_size;
1884 byte* buffer = 1869 byte* buffer =
1885 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1870 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1886 &actual_size, 1871 &actual_size,
1887 true)); 1872 true));
1888 CHECK(buffer); 1873 CHECK(buffer);
1889 Isolate* isolate = CcTest::i_isolate(); 1874 Isolate* isolate = CcTest::i_isolate();
1890 HandleScope handles(isolate); 1875 HandleScope handles(isolate);
1891 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1876 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1892 1877
1893 MacroAssembler* masm = &assembler; 1878 MacroAssembler* masm = &assembler;
1894 masm->set_allow_stub_calls(false);
1895 EntryCode(masm); 1879 EntryCode(masm);
1896 Label exit; 1880 Label exit;
1897 1881
1898 TestSmiXor(masm, &exit, 0x10, 0, 0); 1882 TestSmiXor(masm, &exit, 0x10, 0, 0);
1899 TestSmiXor(masm, &exit, 0x20, 0, 1); 1883 TestSmiXor(masm, &exit, 0x20, 0, 1);
1900 TestSmiXor(masm, &exit, 0x30, 1, 0); 1884 TestSmiXor(masm, &exit, 0x30, 1, 0);
1901 TestSmiXor(masm, &exit, 0x40, 0, -1); 1885 TestSmiXor(masm, &exit, 0x40, 0, -1);
1902 TestSmiXor(masm, &exit, 0x50, -1, 0); 1886 TestSmiXor(masm, &exit, 0x50, -1, 0);
1903 TestSmiXor(masm, &exit, 0x60, -1, -1); 1887 TestSmiXor(masm, &exit, 0x60, -1, -1);
1904 TestSmiXor(masm, &exit, 0x70, 1, 1); 1888 TestSmiXor(masm, &exit, 0x70, 1, 1);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 byte* buffer = 1936 byte* buffer =
1953 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1937 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1954 &actual_size, 1938 &actual_size,
1955 true)); 1939 true));
1956 CHECK(buffer); 1940 CHECK(buffer);
1957 Isolate* isolate = CcTest::i_isolate(); 1941 Isolate* isolate = CcTest::i_isolate();
1958 HandleScope handles(isolate); 1942 HandleScope handles(isolate);
1959 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 1943 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
1960 1944
1961 MacroAssembler* masm = &assembler; 1945 MacroAssembler* masm = &assembler;
1962 masm->set_allow_stub_calls(false);
1963 EntryCode(masm); 1946 EntryCode(masm);
1964 Label exit; 1947 Label exit;
1965 1948
1966 TestSmiNot(masm, &exit, 0x10, 0); 1949 TestSmiNot(masm, &exit, 0x10, 0);
1967 TestSmiNot(masm, &exit, 0x20, 1); 1950 TestSmiNot(masm, &exit, 0x20, 1);
1968 TestSmiNot(masm, &exit, 0x30, -1); 1951 TestSmiNot(masm, &exit, 0x30, -1);
1969 TestSmiNot(masm, &exit, 0x40, 127); 1952 TestSmiNot(masm, &exit, 0x40, 127);
1970 TestSmiNot(masm, &exit, 0x50, 65535); 1953 TestSmiNot(masm, &exit, 0x50, 65535);
1971 TestSmiNot(masm, &exit, 0x60, Smi::kMinValue); 1954 TestSmiNot(masm, &exit, 0x60, Smi::kMinValue);
1972 TestSmiNot(masm, &exit, 0x70, Smi::kMaxValue); 1955 TestSmiNot(masm, &exit, 0x70, Smi::kMaxValue);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 __ incq(rax); 2023 __ incq(rax);
2041 } 2024 }
2042 } 2025 }
2043 2026
2044 2027
2045 TEST(SmiShiftLeft) { 2028 TEST(SmiShiftLeft) {
2046 i::V8::Initialize(NULL); 2029 i::V8::Initialize(NULL);
2047 // Allocate an executable page of memory. 2030 // Allocate an executable page of memory.
2048 size_t actual_size; 2031 size_t actual_size;
2049 byte* buffer = 2032 byte* buffer =
2050 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, 2033 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 7,
2051 &actual_size, 2034 &actual_size,
2052 true)); 2035 true));
2053 CHECK(buffer); 2036 CHECK(buffer);
2054 Isolate* isolate = CcTest::i_isolate(); 2037 Isolate* isolate = CcTest::i_isolate();
2055 HandleScope handles(isolate); 2038 HandleScope handles(isolate);
2056 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 2039 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2057 2040
2058 MacroAssembler* masm = &assembler; 2041 MacroAssembler* masm = &assembler;
2059 masm->set_allow_stub_calls(false);
2060 EntryCode(masm); 2042 EntryCode(masm);
2061 Label exit; 2043 Label exit;
2062 2044
2063 TestSmiShiftLeft(masm, &exit, 0x10, 0); 2045 TestSmiShiftLeft(masm, &exit, 0x10, 0);
2064 TestSmiShiftLeft(masm, &exit, 0x50, 1); 2046 TestSmiShiftLeft(masm, &exit, 0x50, 1);
2065 TestSmiShiftLeft(masm, &exit, 0x90, 127); 2047 TestSmiShiftLeft(masm, &exit, 0x90, 127);
2066 TestSmiShiftLeft(masm, &exit, 0xD0, 65535); 2048 TestSmiShiftLeft(masm, &exit, 0xD0, 65535);
2067 TestSmiShiftLeft(masm, &exit, 0x110, Smi::kMaxValue); 2049 TestSmiShiftLeft(masm, &exit, 0x110, Smi::kMaxValue);
2068 TestSmiShiftLeft(masm, &exit, 0x150, Smi::kMinValue); 2050 TestSmiShiftLeft(masm, &exit, 0x150, Smi::kMinValue);
2069 TestSmiShiftLeft(masm, &exit, 0x190, -1); 2051 TestSmiShiftLeft(masm, &exit, 0x190, -1);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 } 2129 }
2148 } 2130 }
2149 } 2131 }
2150 2132
2151 2133
2152 TEST(SmiShiftLogicalRight) { 2134 TEST(SmiShiftLogicalRight) {
2153 i::V8::Initialize(NULL); 2135 i::V8::Initialize(NULL);
2154 // Allocate an executable page of memory. 2136 // Allocate an executable page of memory.
2155 size_t actual_size; 2137 size_t actual_size;
2156 byte* buffer = 2138 byte* buffer =
2157 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, 2139 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 5,
2158 &actual_size, 2140 &actual_size,
2159 true)); 2141 true));
2160 CHECK(buffer); 2142 CHECK(buffer);
2161 Isolate* isolate = CcTest::i_isolate(); 2143 Isolate* isolate = CcTest::i_isolate();
2162 HandleScope handles(isolate); 2144 HandleScope handles(isolate);
2163 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 2145 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2164 2146
2165 MacroAssembler* masm = &assembler; 2147 MacroAssembler* masm = &assembler;
2166 masm->set_allow_stub_calls(false);
2167 EntryCode(masm); 2148 EntryCode(masm);
2168 Label exit; 2149 Label exit;
2169 2150
2170 TestSmiShiftLogicalRight(masm, &exit, 0x10, 0); 2151 TestSmiShiftLogicalRight(masm, &exit, 0x10, 0);
2171 TestSmiShiftLogicalRight(masm, &exit, 0x30, 1); 2152 TestSmiShiftLogicalRight(masm, &exit, 0x30, 1);
2172 TestSmiShiftLogicalRight(masm, &exit, 0x50, 127); 2153 TestSmiShiftLogicalRight(masm, &exit, 0x50, 127);
2173 TestSmiShiftLogicalRight(masm, &exit, 0x70, 65535); 2154 TestSmiShiftLogicalRight(masm, &exit, 0x70, 65535);
2174 TestSmiShiftLogicalRight(masm, &exit, 0x90, Smi::kMaxValue); 2155 TestSmiShiftLogicalRight(masm, &exit, 0x90, Smi::kMaxValue);
2175 TestSmiShiftLogicalRight(masm, &exit, 0xB0, Smi::kMinValue); 2156 TestSmiShiftLogicalRight(masm, &exit, 0xB0, Smi::kMinValue);
2176 TestSmiShiftLogicalRight(masm, &exit, 0xD0, -1); 2157 TestSmiShiftLogicalRight(masm, &exit, 0xD0, -1);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 __ incq(rax); 2198 __ incq(rax);
2218 } 2199 }
2219 } 2200 }
2220 2201
2221 2202
2222 TEST(SmiShiftArithmeticRight) { 2203 TEST(SmiShiftArithmeticRight) {
2223 i::V8::Initialize(NULL); 2204 i::V8::Initialize(NULL);
2224 // Allocate an executable page of memory. 2205 // Allocate an executable page of memory.
2225 size_t actual_size; 2206 size_t actual_size;
2226 byte* buffer = 2207 byte* buffer =
2227 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 2208 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
2228 &actual_size, 2209 &actual_size,
2229 true)); 2210 true));
2230 CHECK(buffer); 2211 CHECK(buffer);
2231 Isolate* isolate = CcTest::i_isolate(); 2212 Isolate* isolate = CcTest::i_isolate();
2232 HandleScope handles(isolate); 2213 HandleScope handles(isolate);
2233 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 2214 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2234 2215
2235 MacroAssembler* masm = &assembler; 2216 MacroAssembler* masm = &assembler;
2236 masm->set_allow_stub_calls(false);
2237 EntryCode(masm); 2217 EntryCode(masm);
2238 Label exit; 2218 Label exit;
2239 2219
2240 TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0); 2220 TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0);
2241 TestSmiShiftArithmeticRight(masm, &exit, 0x20, 1); 2221 TestSmiShiftArithmeticRight(masm, &exit, 0x20, 1);
2242 TestSmiShiftArithmeticRight(masm, &exit, 0x30, 127); 2222 TestSmiShiftArithmeticRight(masm, &exit, 0x30, 127);
2243 TestSmiShiftArithmeticRight(masm, &exit, 0x40, 65535); 2223 TestSmiShiftArithmeticRight(masm, &exit, 0x40, 65535);
2244 TestSmiShiftArithmeticRight(masm, &exit, 0x50, Smi::kMaxValue); 2224 TestSmiShiftArithmeticRight(masm, &exit, 0x50, Smi::kMaxValue);
2245 TestSmiShiftArithmeticRight(masm, &exit, 0x60, Smi::kMinValue); 2225 TestSmiShiftArithmeticRight(masm, &exit, 0x60, Smi::kMinValue);
2246 TestSmiShiftArithmeticRight(masm, &exit, 0x70, -1); 2226 TestSmiShiftArithmeticRight(masm, &exit, 0x70, -1);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 byte* buffer = 2271 byte* buffer =
2292 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4, 2272 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
2293 &actual_size, 2273 &actual_size,
2294 true)); 2274 true));
2295 CHECK(buffer); 2275 CHECK(buffer);
2296 Isolate* isolate = CcTest::i_isolate(); 2276 Isolate* isolate = CcTest::i_isolate();
2297 HandleScope handles(isolate); 2277 HandleScope handles(isolate);
2298 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 2278 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2299 2279
2300 MacroAssembler* masm = &assembler; 2280 MacroAssembler* masm = &assembler;
2301 masm->set_allow_stub_calls(false);
2302 EntryCode(masm); 2281 EntryCode(masm);
2303 Label exit; 2282 Label exit;
2304 2283
2305 TestPositiveSmiPowerUp(masm, &exit, 0x20, 0); 2284 TestPositiveSmiPowerUp(masm, &exit, 0x20, 0);
2306 TestPositiveSmiPowerUp(masm, &exit, 0x40, 1); 2285 TestPositiveSmiPowerUp(masm, &exit, 0x40, 1);
2307 TestPositiveSmiPowerUp(masm, &exit, 0x60, 127); 2286 TestPositiveSmiPowerUp(masm, &exit, 0x60, 127);
2308 TestPositiveSmiPowerUp(masm, &exit, 0x80, 128); 2287 TestPositiveSmiPowerUp(masm, &exit, 0x80, 128);
2309 TestPositiveSmiPowerUp(masm, &exit, 0xA0, 255); 2288 TestPositiveSmiPowerUp(masm, &exit, 0xA0, 255);
2310 TestPositiveSmiPowerUp(masm, &exit, 0xC0, 256); 2289 TestPositiveSmiPowerUp(masm, &exit, 0xC0, 256);
2311 TestPositiveSmiPowerUp(masm, &exit, 0x100, 65535); 2290 TestPositiveSmiPowerUp(masm, &exit, 0x100, 65535);
(...skipping 23 matching lines...) Expand all
2335 byte* buffer = 2314 byte* buffer =
2336 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 2315 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2337 &actual_size, 2316 &actual_size,
2338 true)); 2317 true));
2339 CHECK(buffer); 2318 CHECK(buffer);
2340 Isolate* isolate = CcTest::i_isolate(); 2319 Isolate* isolate = CcTest::i_isolate();
2341 HandleScope handles(isolate); 2320 HandleScope handles(isolate);
2342 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 2321 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2343 2322
2344 MacroAssembler* masm = &assembler; 2323 MacroAssembler* masm = &assembler;
2345 masm->set_allow_stub_calls(false);
2346 Label exit; 2324 Label exit;
2347 2325
2348 EntryCode(masm); 2326 EntryCode(masm);
2349 __ push(r13); 2327 __ push(r13);
2350 __ push(r14); 2328 __ push(r14);
2351 __ push(rbx); 2329 __ push(rbx);
2352 __ push(rbp); 2330 __ push(rbp);
2353 __ push(Immediate(0x100)); // <-- rbp 2331 __ push(Immediate(0x100)); // <-- rbp
2354 __ movq(rbp, rsp); 2332 __ movq(rbp, rsp);
2355 __ push(Immediate(0x101)); 2333 __ push(Immediate(0x101));
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 // Allocate an executable page of memory. 2666 // Allocate an executable page of memory.
2689 size_t actual_size; 2667 size_t actual_size;
2690 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 2668 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
2691 &actual_size, 2669 &actual_size,
2692 true)); 2670 true));
2693 CHECK(buffer); 2671 CHECK(buffer);
2694 Isolate* isolate = CcTest::i_isolate(); 2672 Isolate* isolate = CcTest::i_isolate();
2695 HandleScope handles(isolate); 2673 HandleScope handles(isolate);
2696 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size)); 2674 MacroAssembler assembler(isolate, buffer, static_cast<int>(actual_size));
2697 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. 2675 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
2698 masm->set_allow_stub_calls(false);
2699 EntryCode(masm); 2676 EntryCode(masm);
2700 __ subq(rsp, Immediate(1 * kPointerSize)); 2677 __ subq(rsp, Immediate(1 * kPointerSize));
2701 Label exit; 2678 Label exit;
2702 2679
2703 // Test 1. 2680 // Test 1.
2704 __ movq(rax, Immediate(1)); // Test number. 2681 __ movq(rax, Immediate(1)); // Test number.
2705 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0)); 2682 __ movq(Operand(rsp, 0 * kPointerSize), Immediate(0));
2706 __ movq(rcx, Immediate(-1)); 2683 __ movq(rcx, Immediate(-1));
2707 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::UInteger8()); 2684 __ Store(Operand(rsp, 0 * kPointerSize), rcx, Representation::UInteger8());
2708 __ movq(rcx, Operand(rsp, 0 * kPointerSize)); 2685 __ movq(rcx, Operand(rsp, 0 * kPointerSize));
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2827 2804
2828 CodeDesc desc; 2805 CodeDesc desc;
2829 masm->GetCode(&desc); 2806 masm->GetCode(&desc);
2830 // Call the function from C++. 2807 // Call the function from C++.
2831 int result = FUNCTION_CAST<F0>(buffer)(); 2808 int result = FUNCTION_CAST<F0>(buffer)();
2832 CHECK_EQ(0, result); 2809 CHECK_EQ(0, result);
2833 } 2810 }
2834 2811
2835 2812
2836 #undef __ 2813 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-macro-assembler-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698