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

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

Issue 1506753002: [test] Test expectations in cctest should use CHECK and not DCHECK. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « test/cctest/test-liveedit.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 __ Move(rdx, Smi::FromInt(y)); 192 __ Move(rdx, Smi::FromInt(y));
193 __ movq(r9, rdx); 193 __ movq(r9, rdx);
194 __ SmiCompare(rcx, rdx); 194 __ SmiCompare(rcx, rdx);
195 if (x < y) { 195 if (x < y) {
196 __ movl(rax, Immediate(id + 1)); 196 __ movl(rax, Immediate(id + 1));
197 __ j(greater_equal, exit); 197 __ j(greater_equal, exit);
198 } else if (x > y) { 198 } else if (x > y) {
199 __ movl(rax, Immediate(id + 2)); 199 __ movl(rax, Immediate(id + 2));
200 __ j(less_equal, exit); 200 __ j(less_equal, exit);
201 } else { 201 } else {
202 DCHECK_EQ(x, y); 202 CHECK_EQ(x, y);
203 __ movl(rax, Immediate(id + 3)); 203 __ movl(rax, Immediate(id + 3));
204 __ j(not_equal, exit); 204 __ j(not_equal, exit);
205 } 205 }
206 __ movl(rax, Immediate(id + 4)); 206 __ movl(rax, Immediate(id + 4));
207 __ cmpq(rcx, r8); 207 __ cmpq(rcx, r8);
208 __ j(not_equal, exit); 208 __ j(not_equal, exit);
209 __ incq(rax); 209 __ incq(rax);
210 __ cmpq(rdx, r9); 210 __ cmpq(rdx, r9);
211 __ j(not_equal, exit); 211 __ j(not_equal, exit);
212 212
213 if (x != y) { 213 if (x != y) {
214 __ SmiCompare(rdx, rcx); 214 __ SmiCompare(rdx, rcx);
215 if (y < x) { 215 if (y < x) {
216 __ movl(rax, Immediate(id + 9)); 216 __ movl(rax, Immediate(id + 9));
217 __ j(greater_equal, exit); 217 __ j(greater_equal, exit);
218 } else { 218 } else {
219 DCHECK(y > x); 219 CHECK(y > x);
220 __ movl(rax, Immediate(id + 10)); 220 __ movl(rax, Immediate(id + 10));
221 __ j(less_equal, exit); 221 __ j(less_equal, exit);
222 } 222 }
223 } else { 223 } else {
224 __ cmpq(rcx, rcx); 224 __ cmpq(rcx, rcx);
225 __ movl(rax, Immediate(id + 11)); 225 __ movl(rax, Immediate(id + 11));
226 __ j(not_equal, exit); 226 __ j(not_equal, exit);
227 __ incq(rax); 227 __ incq(rax);
228 __ cmpq(rcx, r8); 228 __ cmpq(rcx, r8);
229 __ j(not_equal, exit); 229 __ j(not_equal, exit);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 CHECK_EQ(0, result); 381 CHECK_EQ(0, result);
382 } 382 }
383 383
384 384
385 void TestI64PlusConstantToSmi(MacroAssembler* masm, 385 void TestI64PlusConstantToSmi(MacroAssembler* masm,
386 Label* exit, 386 Label* exit,
387 int id, 387 int id,
388 int64_t x, 388 int64_t x,
389 int y) { 389 int y) {
390 int64_t result = x + y; 390 int64_t result = x + y;
391 DCHECK(Smi::IsValid(result)); 391 CHECK(Smi::IsValid(result));
392 __ movl(rax, Immediate(id)); 392 __ movl(rax, Immediate(id));
393 __ Move(r8, Smi::FromInt(static_cast<int>(result))); 393 __ Move(r8, Smi::FromInt(static_cast<int>(result)));
394 __ movq(rcx, x); 394 __ movq(rcx, x);
395 __ movq(r11, rcx); 395 __ movq(r11, rcx);
396 __ Integer64PlusConstantToSmi(rdx, rcx, y); 396 __ Integer64PlusConstantToSmi(rdx, rcx, y);
397 __ cmpq(rdx, r8); 397 __ cmpq(rdx, r8);
398 __ j(not_equal, exit); 398 __ j(not_equal, exit);
399 399
400 __ incq(rax); 400 __ incq(rax);
401 __ cmpq(r11, rcx); 401 __ cmpq(r11, rcx);
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 __ cmpq(rcx, r8); 771 __ cmpq(rcx, r8);
772 __ j(not_equal, exit); 772 __ j(not_equal, exit);
773 } 773 }
774 774
775 775
776 static void SmiAddOverflowTest(MacroAssembler* masm, 776 static void SmiAddOverflowTest(MacroAssembler* masm,
777 Label* exit, 777 Label* exit,
778 int id, 778 int id,
779 int x) { 779 int x) {
780 // Adds a Smi to x so that the addition overflows. 780 // Adds a Smi to x so that the addition overflows.
781 DCHECK(x != 0); // Can't overflow by adding a Smi. 781 CHECK(x != 0); // Can't overflow by adding a Smi.
782 int y_max = (x > 0) ? (Smi::kMaxValue + 0) : (Smi::kMinValue - x - 1); 782 int y_max = (x > 0) ? (Smi::kMaxValue + 0) : (Smi::kMinValue - x - 1);
783 int y_min = (x > 0) ? (Smi::kMaxValue - x + 1) : (Smi::kMinValue + 0); 783 int y_min = (x > 0) ? (Smi::kMaxValue - x + 1) : (Smi::kMinValue + 0);
784 784
785 __ movl(rax, Immediate(id)); 785 __ movl(rax, Immediate(id));
786 __ Move(rcx, Smi::FromInt(x)); 786 __ Move(rcx, Smi::FromInt(x));
787 __ movq(r11, rcx); // Store original Smi value of x in r11. 787 __ movq(r11, rcx); // Store original Smi value of x in r11.
788 __ Move(rdx, Smi::FromInt(y_min)); 788 __ Move(rdx, Smi::FromInt(y_min));
789 { 789 {
790 Label overflow_ok; 790 Label overflow_ok;
791 __ SmiAdd(r9, rcx, rdx, &overflow_ok); 791 __ SmiAdd(r9, rcx, rdx, &overflow_ok);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 __ cmpq(rcx, r8); 986 __ cmpq(rcx, r8);
987 __ j(not_equal, exit); 987 __ j(not_equal, exit);
988 } 988 }
989 989
990 990
991 static void SmiSubOverflowTest(MacroAssembler* masm, 991 static void SmiSubOverflowTest(MacroAssembler* masm,
992 Label* exit, 992 Label* exit,
993 int id, 993 int id,
994 int x) { 994 int x) {
995 // Subtracts a Smi from x so that the subtraction overflows. 995 // Subtracts a Smi from x so that the subtraction overflows.
996 DCHECK(x != -1); // Can't overflow by subtracting a Smi. 996 CHECK(x != -1); // Can't overflow by subtracting a Smi.
997 int y_max = (x < 0) ? (Smi::kMaxValue + 0) : (Smi::kMinValue + 0); 997 int y_max = (x < 0) ? (Smi::kMaxValue + 0) : (Smi::kMinValue + 0);
998 int y_min = (x < 0) ? (Smi::kMaxValue + x + 2) : (Smi::kMinValue + x); 998 int y_min = (x < 0) ? (Smi::kMaxValue + x + 2) : (Smi::kMinValue + x);
999 999
1000 __ movl(rax, Immediate(id)); 1000 __ movl(rax, Immediate(id));
1001 __ Move(rcx, Smi::FromInt(x)); 1001 __ Move(rcx, Smi::FromInt(x));
1002 __ movq(r11, rcx); // Store original Smi value of x in r11. 1002 __ movq(r11, rcx); // Store original Smi value of x in r11.
1003 __ Move(rdx, Smi::FromInt(y_min)); 1003 __ Move(rdx, Smi::FromInt(y_min));
1004 { 1004 {
1005 Label overflow_ok; 1005 Label overflow_ok;
1006 __ SmiSub(r9, rcx, rdx, &overflow_ok); 1006 __ SmiSub(r9, rcx, rdx, &overflow_ok);
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 CHECK_EQ(0, result); 1454 CHECK_EQ(0, result);
1455 } 1455 }
1456 1456
1457 1457
1458 void TestSmiIndex(MacroAssembler* masm, Label* exit, int id, int x) { 1458 void TestSmiIndex(MacroAssembler* masm, Label* exit, int id, int x) {
1459 __ movl(rax, Immediate(id)); 1459 __ movl(rax, Immediate(id));
1460 1460
1461 for (int i = 0; i < 8; i++) { 1461 for (int i = 0; i < 8; i++) {
1462 __ Move(rcx, Smi::FromInt(x)); 1462 __ Move(rcx, Smi::FromInt(x));
1463 SmiIndex index = masm->SmiToIndex(rdx, rcx, i); 1463 SmiIndex index = masm->SmiToIndex(rdx, rcx, i);
1464 DCHECK(index.reg.is(rcx) || index.reg.is(rdx)); 1464 CHECK(index.reg.is(rcx) || index.reg.is(rdx));
1465 __ shlq(index.reg, Immediate(index.scale)); 1465 __ shlq(index.reg, Immediate(index.scale));
1466 __ Set(r8, static_cast<intptr_t>(x) << i); 1466 __ Set(r8, static_cast<intptr_t>(x) << i);
1467 __ cmpq(index.reg, r8); 1467 __ cmpq(index.reg, r8);
1468 __ j(not_equal, exit); 1468 __ j(not_equal, exit);
1469 __ incq(rax); 1469 __ incq(rax);
1470 __ Move(rcx, Smi::FromInt(x)); 1470 __ Move(rcx, Smi::FromInt(x));
1471 index = masm->SmiToIndex(rcx, rcx, i); 1471 index = masm->SmiToIndex(rcx, rcx, i);
1472 DCHECK(index.reg.is(rcx)); 1472 CHECK(index.reg.is(rcx));
1473 __ shlq(rcx, Immediate(index.scale)); 1473 __ shlq(rcx, Immediate(index.scale));
1474 __ Set(r8, static_cast<intptr_t>(x) << i); 1474 __ Set(r8, static_cast<intptr_t>(x) << i);
1475 __ cmpq(rcx, r8); 1475 __ cmpq(rcx, r8);
1476 __ j(not_equal, exit); 1476 __ j(not_equal, exit);
1477 __ incq(rax); 1477 __ incq(rax);
1478 1478
1479 __ Move(rcx, Smi::FromInt(x)); 1479 __ Move(rcx, Smi::FromInt(x));
1480 index = masm->SmiToNegativeIndex(rdx, rcx, i); 1480 index = masm->SmiToNegativeIndex(rdx, rcx, i);
1481 DCHECK(index.reg.is(rcx) || index.reg.is(rdx)); 1481 CHECK(index.reg.is(rcx) || index.reg.is(rdx));
1482 __ shlq(index.reg, Immediate(index.scale)); 1482 __ shlq(index.reg, Immediate(index.scale));
1483 __ Set(r8, static_cast<intptr_t>(-x) << i); 1483 __ Set(r8, static_cast<intptr_t>(-x) << i);
1484 __ cmpq(index.reg, r8); 1484 __ cmpq(index.reg, r8);
1485 __ j(not_equal, exit); 1485 __ j(not_equal, exit);
1486 __ incq(rax); 1486 __ incq(rax);
1487 __ Move(rcx, Smi::FromInt(x)); 1487 __ Move(rcx, Smi::FromInt(x));
1488 index = masm->SmiToNegativeIndex(rcx, rcx, i); 1488 index = masm->SmiToNegativeIndex(rcx, rcx, i);
1489 DCHECK(index.reg.is(rcx)); 1489 CHECK(index.reg.is(rcx));
1490 __ shlq(rcx, Immediate(index.scale)); 1490 __ shlq(rcx, Immediate(index.scale));
1491 __ Set(r8, static_cast<intptr_t>(-x) << i); 1491 __ Set(r8, static_cast<intptr_t>(-x) << i);
1492 __ cmpq(rcx, r8); 1492 __ cmpq(rcx, r8);
1493 __ j(not_equal, exit); 1493 __ j(not_equal, exit);
1494 __ incq(rax); 1494 __ incq(rax);
1495 } 1495 }
1496 } 1496 }
1497 1497
1498 1498
1499 TEST(SmiIndex) { 1499 TEST(SmiIndex) {
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 2160
2161 CodeDesc desc; 2161 CodeDesc desc;
2162 masm->GetCode(&desc); 2162 masm->GetCode(&desc);
2163 // Call the function from C++. 2163 // Call the function from C++.
2164 int result = FUNCTION_CAST<F0>(buffer)(); 2164 int result = FUNCTION_CAST<F0>(buffer)();
2165 CHECK_EQ(0, result); 2165 CHECK_EQ(0, result);
2166 } 2166 }
2167 2167
2168 2168
2169 void TestPositiveSmiPowerUp(MacroAssembler* masm, Label* exit, int id, int x) { 2169 void TestPositiveSmiPowerUp(MacroAssembler* masm, Label* exit, int id, int x) {
2170 DCHECK(x >= 0); 2170 CHECK(x >= 0);
2171 int powers[] = { 0, 1, 2, 3, 8, 16, 24, 31 }; 2171 int powers[] = { 0, 1, 2, 3, 8, 16, 24, 31 };
2172 int power_count = 8; 2172 int power_count = 8;
2173 __ movl(rax, Immediate(id)); 2173 __ movl(rax, Immediate(id));
2174 for (int i = 0; i < power_count; i++) { 2174 for (int i = 0; i < power_count; i++) {
2175 int power = powers[i]; 2175 int power = powers[i];
2176 intptr_t result = static_cast<intptr_t>(x) << power; 2176 intptr_t result = static_cast<intptr_t>(x) << power;
2177 __ Set(r8, result); 2177 __ Set(r8, result);
2178 __ Move(rcx, Smi::FromInt(x)); 2178 __ Move(rcx, Smi::FromInt(x));
2179 __ movq(r11, rcx); 2179 __ movq(r11, rcx);
2180 __ PositiveSmiTimesPowerOfTwoToInteger64(rdx, rcx, power); 2180 __ PositiveSmiTimesPowerOfTwoToInteger64(rdx, rcx, power);
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
2726 2726
2727 CodeDesc desc; 2727 CodeDesc desc;
2728 masm->GetCode(&desc); 2728 masm->GetCode(&desc);
2729 // Call the function from C++. 2729 // Call the function from C++.
2730 int result = FUNCTION_CAST<F0>(buffer)(); 2730 int result = FUNCTION_CAST<F0>(buffer)();
2731 CHECK_EQ(0, result); 2731 CHECK_EQ(0, result);
2732 } 2732 }
2733 2733
2734 2734
2735 #undef __ 2735 #undef __
OLDNEW
« no previous file with comments | « test/cctest/test-liveedit.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698