43 using v8::internal::Immediate;
45 using v8::internal::Label;
48 using v8::internal::Operand;
49 using v8::internal::RelocInfo;
100 __ InitializeSmiConstantRegister();
101 __ InitializeRootRegister();
107 __ Move(
rdx, Smi::FromInt(1));
109 __ movq(
rdx, Immediate(-1));
118 int64_t test_numbers[] = {
119 0, 1, -1, 127, 128, -128, -129, 255, 256, -256, -257,
120 Smi::kMaxValue,
static_cast<int64_t
>(Smi::kMaxValue) + 1,
121 Smi::kMinValue, static_cast<int64_t>(Smi::kMinValue) - 1
123 int test_number_count = 15;
124 for (
int i = 0; i < test_number_count; i++) {
125 int64_t number = test_numbers[i];
126 bool is_valid = Smi::IsValid(number);
127 bool is_in_range = number >= Smi::kMinValue && number <= Smi::kMaxValue;
130 Smi* smi_from_intptr = Smi::FromIntptr(number);
131 if (static_cast<int>(number) == number) {
132 Smi* smi_from_int = Smi::FromInt(static_cast<int32_t>(number));
133 CHECK_EQ(smi_from_int, smi_from_intptr);
135 int64_t smi_value = smi_from_intptr->
value();
143 __ movl(
rax, Immediate(
id));
144 __ Move(
rcx, Smi::FromInt(0));
145 __ Set(
rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0)));
156 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
163 static_cast<int>(actual_size));
169 TestMoveSmi(masm, &exit, 1, Smi::FromInt(0));
170 TestMoveSmi(masm, &exit, 2, Smi::FromInt(127));
171 TestMoveSmi(masm, &exit, 3, Smi::FromInt(128));
172 TestMoveSmi(masm, &exit, 4, Smi::FromInt(255));
173 TestMoveSmi(masm, &exit, 5, Smi::FromInt(256));
174 TestMoveSmi(masm, &exit, 6, Smi::FromInt(Smi::kMaxValue));
175 TestMoveSmi(masm, &exit, 7, Smi::FromInt(-1));
176 TestMoveSmi(masm, &exit, 8, Smi::FromInt(-128));
177 TestMoveSmi(masm, &exit, 9, Smi::FromInt(-129));
178 TestMoveSmi(masm, &exit, 10, Smi::FromInt(-256));
179 TestMoveSmi(masm, &exit, 11, Smi::FromInt(-257));
180 TestMoveSmi(masm, &exit, 12, Smi::FromInt(Smi::kMinValue));
190 int result = FUNCTION_CAST<F0>(buffer)();
196 __ Move(
rcx, Smi::FromInt(x));
198 __ Move(
rdx, Smi::FromInt(y));
202 __ movl(
rax, Immediate(
id + 1));
205 __ movl(
rax, Immediate(
id + 2));
209 __ movl(
rax, Immediate(
id + 3));
212 __ movl(
rax, Immediate(
id + 4));
222 __ movl(
rax, Immediate(
id + 9));
226 __ movl(
rax, Immediate(
id + 10));
231 __ movl(
rax, Immediate(
id + 11));
246 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
253 static_cast<int>(actual_size));
275 TestSmiCompare(masm, &exit, 0x100, Smi::kMinValue, Smi::kMinValue);
276 TestSmiCompare(masm, &exit, 0x110, Smi::kMinValue, Smi::kMaxValue);
277 TestSmiCompare(masm, &exit, 0x120, Smi::kMaxValue, Smi::kMinValue);
278 TestSmiCompare(masm, &exit, 0x130, Smi::kMaxValue, Smi::kMaxValue);
288 int result = FUNCTION_CAST<F0>(buffer)();
298 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
305 static_cast<int>(actual_size));
312 __ movq(
rax, Immediate(1));
313 __ movl(
rcx, Immediate(0));
315 __ Set(
rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0)));
319 __ movq(
rax, Immediate(2));
320 __ movl(
rcx, Immediate(1024));
322 __ Set(
rdx, reinterpret_cast<intptr_t>(Smi::FromInt(1024)));
326 __ movq(
rax, Immediate(3));
327 __ movl(
rcx, Immediate(-1));
329 __ Set(
rdx, reinterpret_cast<intptr_t>(Smi::FromInt(-1)));
333 __ movq(
rax, Immediate(4));
334 __ movl(
rcx, Immediate(Smi::kMaxValue));
336 __ Set(
rdx, reinterpret_cast<intptr_t>(Smi::FromInt(Smi::kMaxValue)));
340 __ movq(
rax, Immediate(5));
341 __ movl(
rcx, Immediate(Smi::kMinValue));
343 __ Set(
rdx, reinterpret_cast<intptr_t>(Smi::FromInt(Smi::kMinValue)));
349 __ movq(
rax, Immediate(6));
350 __ movl(
rcx, Immediate(0));
352 __ Set(
rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0)));
356 __ movq(
rax, Immediate(7));
357 __ movl(
rcx, Immediate(1024));
359 __ Set(
rdx, reinterpret_cast<intptr_t>(Smi::FromInt(1024)));
363 __ movq(
rax, Immediate(8));
364 __ movl(
rcx, Immediate(-1));
366 __ Set(
rdx, reinterpret_cast<intptr_t>(Smi::FromInt(-1)));
370 __ movq(
rax, Immediate(9));
371 __ movl(
rcx, Immediate(Smi::kMaxValue));
373 __ Set(
rdx, reinterpret_cast<intptr_t>(Smi::FromInt(Smi::kMaxValue)));
377 __ movq(
rax, Immediate(10));
378 __ movl(
rcx, Immediate(Smi::kMinValue));
380 __ Set(
rdx, reinterpret_cast<intptr_t>(Smi::FromInt(Smi::kMinValue)));
393 int result = FUNCTION_CAST<F0>(buffer)();
403 int64_t result = x + y;
404 ASSERT(Smi::IsValid(result));
405 __ movl(
rax, Immediate(
id));
406 __ Move(
r8, Smi::FromInt(static_cast<int>(result)));
409 __ Integer64PlusConstantToSmi(
rdx,
rcx, y);
418 __ Integer64PlusConstantToSmi(
rcx,
rcx, y);
424 TEST(Integer64PlusConstantToSmi) {
428 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
435 static_cast<int>(actual_size));
442 int64_t twice_max =
static_cast<int64_t
>(Smi::kMaxValue) * 2;
465 int result = FUNCTION_CAST<F0>(buffer)();
474 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
481 static_cast<int>(actual_size));
489 __ movl(
rax, Immediate(1));
493 __ movl(
rcx, Immediate(0));
504 __ movl(
rcx, Immediate(-1));
515 __ movl(
rcx, Immediate(Smi::kMaxValue));
526 __ movl(
rcx, Immediate(Smi::kMinValue));
539 __ movl(
rcx, Immediate(0));
550 __ movq(
rcx, Immediate(-1));
556 __ movq(
rcx, Immediate(Smi::kMinValue));
567 __ movq(
rcx, Immediate(Smi::kMaxValue));
580 __ movq(
rcx, Immediate(Smi::kMaxValue));
586 __ movq(
rcx, Immediate(0));
592 __ movq(
rcx, Immediate(Smi::kMinValue));
598 __ movq(
rcx, Immediate(Smi::kMinValue + 1));
606 __ movq(
rcx, Immediate(Smi::kMaxValue));
608 __ movq(
rdx, Immediate(Smi::kMinValue));
638 __ movq(
rcx, Immediate(0));
643 __ movq(
rcx, Immediate(-1));
648 __ movq(
rcx, Immediate(Smi::kMaxValue));
653 __ movq(
rcx, Immediate(Smi::kMinValue));
667 int result = FUNCTION_CAST<F0>(buffer)();
674 __ Move(
rcx, Smi::FromInt(x));
676 if (x == Smi::kMinValue || x == 0) {
678 __ movl(
rax, Immediate(
id + 8));
692 Label smi_ok, smi_ok2;
694 __ movl(
rax, Immediate(
id));
695 __ Move(
r8, Smi::FromInt(result));
724 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
731 static_cast<int>(actual_size));
743 TestSmiNeg(masm, &exit, 0x60, Smi::kMinValue);
744 TestSmiNeg(masm, &exit, 0x70, Smi::kMaxValue);
745 TestSmiNeg(masm, &exit, 0x80, -Smi::kMaxValue);
755 int result = FUNCTION_CAST<F0>(buffer)();
767 __ movl(
rcx, Immediate(first));
769 __ movl(
rdx, Immediate(second));
771 __ movl(
r8, Immediate(first + second));
772 __ Integer32ToSmi(
r8,
r8);
774 __ movl(
rax, Immediate(
id));
784 __ movl(
rcx, Immediate(first));
788 __ SmiAddConstant(
r9,
rcx, Smi::FromInt(second));
792 __ SmiAddConstant(
rcx,
rcx, Smi::FromInt(second));
796 __ movl(
rcx, Immediate(first));
800 __ SmiAddConstant(
r9,
rcx, Smi::FromInt(second), exit);
805 __ SmiAddConstant(
rcx,
rcx, Smi::FromInt(second), exit);
814 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
821 static_cast<int>(actual_size));
829 SmiAddTest(masm, &exit, 0x10, 1, 2);
830 SmiAddTest(masm, &exit, 0x20, 1, -2);
831 SmiAddTest(masm, &exit, 0x30, -1, 2);
832 SmiAddTest(masm, &exit, 0x40, -1, -2);
833 SmiAddTest(masm, &exit, 0x50, 0x1000, 0x2000);
834 SmiAddTest(masm, &exit, 0x60, Smi::kMinValue, 5);
835 SmiAddTest(masm, &exit, 0x70, Smi::kMaxValue, -5);
836 SmiAddTest(masm, &exit, 0x80, Smi::kMaxValue, Smi::kMinValue);
846 int result = FUNCTION_CAST<F0>(buffer)();
856 __ Move(
rcx, Smi::FromInt(first));
857 __ Move(
rdx, Smi::FromInt(second));
858 __ Move(
r8, Smi::FromInt(first - second));
860 __ movl(
rax, Immediate(
id));
870 __ Move(
rcx, Smi::FromInt(first));
873 __ SmiSubConstant(
r9,
rcx, Smi::FromInt(second));
878 __ SmiSubConstant(
rcx,
rcx, Smi::FromInt(second));
882 __ Move(
rcx, Smi::FromInt(first));
885 __ SmiSubConstant(
r9,
rcx, Smi::FromInt(second), exit);
890 __ SmiSubConstant(
rcx,
rcx, Smi::FromInt(second), exit);
901 int y_max = (x < 0) ? (Smi::kMaxValue + 0) : (Smi::kMinValue + 0);
902 int y_min = (x < 0) ? (Smi::kMaxValue + x + 2) : (Smi::kMinValue + x);
904 __ movl(
rax, Immediate(
id));
905 __ Move(
rcx, Smi::FromInt(x));
907 __ Move(
rdx, Smi::FromInt(y_min));
912 __ bind(&overflow_ok);
923 __ bind(&overflow_ok);
933 __ SmiSubConstant(
r9,
rcx, Smi::FromInt(y_min), &overflow_ok);
935 __ bind(&overflow_ok);
944 __ SmiSubConstant(
rcx,
rcx, Smi::FromInt(y_min), &overflow_ok);
946 __ bind(&overflow_ok);
952 __ Move(
rdx, Smi::FromInt(y_max));
959 __ bind(&overflow_ok);
970 __ bind(&overflow_ok);
980 __ SmiSubConstant(
r9,
rcx, Smi::FromInt(y_max), &overflow_ok);
982 __ bind(&overflow_ok);
991 __ SmiSubConstant(
rcx,
rcx, Smi::FromInt(y_max), &overflow_ok);
993 __ bind(&overflow_ok);
1006 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1013 static_cast<int>(actual_size));
1020 SmiSubTest(masm, &exit, 0x10, 1, 2);
1021 SmiSubTest(masm, &exit, 0x20, 1, -2);
1022 SmiSubTest(masm, &exit, 0x30, -1, 2);
1023 SmiSubTest(masm, &exit, 0x40, -1, -2);
1024 SmiSubTest(masm, &exit, 0x50, 0x1000, 0x2000);
1025 SmiSubTest(masm, &exit, 0x60, Smi::kMinValue, -5);
1026 SmiSubTest(masm, &exit, 0x70, Smi::kMaxValue, 5);
1027 SmiSubTest(masm, &exit, 0x80, -Smi::kMaxValue, Smi::kMinValue);
1028 SmiSubTest(masm, &exit, 0x90, 0, Smi::kMaxValue);
1030 SmiSubOverflowTest(masm, &exit, 0xA0, 1);
1031 SmiSubOverflowTest(masm, &exit, 0xB0, 1024);
1032 SmiSubOverflowTest(masm, &exit, 0xC0, Smi::kMaxValue);
1033 SmiSubOverflowTest(masm, &exit, 0xD0, -2);
1034 SmiSubOverflowTest(masm, &exit, 0xE0, -42000);
1035 SmiSubOverflowTest(masm, &exit, 0xF0, Smi::kMinValue);
1036 SmiSubOverflowTest(masm, &exit, 0x100, 0);
1046 int result = FUNCTION_CAST<F0>(buffer)();
1053 int64_t result =
static_cast<int64_t
>(x) * static_cast<int64_t>(y);
1054 bool negative_zero = (result == 0) && (x < 0 || y < 0);
1055 __ Move(
rcx, Smi::FromInt(x));
1057 __ Move(
rdx, Smi::FromInt(y));
1058 if (Smi::IsValid(result) && !negative_zero) {
1059 __ movl(
rax, Immediate(
id));
1060 __ Move(
r8, Smi::FromIntptr(result));
1074 __ movl(
rax, Immediate(
id + 8));
1075 Label overflow_ok, overflow_ok2;
1078 __ bind(&overflow_ok);
1085 __ bind(&overflow_ok2);
1098 byte* buffer =
static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
1105 static_cast<int>(actual_size));
1116 TestSmiMul(masm, &exit, 0x50, 0x10000, 0x10000);
1117 TestSmiMul(masm, &exit, 0x60, 0x10000, 0xffff);
1118 TestSmiMul(masm, &exit, 0x70, 0x10000, 0xffff);
1119 TestSmiMul(masm, &exit, 0x80, Smi::kMaxValue, -1);
1120 TestSmiMul(masm, &exit, 0x90, Smi::kMaxValue, -2);
1121 TestSmiMul(masm, &exit, 0xa0, Smi::kMaxValue, 2);
1122 TestSmiMul(masm, &exit, 0xb0, (Smi::kMaxValue / 2), 2);
1123 TestSmiMul(masm, &exit, 0xc0, (Smi::kMaxValue / 2) + 1, 2);
1124 TestSmiMul(masm, &exit, 0xd0, (Smi::kMinValue / 2), 2);
1125 TestSmiMul(masm, &exit, 0xe0, (Smi::kMinValue / 2) - 1, 2);
1135 int result = FUNCTION_CAST<F0>(buffer)();
1141 bool division_by_zero = (y == 0);
1142 bool negative_zero = (x == 0 && y < 0);
1143 #ifdef V8_TARGET_ARCH_X64
1144 bool overflow = (x == Smi::kMinValue && y < 0);
1146 bool overflow = (x == Smi::kMinValue && y == -1);
1148 bool fraction = !division_by_zero && !overflow && (x % y != 0);
1149 __ Move(
r11, Smi::FromInt(x));
1150 __ Move(
r14, Smi::FromInt(y));
1151 if (!fraction && !overflow && !negative_zero && !division_by_zero) {
1154 __ movq(
r15, Immediate(
id));
1156 __ Move(
r8, Smi::FromInt(result));
1165 __ Move(
r14, Smi::FromInt(y));
1177 __ movq(
r15, Immediate(
id + 8));
1179 Label fail_ok, fail_ok2;
1206 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1213 static_cast<int>(actual_size));
1233 TestSmiDiv(masm, &exit, 0xc0, 1, Smi::kMaxValue);
1234 TestSmiDiv(masm, &exit, 0xd0, -1, Smi::kMaxValue);
1235 TestSmiDiv(masm, &exit, 0xe0, Smi::kMaxValue, 1);
1236 TestSmiDiv(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue);
1237 TestSmiDiv(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue);
1238 TestSmiDiv(masm, &exit, 0x110, Smi::kMaxValue, -1);
1239 TestSmiDiv(masm, &exit, 0x120, Smi::kMinValue, 1);
1240 TestSmiDiv(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue);
1241 TestSmiDiv(masm, &exit, 0x140, Smi::kMinValue, -1);
1254 int result = FUNCTION_CAST<F0>(buffer)();
1260 bool division_by_zero = (y == 0);
1261 bool division_overflow = (x == Smi::kMinValue) && (y == -1);
1262 bool fraction = !division_by_zero && !division_overflow && ((x % y) != 0);
1263 bool negative_zero = (!fraction && x < 0);
1264 __ Move(
rcx, Smi::FromInt(x));
1266 __ Move(
r14, Smi::FromInt(y));
1267 if (!division_overflow && !negative_zero && !division_by_zero) {
1269 __ movq(
r15, Immediate(
id));
1271 __ Move(
r8, Smi::FromInt(result));
1290 __ movq(
r15, Immediate(
id + 8));
1292 Label fail_ok, fail_ok2;
1318 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
1325 static_cast<int>(actual_size));
1345 TestSmiMod(masm, &exit, 0xc0, 1, Smi::kMaxValue);
1346 TestSmiMod(masm, &exit, 0xd0, -1, Smi::kMaxValue);
1347 TestSmiMod(masm, &exit, 0xe0, Smi::kMaxValue, 1);
1348 TestSmiMod(masm, &exit, 0xf0, Smi::kMaxValue, Smi::kMaxValue);
1349 TestSmiMod(masm, &exit, 0x100, Smi::kMaxValue, -Smi::kMaxValue);
1350 TestSmiMod(masm, &exit, 0x110, Smi::kMaxValue, -1);
1351 TestSmiMod(masm, &exit, 0x120, Smi::kMinValue, 1);
1352 TestSmiMod(masm, &exit, 0x130, Smi::kMinValue, Smi::kMinValue);
1353 TestSmiMod(masm, &exit, 0x140, Smi::kMinValue, -1);
1366 int result = FUNCTION_CAST<F0>(buffer)();
1372 __ movl(
rax, Immediate(
id));
1374 for (
int i = 0; i < 8; i++) {
1375 __ Move(
rcx, Smi::FromInt(x));
1379 __ Set(
r8, static_cast<intptr_t>(x) << i);
1383 __ Move(
rcx, Smi::FromInt(x));
1387 __ Set(
r8, static_cast<intptr_t>(x) << i);
1392 __ Move(
rcx, Smi::FromInt(x));
1396 __ Set(
r8, static_cast<intptr_t>(-x) << i);
1400 __ Move(
rcx, Smi::FromInt(x));
1404 __ Set(
r8, static_cast<intptr_t>(-x) << i);
1416 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
1423 static_cast<int>(actual_size));
1444 int result = FUNCTION_CAST<F0>(buffer)();
1450 __ movl(
rax, Immediate(
id));
1451 __ Move(
rcx, Smi::FromInt(x));
1452 __ Move(
rdx, Smi::FromInt(y));
1461 __ Move(
rcx, Smi::FromInt(x));
1462 __ Move(
rdx, Smi::FromInt(y));
1472 __ Move(
rcx, Smi::FromInt(x));
1473 __ Move(
rdx, Smi::FromInt(y));
1487 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
1494 static_cast<int>(actual_size));
1519 int result = FUNCTION_CAST<F0>(buffer)();
1527 __ movl(
rax, Immediate(
id));
1529 __ Move(
rcx, Smi::FromInt(x));
1531 __ Move(
rdx, Smi::FromInt(y));
1532 __ Move(
r8, Smi::FromInt(result));
1548 __ SmiAndConstant(
r9,
rcx, Smi::FromInt(y));
1557 __ SmiAndConstant(
rcx,
rcx, Smi::FromInt(y));
1568 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
1575 static_cast<int>(actual_size));
1589 TestSmiAnd(masm, &exit, 0x80, Smi::kMinValue, Smi::kMaxValue);
1590 TestSmiAnd(masm, &exit, 0x90, Smi::kMinValue, Smi::kMinValue);
1591 TestSmiAnd(masm, &exit, 0xA0, Smi::kMinValue, -1);
1592 TestSmiAnd(masm, &exit, 0xB0, Smi::kMinValue, -1);
1602 int result = FUNCTION_CAST<F0>(buffer)();
1610 __ movl(
rax, Immediate(
id));
1612 __ Move(
rcx, Smi::FromInt(x));
1614 __ Move(
rdx, Smi::FromInt(y));
1615 __ Move(
r8, Smi::FromInt(result));
1631 __ SmiOrConstant(
r9,
rcx, Smi::FromInt(y));
1640 __ SmiOrConstant(
rcx,
rcx, Smi::FromInt(y));
1651 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
1658 static_cast<int>(actual_size));
1672 TestSmiOr(masm, &exit, 0x80, Smi::kMinValue, Smi::kMaxValue);
1673 TestSmiOr(masm, &exit, 0x90, Smi::kMinValue, Smi::kMinValue);
1674 TestSmiOr(masm, &exit, 0xA0, Smi::kMinValue, -1);
1675 TestSmiOr(masm, &exit, 0xB0, 0x05555555, 0x01234567);
1676 TestSmiOr(masm, &exit, 0xC0, 0x05555555, 0x0fedcba9);
1677 TestSmiOr(masm, &exit, 0xD0, Smi::kMinValue, -1);
1687 int result = FUNCTION_CAST<F0>(buffer)();
1695 __ movl(
rax, Immediate(
id));
1697 __ Move(
rcx, Smi::FromInt(x));
1699 __ Move(
rdx, Smi::FromInt(y));
1700 __ Move(
r8, Smi::FromInt(result));
1716 __ SmiXorConstant(
r9,
rcx, Smi::FromInt(y));
1725 __ SmiXorConstant(
rcx,
rcx, Smi::FromInt(y));
1736 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
1743 static_cast<int>(actual_size));
1757 TestSmiXor(masm, &exit, 0x80, Smi::kMinValue, Smi::kMaxValue);
1758 TestSmiXor(masm, &exit, 0x90, Smi::kMinValue, Smi::kMinValue);
1759 TestSmiXor(masm, &exit, 0xA0, Smi::kMinValue, -1);
1760 TestSmiXor(masm, &exit, 0xB0, 0x5555555, 0x01234567);
1761 TestSmiXor(masm, &exit, 0xC0, 0x5555555, 0x0fedcba9);
1762 TestSmiXor(masm, &exit, 0xD0, Smi::kMinValue, -1);
1772 int result = FUNCTION_CAST<F0>(buffer)();
1779 __ movl(
rax, Immediate(
id));
1781 __ Move(
r8, Smi::FromInt(result));
1782 __ Move(
rcx, Smi::FromInt(x));
1805 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize,
1812 static_cast<int>(actual_size));
1824 TestSmiNot(masm, &exit, 0x60, Smi::kMinValue);
1825 TestSmiNot(masm, &exit, 0x70, Smi::kMaxValue);
1836 int result = FUNCTION_CAST<F0>(buffer)();
1843 const int kNumShifts = 5;
1844 __ movl(
rax, Immediate(
id));
1845 for (
int i = 0; i < kNumShifts; i++) {
1847 int shift = shifts[i];
1848 int result = x << shift;
1849 CHECK(Smi::IsValid(result));
1850 __ Move(
r8, Smi::FromInt(result));
1851 __ Move(
rcx, Smi::FromInt(x));
1852 __ SmiShiftLeftConstant(
r9,
rcx, shift);
1859 __ Move(
rcx, Smi::FromInt(x));
1860 __ SmiShiftLeftConstant(
rcx,
rcx, shift);
1867 __ Move(
rdx, Smi::FromInt(x));
1868 __ Move(
rcx, Smi::FromInt(shift));
1876 __ Move(
rdx, Smi::FromInt(x));
1877 __ Move(
r11, Smi::FromInt(shift));
1885 __ Move(
rdx, Smi::FromInt(x));
1886 __ Move(
r11, Smi::FromInt(shift));
1903 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
1910 static_cast<int>(actual_size));
1933 int result = FUNCTION_CAST<F0>(buffer)();
1943 const int kNumShifts = 5;
1944 __ movl(
rax, Immediate(
id));
1945 for (
int i = 0; i < kNumShifts; i++) {
1946 int shift = shifts[i];
1947 intptr_t result =
static_cast<unsigned int>(x) >> shift;
1948 if (Smi::IsValid(result)) {
1949 __ Move(
r8, Smi::FromInt(static_cast<int>(result)));
1950 __ Move(
rcx, Smi::FromInt(x));
1951 __ SmiShiftLogicalRightConstant(
r9,
rcx, shift, exit);
1958 __ Move(
rdx, Smi::FromInt(x));
1959 __ Move(
rcx, Smi::FromInt(shift));
1967 __ Move(
rdx, Smi::FromInt(x));
1968 __ Move(
r11, Smi::FromInt(shift));
1979 __ Move(
rcx, Smi::FromInt(x));
1981 __ SmiShiftLogicalRightConstant(
r9,
rcx, shift, &fail_ok);
1990 __ Move(
r8, Smi::FromInt(shift));
1992 __ SmiShiftLogicalRight(
r9,
rcx,
r8, &fail_ok3);
2000 __ addq(
rax, Immediate(3));
2011 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize * 3,
2018 static_cast<int>(actual_size));
2041 int result = FUNCTION_CAST<F0>(buffer)();
2051 const int kNumShifts = 5;
2052 __ movl(
rax, Immediate(
id));
2053 for (
int i = 0; i < kNumShifts; i++) {
2054 int shift = shifts[i];
2056 int result = (x < 0) ? ~((~x) >> shift) : (x >> shift);
2057 __ Move(
r8, Smi::FromInt(result));
2058 __ Move(
rcx, Smi::FromInt(x));
2059 __ SmiShiftArithmeticRightConstant(
rcx,
rcx, shift);
2065 __ Move(
rdx, Smi::FromInt(x));
2066 __ Move(
r11, Smi::FromInt(shift));
2082 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2089 static_cast<int>(actual_size));
2112 int result = FUNCTION_CAST<F0>(buffer)();
2119 int powers[] = { 0, 1, 2, 3, 8, 16, 24, 31 };
2120 int power_count = 8;
2121 __ movl(
rax, Immediate(
id));
2122 for (
int i = 0; i < power_count; i++) {
2123 int power = powers[i];
2124 intptr_t result =
static_cast<intptr_t
>(x) << power;
2126 __ Move(
rcx, Smi::FromInt(x));
2128 __ PositiveSmiTimesPowerOfTwoToInteger64(
rdx,
rcx, power);
2135 __ PositiveSmiTimesPowerOfTwoToInteger64(
rcx,
rcx, power);
2143 TEST(PositiveSmiTimesPowerOfTwoToInteger64) {
2148 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize * 4,
2155 static_cast<int>(actual_size));
2180 int result = FUNCTION_CAST<F0>(buffer)();
2188 for (
int i = 0; i < 256; i++) { data[i] = i * 0x01010101; }
2193 static_cast<byte*
>(OS::Allocate(Assembler::kMinimalBufferSize * 2,
2200 static_cast<int>(actual_size));
2211 __ push(Immediate(0x100));
2213 __ push(Immediate(0x101));
2214 __ push(Immediate(0x102));
2215 __ push(Immediate(0x103));
2216 __ push(Immediate(0x104));
2217 __ push(Immediate(0x105));
2218 __ push(Immediate(0x106));
2219 __ push(Immediate(0x107));
2220 __ push(Immediate(0x108));
2221 __ push(Immediate(0x109));
2229 __ movl(
rcx, Immediate(2));
2231 __ movl(
rax, Immediate(1));
2233 Operand sp0 = Operand(
rsp, 0);
2237 __ cmpl(
rdx, Immediate(0x109));
2244 __ cmpl(
rdx, Immediate(0x107));
2252 __ cmpl(
rdx, Immediate(0x107));
2257 __ cmpl(
rdx, Immediate(0x105));
2263 __ cmpl(
rdx, Immediate(0x109));
2270 __ movl(
rdx, sp2c2);
2271 __ cmpl(
rdx, Immediate(0x105));
2276 __ cmpl(
rdx, Immediate(0x103));
2282 __ cmpl(
rdx, Immediate(0x107));
2287 Operand bp0 = Operand(
rbp, 0);
2291 __ cmpl(
rdx, Immediate(0x100));
2297 __ cmpl(
rdx, Immediate(0x102));
2305 __ cmpl(
rdx, Immediate(0x102));
2311 __ cmpl(
rdx, Immediate(0x100));
2316 __ cmpl(
rdx, Immediate(0x104));
2323 __ movl(
rdx, bp2c4);
2324 __ cmpl(
rdx, Immediate(0x102));
2329 __ cmpl(
rdx, Immediate(0x100));
2334 __ cmpl(
rdx, Immediate(0x104));
2338 Operand bx0 = Operand(
rbx, 0);
2342 __ cmpl(
rdx, Immediate(0x105));
2347 __ cmpl(
rdx, Immediate(0x100));
2352 __ cmpl(
rdx, Immediate(0x109));
2360 __ cmpl(
rdx, Immediate(0x103));
2365 __ cmpl(
rdx, Immediate(0x101));
2371 __ cmpl(
rdx, Immediate(0x105));
2378 __ movl(
rdx, bx2c2);
2379 __ cmpl(
rdx, Immediate(0x105));
2384 __ cmpl(
rdx, Immediate(0x103));
2389 __ cmpl(
rdx, Immediate(0x107));
2393 Operand r80 = Operand(
r8, 0);
2397 __ cmpl(
rdx, Immediate(0x80808080));
2402 __ cmpl(
rdx, Immediate(0x78787878));
2407 __ cmpl(
rdx, Immediate(0x88888888));
2412 __ cmpl(
rdx, Immediate(0x40404040));
2417 __ cmpl(
rdx, Immediate(0xC0C0C0C0));
2425 __ cmpl(
rdx, Immediate(0x88888888));
2430 __ cmpl(
rdx, Immediate(0x80808080));
2435 __ cmpl(
rdx, Immediate(0x90909090));
2440 __ cmpl(
rdx, Immediate(0x48484848));
2445 __ cmpl(
rdx, Immediate(0xC8C8C8C8));
2454 __ cmpl(
rdx, Immediate(0xC0C0C0C0));
2459 __ cmpl(
rdx, Immediate(0xB8B8B8B8));
2464 __ cmpl(
rdx, Immediate(0xC8C8C8C8));
2469 __ cmpl(
rdx, Immediate(0x80808080));
2474 __ cmpl(
rdx, Immediate(0xE0E0E0E0));
2480 __ cmpl(
rdx, Immediate(0x84848484));
2485 __ cmpl(
rdx, Immediate(0xFCFCFCFC));
2492 __ movl(
rdx, Operand(r80, 2));
2493 __ cmpl(
rdx, Immediate(0x81818080));
2497 __ movl(
rdx, Operand(r80, -2));
2498 __ cmpl(
rdx, Immediate(0x80807F7F));
2502 __ movl(
rdx, Operand(r80, 126));
2503 __ cmpl(
rdx, Immediate(0xA0A09F9F));
2507 __ movl(
rdx, Operand(r80, -126));
2508 __ cmpl(
rdx, Immediate(0x61616060));
2512 __ movl(
rdx, Operand(r80, 254));
2513 __ cmpl(
rdx, Immediate(0xC0C0BFBF));
2517 __ movl(
rdx, Operand(r80, -254));
2518 __ cmpl(
rdx, Immediate(0x41414040));
2524 __ movl(
rax, Immediate(0));
2538 int result = FUNCTION_CAST<F0>(buffer)();
void TestI64PlusConstantToSmi(MacroAssembler *masm, Label *exit, int id, int64_t x, int y)
static bool Initialize(Deserializer *des)
const intptr_t kSmiTagMask
#define CHECK_EQ(expected, value)
SmiIndex SmiToNegativeIndex(Register dst, Register src, int shift)
void TestSmiIndex(MacroAssembler *masm, Label *exit, int id, int x)
void TestSmiMod(MacroAssembler *masm, Label *exit, int id, int x, int y)
void TestSmiNot(MacroAssembler *masm, Label *exit, int id, int x)
void set_allow_stub_calls(bool value)
SmiIndex SmiToIndex(Register dst, Register src, int shift)
#define ASSERT(condition)
Condition CheckIsMinSmi(Register src)
void TestSmiMul(MacroAssembler *masm, Label *exit, int id, int x, int y)
void TestSmiShiftLogicalRight(MacroAssembler *masm, Label *exit, int id, int x)
Condition CheckBothSmi(Register first, Register second)
void TestSmiShiftArithmeticRight(MacroAssembler *masm, Label *exit, int id, int x)
const Register kRootRegister
void TestSmiShiftLeft(MacroAssembler *masm, Label *exit, int id, int x)
void GetCode(CodeDesc *desc)
Condition CheckInteger32ValidSmiValue(Register src)
void TestSmiDiv(MacroAssembler *masm, Label *exit, int id, int x, int y)
void TestSmiXor(MacroAssembler *masm, Label *exit, int id, int x, int y)
void TestSmiAnd(MacroAssembler *masm, Label *exit, int id, int x, int y)
bool is(Register reg) const
void TestSmiCompare(MacroAssembler *masm, Label *exit, int id, int x, int y)
Condition NegateCondition(Condition cond)
#define ASSERT_EQ(v1, v2)
void TestSelectNonSmi(MacroAssembler *masm, Label *exit, int id, int x, int y)
void TestPositiveSmiPowerUp(MacroAssembler *masm, Label *exit, int id, int x)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL
Condition CheckNonNegativeSmi(Register src)
Condition CheckSmi(Register src)
const Register kSmiConstantRegister
void TestSmiOr(MacroAssembler *masm, Label *exit, int id, int x, int y)
void TestSmiNeg(MacroAssembler *masm, Label *exit, int id, int x)
F FUNCTION_CAST(Address addr)