OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 void Move(const Operand& dst, Smi* source) { | 533 void Move(const Operand& dst, Smi* source) { |
534 Register constant = GetSmiConstant(source); | 534 Register constant = GetSmiConstant(source); |
535 movq(dst, constant); | 535 movq(dst, constant); |
536 } | 536 } |
537 | 537 |
538 void Push(Smi* smi); | 538 void Push(Smi* smi); |
539 void Test(const Operand& dst, Smi* source); | 539 void Test(const Operand& dst, Smi* source); |
540 | 540 |
541 // --------------------------------------------------------------------------- | 541 // --------------------------------------------------------------------------- |
542 // String macros. | 542 // String macros. |
| 543 |
| 544 // If object is a string, its map is loaded into object_map. |
| 545 template <typename LabelType> |
| 546 void JumpIfNotString(Register object, |
| 547 Register object_map, |
| 548 LabelType* not_string); |
| 549 |
| 550 |
543 template <typename LabelType> | 551 template <typename LabelType> |
544 void JumpIfNotBothSequentialAsciiStrings(Register first_object, | 552 void JumpIfNotBothSequentialAsciiStrings(Register first_object, |
545 Register second_object, | 553 Register second_object, |
546 Register scratch1, | 554 Register scratch1, |
547 Register scratch2, | 555 Register scratch2, |
548 LabelType* on_not_both_flat_ascii); | 556 LabelType* on_not_both_flat_ascii); |
549 | 557 |
550 // Check whether the instance type represents a flat ascii string. Jump to the | 558 // Check whether the instance type represents a flat ascii string. Jump to the |
551 // label if not. If the instance type can be scratched specify same register | 559 // label if not. If the instance type can be scratched specify same register |
552 // for both instance type and scratch. | 560 // for both instance type and scratch. |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 | 1459 |
1452 template <typename LabelType> | 1460 template <typename LabelType> |
1453 void MacroAssembler::SmiShiftLogicalRight(Register dst, | 1461 void MacroAssembler::SmiShiftLogicalRight(Register dst, |
1454 Register src1, | 1462 Register src1, |
1455 Register src2, | 1463 Register src2, |
1456 LabelType* on_not_smi_result) { | 1464 LabelType* on_not_smi_result) { |
1457 ASSERT(!dst.is(kScratchRegister)); | 1465 ASSERT(!dst.is(kScratchRegister)); |
1458 ASSERT(!src1.is(kScratchRegister)); | 1466 ASSERT(!src1.is(kScratchRegister)); |
1459 ASSERT(!src2.is(kScratchRegister)); | 1467 ASSERT(!src2.is(kScratchRegister)); |
1460 ASSERT(!dst.is(rcx)); | 1468 ASSERT(!dst.is(rcx)); |
| 1469 // dst and src1 can be the same, because the one case that bails out |
| 1470 // is a shift by 0, which leaves dst, and therefore src1, unchanged. |
1461 NearLabel result_ok; | 1471 NearLabel result_ok; |
1462 if (src1.is(rcx) || src2.is(rcx)) { | 1472 if (src1.is(rcx) || src2.is(rcx)) { |
1463 movq(kScratchRegister, rcx); | 1473 movq(kScratchRegister, rcx); |
1464 } | 1474 } |
1465 if (!dst.is(src1)) { | 1475 if (!dst.is(src1)) { |
1466 movq(dst, src1); | 1476 movq(dst, src1); |
1467 } | 1477 } |
1468 SmiToInteger32(rcx, src2); | 1478 SmiToInteger32(rcx, src2); |
1469 orl(rcx, Immediate(kSmiShift)); | 1479 orl(rcx, Immediate(kSmiShift)); |
1470 shr_cl(dst); // Shift is rcx modulo 0x1f + 32. | 1480 shr_cl(dst); // Shift is rcx modulo 0x1f + 32. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 template <typename LabelType> | 1595 template <typename LabelType> |
1586 void MacroAssembler::JumpUnlessBothNonNegativeSmi(Register src1, | 1596 void MacroAssembler::JumpUnlessBothNonNegativeSmi(Register src1, |
1587 Register src2, | 1597 Register src2, |
1588 LabelType* on_not_both_smi) { | 1598 LabelType* on_not_both_smi) { |
1589 Condition both_smi = CheckBothNonNegativeSmi(src1, src2); | 1599 Condition both_smi = CheckBothNonNegativeSmi(src1, src2); |
1590 j(NegateCondition(both_smi), on_not_both_smi); | 1600 j(NegateCondition(both_smi), on_not_both_smi); |
1591 } | 1601 } |
1592 | 1602 |
1593 | 1603 |
1594 template <typename LabelType> | 1604 template <typename LabelType> |
| 1605 void MacroAssembler::JumpIfNotString(Register object, |
| 1606 Register object_map, |
| 1607 LabelType* not_string) { |
| 1608 Condition is_smi = CheckSmi(object); |
| 1609 j(is_smi, not_string); |
| 1610 CmpObjectType(object, FIRST_NONSTRING_TYPE, object_map); |
| 1611 j(above_equal, not_string); |
| 1612 } |
| 1613 |
| 1614 |
| 1615 template <typename LabelType> |
1595 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register first_object, | 1616 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register first_object, |
1596 Register second_object, | 1617 Register second_object, |
1597 Register scratch1, | 1618 Register scratch1, |
1598 Register scratch2, | 1619 Register scratch2, |
1599 LabelType* on_fail) { | 1620 LabelType* on_fail) { |
1600 // Check that both objects are not smis. | 1621 // Check that both objects are not smis. |
1601 Condition either_smi = CheckEitherSmi(first_object, second_object); | 1622 Condition either_smi = CheckEitherSmi(first_object, second_object); |
1602 j(either_smi, on_fail); | 1623 j(either_smi, on_fail); |
1603 | 1624 |
1604 // Load instance type for both strings. | 1625 // Load instance type for both strings. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1768 Jump(adaptor, RelocInfo::CODE_TARGET); | 1789 Jump(adaptor, RelocInfo::CODE_TARGET); |
1769 } | 1790 } |
1770 bind(&invoke); | 1791 bind(&invoke); |
1771 } | 1792 } |
1772 } | 1793 } |
1773 | 1794 |
1774 | 1795 |
1775 } } // namespace v8::internal | 1796 } } // namespace v8::internal |
1776 | 1797 |
1777 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ | 1798 #endif // V8_X64_MACRO_ASSEMBLER_X64_H_ |
OLD | NEW |