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

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

Issue 390004: Fix warnings on Win64. (Closed)
Patch Set: Created 11 years, 1 month 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
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 // Test that we can move a Smi value literally into a register. 127 // Test that we can move a Smi value literally into a register.
128 TEST(SmiMove) { 128 TEST(SmiMove) {
129 // Allocate an executable page of memory. 129 // Allocate an executable page of memory.
130 size_t actual_size; 130 size_t actual_size;
131 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 131 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
132 &actual_size, 132 &actual_size,
133 true)); 133 true));
134 CHECK(buffer); 134 CHECK(buffer);
135 HandleScope handles; 135 HandleScope handles;
136 MacroAssembler assembler(buffer, actual_size); 136 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
137 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro. 137 MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
138 masm->set_allow_stub_calls(false); 138 masm->set_allow_stub_calls(false);
139 Label exit; 139 Label exit;
140 140
141 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0)); 141 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0));
142 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127)); 142 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127));
143 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128)); 143 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128));
144 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255)); 144 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255));
145 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256)); 145 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256));
146 TestMoveSmi(masm, &exit, 6, Smi::FromInt(Smi::kMaxValue)); 146 TestMoveSmi(masm, &exit, 6, Smi::FromInt(Smi::kMaxValue));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // Test that we can compare smis for equality (and more). 211 // Test that we can compare smis for equality (and more).
212 TEST(SmiCompare) { 212 TEST(SmiCompare) {
213 // Allocate an executable page of memory. 213 // Allocate an executable page of memory.
214 size_t actual_size; 214 size_t actual_size;
215 byte* buffer = 215 byte* buffer =
216 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 216 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
217 &actual_size, 217 &actual_size,
218 true)); 218 true));
219 CHECK(buffer); 219 CHECK(buffer);
220 HandleScope handles; 220 HandleScope handles;
221 MacroAssembler assembler(buffer, actual_size); 221 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
222 222
223 MacroAssembler* masm = &assembler; 223 MacroAssembler* masm = &assembler;
224 masm->set_allow_stub_calls(false); 224 masm->set_allow_stub_calls(false);
225 Label exit; 225 Label exit;
226 226
227 TestSmiCompare(masm, &exit, 0x10, 0, 0); 227 TestSmiCompare(masm, &exit, 0x10, 0, 0);
228 TestSmiCompare(masm, &exit, 0x20, 0, 1); 228 TestSmiCompare(masm, &exit, 0x20, 0, 1);
229 TestSmiCompare(masm, &exit, 0x30, 1, 0); 229 TestSmiCompare(masm, &exit, 0x30, 1, 0);
230 TestSmiCompare(masm, &exit, 0x40, 1, 1); 230 TestSmiCompare(masm, &exit, 0x40, 1, 1);
231 TestSmiCompare(masm, &exit, 0x50, 0, -1); 231 TestSmiCompare(masm, &exit, 0x50, 0, -1);
(...skipping 26 matching lines...) Expand all
258 258
259 259
260 TEST(Integer32ToSmi) { 260 TEST(Integer32ToSmi) {
261 // Allocate an executable page of memory. 261 // Allocate an executable page of memory.
262 size_t actual_size; 262 size_t actual_size;
263 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 263 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
264 &actual_size, 264 &actual_size,
265 true)); 265 true));
266 CHECK(buffer); 266 CHECK(buffer);
267 HandleScope handles; 267 HandleScope handles;
268 MacroAssembler assembler(buffer, actual_size); 268 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
269 269
270 MacroAssembler* masm = &assembler; 270 MacroAssembler* masm = &assembler;
271 masm->set_allow_stub_calls(false); 271 masm->set_allow_stub_calls(false);
272 Label exit; 272 Label exit;
273 273
274 __ movq(rax, Immediate(1)); // Test number. 274 __ movq(rax, Immediate(1)); // Test number.
275 __ movl(rcx, Immediate(0)); 275 __ movl(rcx, Immediate(0));
276 __ Integer32ToSmi(rcx, rcx); 276 __ Integer32ToSmi(rcx, rcx);
277 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); 277 __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0)));
278 __ SmiCompare(rcx, rdx); 278 __ SmiCompare(rcx, rdx);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 357
358 358
359 void TestI64PlusConstantToSmi(MacroAssembler* masm, 359 void TestI64PlusConstantToSmi(MacroAssembler* masm,
360 Label* exit, 360 Label* exit,
361 int id, 361 int id,
362 int64_t x, 362 int64_t x,
363 int y) { 363 int y) {
364 int64_t result = x + y; 364 int64_t result = x + y;
365 ASSERT(Smi::IsValid(result)); 365 ASSERT(Smi::IsValid(result));
366 __ movl(rax, Immediate(id)); 366 __ movl(rax, Immediate(id));
367 __ Move(r8, Smi::FromInt(result)); 367 __ Move(r8, Smi::FromInt(static_cast<int>(result)));
368 __ movq(rcx, x, RelocInfo::NONE); 368 __ movq(rcx, x, RelocInfo::NONE);
369 __ movq(r11, rcx); 369 __ movq(r11, rcx);
370 __ Integer64PlusConstantToSmi(rdx, rcx, y); 370 __ Integer64PlusConstantToSmi(rdx, rcx, y);
371 __ SmiCompare(rdx, r8); 371 __ SmiCompare(rdx, r8);
372 __ j(not_equal, exit); 372 __ j(not_equal, exit);
373 373
374 __ incq(rax); 374 __ incq(rax);
375 __ SmiCompare(r11, rcx); 375 __ SmiCompare(r11, rcx);
376 __ j(not_equal, exit); 376 __ j(not_equal, exit);
377 377
378 __ incq(rax); 378 __ incq(rax);
379 __ Integer64PlusConstantToSmi(rcx, rcx, y); 379 __ Integer64PlusConstantToSmi(rcx, rcx, y);
380 __ SmiCompare(rcx, r8); 380 __ SmiCompare(rcx, r8);
381 __ j(not_equal, exit); 381 __ j(not_equal, exit);
382 } 382 }
383 383
384 384
385 TEST(Integer64PlusConstantToSmi) { 385 TEST(Integer64PlusConstantToSmi) {
386 // Allocate an executable page of memory. 386 // Allocate an executable page of memory.
387 size_t actual_size; 387 size_t actual_size;
388 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 388 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
389 &actual_size, 389 &actual_size,
390 true)); 390 true));
391 CHECK(buffer); 391 CHECK(buffer);
392 HandleScope handles; 392 HandleScope handles;
393 MacroAssembler assembler(buffer, actual_size); 393 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
394 394
395 MacroAssembler* masm = &assembler; 395 MacroAssembler* masm = &assembler;
396 masm->set_allow_stub_calls(false); 396 masm->set_allow_stub_calls(false);
397 Label exit; 397 Label exit;
398 398
399 int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2; 399 int64_t twice_max = static_cast<int64_t>(Smi::kMaxValue) * 2;
400 400
401 TestI64PlusConstantToSmi(masm, &exit, 0x10, 0, 0); 401 TestI64PlusConstantToSmi(masm, &exit, 0x10, 0, 0);
402 TestI64PlusConstantToSmi(masm, &exit, 0x20, 0, 1); 402 TestI64PlusConstantToSmi(masm, &exit, 0x20, 0, 1);
403 TestI64PlusConstantToSmi(masm, &exit, 0x30, 1, 0); 403 TestI64PlusConstantToSmi(masm, &exit, 0x30, 1, 0);
(...skipping 20 matching lines...) Expand all
424 424
425 425
426 TEST(SmiCheck) { 426 TEST(SmiCheck) {
427 // Allocate an executable page of memory. 427 // Allocate an executable page of memory.
428 size_t actual_size; 428 size_t actual_size;
429 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 429 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
430 &actual_size, 430 &actual_size,
431 true)); 431 true));
432 CHECK(buffer); 432 CHECK(buffer);
433 HandleScope handles; 433 HandleScope handles;
434 MacroAssembler assembler(buffer, actual_size); 434 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
435 435
436 MacroAssembler* masm = &assembler; 436 MacroAssembler* masm = &assembler;
437 masm->set_allow_stub_calls(false); 437 masm->set_allow_stub_calls(false);
438 Label exit; 438 Label exit;
439 Condition cond; 439 Condition cond;
440 440
441 __ movl(rax, Immediate(1)); // Test number. 441 __ movl(rax, Immediate(1)); // Test number.
442 442
443 // CheckSmi 443 // CheckSmi
444 444
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 669
670 TEST(SmiNeg) { 670 TEST(SmiNeg) {
671 // Allocate an executable page of memory. 671 // Allocate an executable page of memory.
672 size_t actual_size; 672 size_t actual_size;
673 byte* buffer = 673 byte* buffer =
674 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 674 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
675 &actual_size, 675 &actual_size,
676 true)); 676 true));
677 CHECK(buffer); 677 CHECK(buffer);
678 HandleScope handles; 678 HandleScope handles;
679 MacroAssembler assembler(buffer, actual_size); 679 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
680 680
681 MacroAssembler* masm = &assembler; 681 MacroAssembler* masm = &assembler;
682 masm->set_allow_stub_calls(false); 682 masm->set_allow_stub_calls(false);
683 Label exit; 683 Label exit;
684 684
685 TestSmiNeg(masm, &exit, 0x10, 0); 685 TestSmiNeg(masm, &exit, 0x10, 0);
686 TestSmiNeg(masm, &exit, 0x20, 1); 686 TestSmiNeg(masm, &exit, 0x20, 1);
687 TestSmiNeg(masm, &exit, 0x30, -1); 687 TestSmiNeg(masm, &exit, 0x30, -1);
688 TestSmiNeg(masm, &exit, 0x40, 127); 688 TestSmiNeg(masm, &exit, 0x40, 127);
689 TestSmiNeg(masm, &exit, 0x50, 65535); 689 TestSmiNeg(masm, &exit, 0x50, 65535);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 } 754 }
755 755
756 TEST(SmiAdd) { 756 TEST(SmiAdd) {
757 // Allocate an executable page of memory. 757 // Allocate an executable page of memory.
758 size_t actual_size; 758 size_t actual_size;
759 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 759 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
760 &actual_size, 760 &actual_size,
761 true)); 761 true));
762 CHECK(buffer); 762 CHECK(buffer);
763 HandleScope handles; 763 HandleScope handles;
764 MacroAssembler assembler(buffer, actual_size); 764 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
765 765
766 MacroAssembler* masm = &assembler; 766 MacroAssembler* masm = &assembler;
767 masm->set_allow_stub_calls(false); 767 masm->set_allow_stub_calls(false);
768 Label exit; 768 Label exit;
769 769
770 // No-overflow tests. 770 // No-overflow tests.
771 SmiAddTest(masm, &exit, 0x10, 1, 2); 771 SmiAddTest(masm, &exit, 0x10, 1, 2);
772 SmiAddTest(masm, &exit, 0x20, 1, -2); 772 SmiAddTest(masm, &exit, 0x20, 1, -2);
773 SmiAddTest(masm, &exit, 0x30, -1, 2); 773 SmiAddTest(masm, &exit, 0x30, -1, 2);
774 SmiAddTest(masm, &exit, 0x40, -1, -2); 774 SmiAddTest(masm, &exit, 0x40, -1, -2);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 941
942 TEST(SmiSub) { 942 TEST(SmiSub) {
943 // Allocate an executable page of memory. 943 // Allocate an executable page of memory.
944 size_t actual_size; 944 size_t actual_size;
945 byte* buffer = 945 byte* buffer =
946 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 946 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
947 &actual_size, 947 &actual_size,
948 true)); 948 true));
949 CHECK(buffer); 949 CHECK(buffer);
950 HandleScope handles; 950 HandleScope handles;
951 MacroAssembler assembler(buffer, actual_size); 951 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
952 952
953 MacroAssembler* masm = &assembler; 953 MacroAssembler* masm = &assembler;
954 masm->set_allow_stub_calls(false); 954 masm->set_allow_stub_calls(false);
955 Label exit; 955 Label exit;
956 956
957 SmiSubTest(masm, &exit, 0x10, 1, 2); 957 SmiSubTest(masm, &exit, 0x10, 1, 2);
958 SmiSubTest(masm, &exit, 0x20, 1, -2); 958 SmiSubTest(masm, &exit, 0x20, 1, -2);
959 SmiSubTest(masm, &exit, 0x30, -1, 2); 959 SmiSubTest(masm, &exit, 0x30, -1, 2);
960 SmiSubTest(masm, &exit, 0x40, -1, -2); 960 SmiSubTest(masm, &exit, 0x40, -1, -2);
961 SmiSubTest(masm, &exit, 0x50, 0x1000, 0x2000); 961 SmiSubTest(masm, &exit, 0x50, 0x1000, 0x2000);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 1028
1029 1029
1030 TEST(SmiMul) { 1030 TEST(SmiMul) {
1031 // Allocate an executable page of memory. 1031 // Allocate an executable page of memory.
1032 size_t actual_size; 1032 size_t actual_size;
1033 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1033 byte* buffer = static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1034 &actual_size, 1034 &actual_size,
1035 true)); 1035 true));
1036 CHECK(buffer); 1036 CHECK(buffer);
1037 HandleScope handles; 1037 HandleScope handles;
1038 MacroAssembler assembler(buffer, actual_size); 1038 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1039 1039
1040 MacroAssembler* masm = &assembler; 1040 MacroAssembler* masm = &assembler;
1041 masm->set_allow_stub_calls(false); 1041 masm->set_allow_stub_calls(false);
1042 Label exit; 1042 Label exit;
1043 1043
1044 TestSmiMul(masm, &exit, 0x10, 0, 0); 1044 TestSmiMul(masm, &exit, 0x10, 0, 0);
1045 TestSmiMul(masm, &exit, 0x20, -1, 0); 1045 TestSmiMul(masm, &exit, 0x20, -1, 0);
1046 TestSmiMul(masm, &exit, 0x30, 0, -1); 1046 TestSmiMul(masm, &exit, 0x30, 0, -1);
1047 TestSmiMul(masm, &exit, 0x40, -1, -1); 1047 TestSmiMul(masm, &exit, 0x40, -1, -1);
1048 TestSmiMul(masm, &exit, 0x50, 0x10000, 0x10000); 1048 TestSmiMul(masm, &exit, 0x50, 0x10000, 0x10000);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 1131
1132 TEST(SmiDiv) { 1132 TEST(SmiDiv) {
1133 // Allocate an executable page of memory. 1133 // Allocate an executable page of memory.
1134 size_t actual_size; 1134 size_t actual_size;
1135 byte* buffer = 1135 byte* buffer =
1136 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1136 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1137 &actual_size, 1137 &actual_size,
1138 true)); 1138 true));
1139 CHECK(buffer); 1139 CHECK(buffer);
1140 HandleScope handles; 1140 HandleScope handles;
1141 MacroAssembler assembler(buffer, actual_size); 1141 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1142 1142
1143 MacroAssembler* masm = &assembler; 1143 MacroAssembler* masm = &assembler;
1144 masm->set_allow_stub_calls(false); 1144 masm->set_allow_stub_calls(false);
1145 Label exit; 1145 Label exit;
1146 1146
1147 __ push(r12); 1147 __ push(r12);
1148 __ push(r15); 1148 __ push(r15);
1149 TestSmiDiv(masm, &exit, 0x10, 1, 1); 1149 TestSmiDiv(masm, &exit, 0x10, 1, 1);
1150 TestSmiDiv(masm, &exit, 0x20, 1, 0); 1150 TestSmiDiv(masm, &exit, 0x20, 1, 0);
1151 TestSmiDiv(masm, &exit, 0x30, -1, 0); 1151 TestSmiDiv(masm, &exit, 0x30, -1, 0);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 1238
1239 TEST(SmiMod) { 1239 TEST(SmiMod) {
1240 // Allocate an executable page of memory. 1240 // Allocate an executable page of memory.
1241 size_t actual_size; 1241 size_t actual_size;
1242 byte* buffer = 1242 byte* buffer =
1243 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1243 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1244 &actual_size, 1244 &actual_size,
1245 true)); 1245 true));
1246 CHECK(buffer); 1246 CHECK(buffer);
1247 HandleScope handles; 1247 HandleScope handles;
1248 MacroAssembler assembler(buffer, actual_size); 1248 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1249 1249
1250 MacroAssembler* masm = &assembler; 1250 MacroAssembler* masm = &assembler;
1251 masm->set_allow_stub_calls(false); 1251 masm->set_allow_stub_calls(false);
1252 Label exit; 1252 Label exit;
1253 1253
1254 __ push(r12); 1254 __ push(r12);
1255 __ push(r15); 1255 __ push(r15);
1256 TestSmiMod(masm, &exit, 0x10, 1, 1); 1256 TestSmiMod(masm, &exit, 0x10, 1, 1);
1257 TestSmiMod(masm, &exit, 0x20, 1, 0); 1257 TestSmiMod(masm, &exit, 0x20, 1, 0);
1258 TestSmiMod(masm, &exit, 0x30, -1, 0); 1258 TestSmiMod(masm, &exit, 0x30, -1, 0);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 1331
1332 TEST(SmiIndex) { 1332 TEST(SmiIndex) {
1333 // Allocate an executable page of memory. 1333 // Allocate an executable page of memory.
1334 size_t actual_size; 1334 size_t actual_size;
1335 byte* buffer = 1335 byte* buffer =
1336 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1336 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1337 &actual_size, 1337 &actual_size,
1338 true)); 1338 true));
1339 CHECK(buffer); 1339 CHECK(buffer);
1340 HandleScope handles; 1340 HandleScope handles;
1341 MacroAssembler assembler(buffer, actual_size); 1341 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1342 1342
1343 MacroAssembler* masm = &assembler; 1343 MacroAssembler* masm = &assembler;
1344 masm->set_allow_stub_calls(false); 1344 masm->set_allow_stub_calls(false);
1345 Label exit; 1345 Label exit;
1346 1346
1347 TestSmiIndex(masm, &exit, 0x10, 0); 1347 TestSmiIndex(masm, &exit, 0x10, 0);
1348 TestSmiIndex(masm, &exit, 0x20, 1); 1348 TestSmiIndex(masm, &exit, 0x20, 1);
1349 TestSmiIndex(masm, &exit, 0x30, 100); 1349 TestSmiIndex(masm, &exit, 0x30, 100);
1350 TestSmiIndex(masm, &exit, 0x40, 1000); 1350 TestSmiIndex(masm, &exit, 0x40, 1000);
1351 TestSmiIndex(masm, &exit, 0x50, Smi::kMaxValue); 1351 TestSmiIndex(masm, &exit, 0x50, Smi::kMaxValue);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 1397
1398 TEST(SmiSelectNonSmi) { 1398 TEST(SmiSelectNonSmi) {
1399 // Allocate an executable page of memory. 1399 // Allocate an executable page of memory.
1400 size_t actual_size; 1400 size_t actual_size;
1401 byte* buffer = 1401 byte* buffer =
1402 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1402 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1403 &actual_size, 1403 &actual_size,
1404 true)); 1404 true));
1405 CHECK(buffer); 1405 CHECK(buffer);
1406 HandleScope handles; 1406 HandleScope handles;
1407 MacroAssembler assembler(buffer, actual_size); 1407 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1408 1408
1409 MacroAssembler* masm = &assembler; 1409 MacroAssembler* masm = &assembler;
1410 masm->set_allow_stub_calls(false); // Avoid inline checks. 1410 masm->set_allow_stub_calls(false); // Avoid inline checks.
1411 Label exit; 1411 Label exit;
1412 1412
1413 TestSelectNonSmi(masm, &exit, 0x10, 0, 0); 1413 TestSelectNonSmi(masm, &exit, 0x10, 0, 0);
1414 TestSelectNonSmi(masm, &exit, 0x20, 0, 1); 1414 TestSelectNonSmi(masm, &exit, 0x20, 0, 1);
1415 TestSelectNonSmi(masm, &exit, 0x30, 1, 0); 1415 TestSelectNonSmi(masm, &exit, 0x30, 1, 0);
1416 TestSelectNonSmi(masm, &exit, 0x40, 0, -1); 1416 TestSelectNonSmi(masm, &exit, 0x40, 0, -1);
1417 TestSelectNonSmi(masm, &exit, 0x50, -1, 0); 1417 TestSelectNonSmi(masm, &exit, 0x50, -1, 0);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 1473
1474 TEST(SmiAnd) { 1474 TEST(SmiAnd) {
1475 // Allocate an executable page of memory. 1475 // Allocate an executable page of memory.
1476 size_t actual_size; 1476 size_t actual_size;
1477 byte* buffer = 1477 byte* buffer =
1478 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1478 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1479 &actual_size, 1479 &actual_size,
1480 true)); 1480 true));
1481 CHECK(buffer); 1481 CHECK(buffer);
1482 HandleScope handles; 1482 HandleScope handles;
1483 MacroAssembler assembler(buffer, actual_size); 1483 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1484 1484
1485 MacroAssembler* masm = &assembler; 1485 MacroAssembler* masm = &assembler;
1486 masm->set_allow_stub_calls(false); 1486 masm->set_allow_stub_calls(false);
1487 Label exit; 1487 Label exit;
1488 1488
1489 TestSmiAnd(masm, &exit, 0x10, 0, 0); 1489 TestSmiAnd(masm, &exit, 0x10, 0, 0);
1490 TestSmiAnd(masm, &exit, 0x20, 0, 1); 1490 TestSmiAnd(masm, &exit, 0x20, 0, 1);
1491 TestSmiAnd(masm, &exit, 0x30, 1, 0); 1491 TestSmiAnd(masm, &exit, 0x30, 1, 0);
1492 TestSmiAnd(masm, &exit, 0x40, 0, -1); 1492 TestSmiAnd(masm, &exit, 0x40, 0, -1);
1493 TestSmiAnd(masm, &exit, 0x50, -1, 0); 1493 TestSmiAnd(masm, &exit, 0x50, -1, 0);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 1551
1552 TEST(SmiOr) { 1552 TEST(SmiOr) {
1553 // Allocate an executable page of memory. 1553 // Allocate an executable page of memory.
1554 size_t actual_size; 1554 size_t actual_size;
1555 byte* buffer = 1555 byte* buffer =
1556 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1556 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1557 &actual_size, 1557 &actual_size,
1558 true)); 1558 true));
1559 CHECK(buffer); 1559 CHECK(buffer);
1560 HandleScope handles; 1560 HandleScope handles;
1561 MacroAssembler assembler(buffer, actual_size); 1561 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1562 1562
1563 MacroAssembler* masm = &assembler; 1563 MacroAssembler* masm = &assembler;
1564 masm->set_allow_stub_calls(false); 1564 masm->set_allow_stub_calls(false);
1565 Label exit; 1565 Label exit;
1566 1566
1567 TestSmiOr(masm, &exit, 0x10, 0, 0); 1567 TestSmiOr(masm, &exit, 0x10, 0, 0);
1568 TestSmiOr(masm, &exit, 0x20, 0, 1); 1568 TestSmiOr(masm, &exit, 0x20, 0, 1);
1569 TestSmiOr(masm, &exit, 0x30, 1, 0); 1569 TestSmiOr(masm, &exit, 0x30, 1, 0);
1570 TestSmiOr(masm, &exit, 0x40, 0, -1); 1570 TestSmiOr(masm, &exit, 0x40, 0, -1);
1571 TestSmiOr(masm, &exit, 0x50, -1, 0); 1571 TestSmiOr(masm, &exit, 0x50, -1, 0);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 1631
1632 TEST(SmiXor) { 1632 TEST(SmiXor) {
1633 // Allocate an executable page of memory. 1633 // Allocate an executable page of memory.
1634 size_t actual_size; 1634 size_t actual_size;
1635 byte* buffer = 1635 byte* buffer =
1636 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1636 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1637 &actual_size, 1637 &actual_size,
1638 true)); 1638 true));
1639 CHECK(buffer); 1639 CHECK(buffer);
1640 HandleScope handles; 1640 HandleScope handles;
1641 MacroAssembler assembler(buffer, actual_size); 1641 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1642 1642
1643 MacroAssembler* masm = &assembler; 1643 MacroAssembler* masm = &assembler;
1644 masm->set_allow_stub_calls(false); 1644 masm->set_allow_stub_calls(false);
1645 Label exit; 1645 Label exit;
1646 1646
1647 TestSmiXor(masm, &exit, 0x10, 0, 0); 1647 TestSmiXor(masm, &exit, 0x10, 0, 0);
1648 TestSmiXor(masm, &exit, 0x20, 0, 1); 1648 TestSmiXor(masm, &exit, 0x20, 0, 1);
1649 TestSmiXor(masm, &exit, 0x30, 1, 0); 1649 TestSmiXor(masm, &exit, 0x30, 1, 0);
1650 TestSmiXor(masm, &exit, 0x40, 0, -1); 1650 TestSmiXor(masm, &exit, 0x40, 0, -1);
1651 TestSmiXor(masm, &exit, 0x50, -1, 0); 1651 TestSmiXor(masm, &exit, 0x50, -1, 0);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 1695
1696 TEST(SmiNot) { 1696 TEST(SmiNot) {
1697 // Allocate an executable page of memory. 1697 // Allocate an executable page of memory.
1698 size_t actual_size; 1698 size_t actual_size;
1699 byte* buffer = 1699 byte* buffer =
1700 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize, 1700 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize,
1701 &actual_size, 1701 &actual_size,
1702 true)); 1702 true));
1703 CHECK(buffer); 1703 CHECK(buffer);
1704 HandleScope handles; 1704 HandleScope handles;
1705 MacroAssembler assembler(buffer, actual_size); 1705 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1706 1706
1707 MacroAssembler* masm = &assembler; 1707 MacroAssembler* masm = &assembler;
1708 masm->set_allow_stub_calls(false); 1708 masm->set_allow_stub_calls(false);
1709 Label exit; 1709 Label exit;
1710 1710
1711 TestSmiNot(masm, &exit, 0x10, 0); 1711 TestSmiNot(masm, &exit, 0x10, 0);
1712 TestSmiNot(masm, &exit, 0x20, 1); 1712 TestSmiNot(masm, &exit, 0x20, 1);
1713 TestSmiNot(masm, &exit, 0x30, -1); 1713 TestSmiNot(masm, &exit, 0x30, -1);
1714 TestSmiNot(masm, &exit, 0x40, 127); 1714 TestSmiNot(masm, &exit, 0x40, 127);
1715 TestSmiNot(masm, &exit, 0x50, 65535); 1715 TestSmiNot(masm, &exit, 0x50, 65535);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 1836
1837 TEST(SmiShiftLeft) { 1837 TEST(SmiShiftLeft) {
1838 // Allocate an executable page of memory. 1838 // Allocate an executable page of memory.
1839 size_t actual_size; 1839 size_t actual_size;
1840 byte* buffer = 1840 byte* buffer =
1841 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3, 1841 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
1842 &actual_size, 1842 &actual_size,
1843 true)); 1843 true));
1844 CHECK(buffer); 1844 CHECK(buffer);
1845 HandleScope handles; 1845 HandleScope handles;
1846 MacroAssembler assembler(buffer, actual_size); 1846 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1847 1847
1848 MacroAssembler* masm = &assembler; 1848 MacroAssembler* masm = &assembler;
1849 masm->set_allow_stub_calls(false); 1849 masm->set_allow_stub_calls(false);
1850 Label exit; 1850 Label exit;
1851 1851
1852 TestSmiShiftLeft(masm, &exit, 0x10, 0); 1852 TestSmiShiftLeft(masm, &exit, 0x10, 0);
1853 TestSmiShiftLeft(masm, &exit, 0x50, 1); 1853 TestSmiShiftLeft(masm, &exit, 0x50, 1);
1854 TestSmiShiftLeft(masm, &exit, 0x90, 127); 1854 TestSmiShiftLeft(masm, &exit, 0x90, 127);
1855 TestSmiShiftLeft(masm, &exit, 0xD0, 65535); 1855 TestSmiShiftLeft(masm, &exit, 0xD0, 65535);
1856 TestSmiShiftLeft(masm, &exit, 0x110, Smi::kMaxValue); 1856 TestSmiShiftLeft(masm, &exit, 0x110, Smi::kMaxValue);
(...skipping 16 matching lines...) Expand all
1873 Label* exit, 1873 Label* exit,
1874 int id, 1874 int id,
1875 int x) { 1875 int x) {
1876 const int shifts[] = { 0, 1, 7, 24, kSmiValueSize - 1}; 1876 const int shifts[] = { 0, 1, 7, 24, kSmiValueSize - 1};
1877 const int kNumShifts = 5; 1877 const int kNumShifts = 5;
1878 __ movl(rax, Immediate(id)); 1878 __ movl(rax, Immediate(id));
1879 for (int i = 0; i < kNumShifts; i++) { 1879 for (int i = 0; i < kNumShifts; i++) {
1880 int shift = shifts[i]; 1880 int shift = shifts[i];
1881 intptr_t result = static_cast<unsigned int>(x) >> shift; 1881 intptr_t result = static_cast<unsigned int>(x) >> shift;
1882 if (Smi::IsValid(result)) { 1882 if (Smi::IsValid(result)) {
1883 __ Move(r8, Smi::FromInt(result)); 1883 __ Move(r8, Smi::FromInt(static_cast<int>(result)));
1884 __ Move(rcx, Smi::FromInt(x)); 1884 __ Move(rcx, Smi::FromInt(x));
1885 __ SmiShiftLogicalRightConstant(r9, rcx, shift, exit); 1885 __ SmiShiftLogicalRightConstant(r9, rcx, shift, exit);
1886 1886
1887 __ incq(rax); 1887 __ incq(rax);
1888 __ SmiCompare(r9, r8); 1888 __ SmiCompare(r9, r8);
1889 __ j(not_equal, exit); 1889 __ j(not_equal, exit);
1890 1890
1891 __ incq(rax); 1891 __ incq(rax);
1892 __ Move(rdx, Smi::FromInt(x)); 1892 __ Move(rdx, Smi::FromInt(x));
1893 __ Move(rcx, Smi::FromInt(shift)); 1893 __ Move(rcx, Smi::FromInt(shift));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 1939
1940 TEST(SmiShiftLogicalRight) { 1940 TEST(SmiShiftLogicalRight) {
1941 // Allocate an executable page of memory. 1941 // Allocate an executable page of memory.
1942 size_t actual_size; 1942 size_t actual_size;
1943 byte* buffer = 1943 byte* buffer =
1944 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 1944 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1945 &actual_size, 1945 &actual_size,
1946 true)); 1946 true));
1947 CHECK(buffer); 1947 CHECK(buffer);
1948 HandleScope handles; 1948 HandleScope handles;
1949 MacroAssembler assembler(buffer, actual_size); 1949 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
1950 1950
1951 MacroAssembler* masm = &assembler; 1951 MacroAssembler* masm = &assembler;
1952 masm->set_allow_stub_calls(false); 1952 masm->set_allow_stub_calls(false);
1953 Label exit; 1953 Label exit;
1954 1954
1955 TestSmiShiftLogicalRight(masm, &exit, 0x10, 0); 1955 TestSmiShiftLogicalRight(masm, &exit, 0x10, 0);
1956 TestSmiShiftLogicalRight(masm, &exit, 0x30, 1); 1956 TestSmiShiftLogicalRight(masm, &exit, 0x30, 1);
1957 TestSmiShiftLogicalRight(masm, &exit, 0x50, 127); 1957 TestSmiShiftLogicalRight(masm, &exit, 0x50, 127);
1958 TestSmiShiftLogicalRight(masm, &exit, 0x70, 65535); 1958 TestSmiShiftLogicalRight(masm, &exit, 0x70, 65535);
1959 TestSmiShiftLogicalRight(masm, &exit, 0x90, Smi::kMaxValue); 1959 TestSmiShiftLogicalRight(masm, &exit, 0x90, Smi::kMaxValue);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2005 2005
2006 TEST(SmiShiftArithmeticRight) { 2006 TEST(SmiShiftArithmeticRight) {
2007 // Allocate an executable page of memory. 2007 // Allocate an executable page of memory.
2008 size_t actual_size; 2008 size_t actual_size;
2009 byte* buffer = 2009 byte* buffer =
2010 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 2010 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2011 &actual_size, 2011 &actual_size,
2012 true)); 2012 true));
2013 CHECK(buffer); 2013 CHECK(buffer);
2014 HandleScope handles; 2014 HandleScope handles;
2015 MacroAssembler assembler(buffer, actual_size); 2015 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
2016 2016
2017 MacroAssembler* masm = &assembler; 2017 MacroAssembler* masm = &assembler;
2018 masm->set_allow_stub_calls(false); 2018 masm->set_allow_stub_calls(false);
2019 Label exit; 2019 Label exit;
2020 2020
2021 TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0); 2021 TestSmiShiftArithmeticRight(masm, &exit, 0x10, 0);
2022 TestSmiShiftArithmeticRight(masm, &exit, 0x20, 1); 2022 TestSmiShiftArithmeticRight(masm, &exit, 0x20, 1);
2023 TestSmiShiftArithmeticRight(masm, &exit, 0x30, 127); 2023 TestSmiShiftArithmeticRight(masm, &exit, 0x30, 127);
2024 TestSmiShiftArithmeticRight(masm, &exit, 0x40, 65535); 2024 TestSmiShiftArithmeticRight(masm, &exit, 0x40, 65535);
2025 TestSmiShiftArithmeticRight(masm, &exit, 0x50, Smi::kMaxValue); 2025 TestSmiShiftArithmeticRight(masm, &exit, 0x50, Smi::kMaxValue);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 2066
2067 TEST(PositiveSmiTimesPowerOfTwoToInteger64) { 2067 TEST(PositiveSmiTimesPowerOfTwoToInteger64) {
2068 // Allocate an executable page of memory. 2068 // Allocate an executable page of memory.
2069 size_t actual_size; 2069 size_t actual_size;
2070 byte* buffer = 2070 byte* buffer =
2071 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2, 2071 static_cast<byte*>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2072 &actual_size, 2072 &actual_size,
2073 true)); 2073 true));
2074 CHECK(buffer); 2074 CHECK(buffer);
2075 HandleScope handles; 2075 HandleScope handles;
2076 MacroAssembler assembler(buffer, actual_size); 2076 MacroAssembler assembler(buffer, static_cast<int>(actual_size));
2077 2077
2078 MacroAssembler* masm = &assembler; 2078 MacroAssembler* masm = &assembler;
2079 masm->set_allow_stub_calls(false); 2079 masm->set_allow_stub_calls(false);
2080 Label exit; 2080 Label exit;
2081 2081
2082 TestPositiveSmiPowerUp(masm, &exit, 0x20, 0); 2082 TestPositiveSmiPowerUp(masm, &exit, 0x20, 0);
2083 TestPositiveSmiPowerUp(masm, &exit, 0x40, 1); 2083 TestPositiveSmiPowerUp(masm, &exit, 0x40, 1);
2084 TestPositiveSmiPowerUp(masm, &exit, 0x60, 127); 2084 TestPositiveSmiPowerUp(masm, &exit, 0x60, 127);
2085 TestPositiveSmiPowerUp(masm, &exit, 0x80, 128); 2085 TestPositiveSmiPowerUp(masm, &exit, 0x80, 128);
2086 TestPositiveSmiPowerUp(masm, &exit, 0xA0, 255); 2086 TestPositiveSmiPowerUp(masm, &exit, 0xA0, 255);
2087 TestPositiveSmiPowerUp(masm, &exit, 0xC0, 256); 2087 TestPositiveSmiPowerUp(masm, &exit, 0xC0, 256);
2088 TestPositiveSmiPowerUp(masm, &exit, 0x100, 65535); 2088 TestPositiveSmiPowerUp(masm, &exit, 0x100, 65535);
2089 TestPositiveSmiPowerUp(masm, &exit, 0x120, 65536); 2089 TestPositiveSmiPowerUp(masm, &exit, 0x120, 65536);
2090 TestPositiveSmiPowerUp(masm, &exit, 0x140, Smi::kMaxValue); 2090 TestPositiveSmiPowerUp(masm, &exit, 0x140, Smi::kMaxValue);
2091 2091
2092 __ xor_(rax, rax); // Success. 2092 __ xor_(rax, rax); // Success.
2093 __ bind(&exit); 2093 __ bind(&exit);
2094 __ ret(0); 2094 __ ret(0);
2095 2095
2096 CodeDesc desc; 2096 CodeDesc desc;
2097 masm->GetCode(&desc); 2097 masm->GetCode(&desc);
2098 // Call the function from C++. 2098 // Call the function from C++.
2099 int result = FUNCTION_CAST<F0>(buffer)(); 2099 int result = FUNCTION_CAST<F0>(buffer)();
2100 CHECK_EQ(0, result); 2100 CHECK_EQ(0, result);
2101 } 2101 }
2102 2102
2103 2103
2104 #undef __ 2104 #undef __
OLDNEW
« src/api.cc ('K') | « test/cctest/test-log-utils.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698