OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 } | 1521 } |
1522 } | 1522 } |
1523 | 1523 |
1524 | 1524 |
1525 void MacroAssembler::Assert(Condition cc, const char* msg) { | 1525 void MacroAssembler::Assert(Condition cc, const char* msg) { |
1526 if (FLAG_debug_code) | 1526 if (FLAG_debug_code) |
1527 Check(cc, msg); | 1527 Check(cc, msg); |
1528 } | 1528 } |
1529 | 1529 |
1530 | 1530 |
| 1531 void MacroAssembler::AssertRegisterIsRoot(Register reg, |
| 1532 Heap::RootListIndex index) { |
| 1533 if (FLAG_debug_code) { |
| 1534 LoadRoot(ip, index); |
| 1535 cmp(reg, ip); |
| 1536 Check(eq, "Register did not match expected root"); |
| 1537 } |
| 1538 } |
| 1539 |
| 1540 |
1531 void MacroAssembler::Check(Condition cc, const char* msg) { | 1541 void MacroAssembler::Check(Condition cc, const char* msg) { |
1532 Label L; | 1542 Label L; |
1533 b(cc, &L); | 1543 b(cc, &L); |
1534 Abort(msg); | 1544 Abort(msg); |
1535 // will not return here | 1545 // will not return here |
1536 bind(&L); | 1546 bind(&L); |
1537 } | 1547 } |
1538 | 1548 |
1539 | 1549 |
1540 void MacroAssembler::Abort(const char* msg) { | 1550 void MacroAssembler::Abort(const char* msg) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 scratch2, | 1649 scratch2, |
1640 failure); | 1650 failure); |
1641 } | 1651 } |
1642 | 1652 |
1643 | 1653 |
1644 // Allocates a heap number or jumps to the need_gc label if the young space | 1654 // Allocates a heap number or jumps to the need_gc label if the young space |
1645 // is full and a scavenge is needed. | 1655 // is full and a scavenge is needed. |
1646 void MacroAssembler::AllocateHeapNumber(Register result, | 1656 void MacroAssembler::AllocateHeapNumber(Register result, |
1647 Register scratch1, | 1657 Register scratch1, |
1648 Register scratch2, | 1658 Register scratch2, |
| 1659 Register heap_number_map, |
1649 Label* gc_required) { | 1660 Label* gc_required) { |
1650 // Allocate an object in the heap for the heap number and tag it as a heap | 1661 // Allocate an object in the heap for the heap number and tag it as a heap |
1651 // object. | 1662 // object. |
1652 AllocateInNewSpace(HeapNumber::kSize, | 1663 AllocateInNewSpace(HeapNumber::kSize, |
1653 result, | 1664 result, |
1654 scratch1, | 1665 scratch1, |
1655 scratch2, | 1666 scratch2, |
1656 gc_required, | 1667 gc_required, |
1657 TAG_OBJECT); | 1668 TAG_OBJECT); |
1658 | 1669 |
1659 // Get heap number map and store it in the allocated object. | 1670 // Store heap number map in the allocated object. |
1660 LoadRoot(scratch1, Heap::kHeapNumberMapRootIndex); | 1671 AssertRegisterIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); |
1661 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); | 1672 str(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset)); |
1662 } | 1673 } |
1663 | 1674 |
1664 | 1675 |
1665 void MacroAssembler::CountLeadingZeros(Register source, | 1676 void MacroAssembler::CountLeadingZeros(Register source, |
1666 Register scratch, | 1677 Register scratch, |
1667 Register zeros) { | 1678 Register zeros) { |
1668 #ifdef CAN_USE_ARMV5_INSTRUCTIONS | 1679 #ifdef CAN_USE_ARMV5_INSTRUCTIONS |
1669 clz(zeros, source); // This instruction is only supported after ARM5. | 1680 clz(zeros, source); // This instruction is only supported after ARM5. |
1670 #else | 1681 #else |
1671 mov(zeros, Operand(0)); | 1682 mov(zeros, Operand(0)); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 | 1823 |
1813 void CodePatcher::Emit(Address addr) { | 1824 void CodePatcher::Emit(Address addr) { |
1814 masm()->emit(reinterpret_cast<Instr>(addr)); | 1825 masm()->emit(reinterpret_cast<Instr>(addr)); |
1815 } | 1826 } |
1816 #endif // ENABLE_DEBUGGER_SUPPORT | 1827 #endif // ENABLE_DEBUGGER_SUPPORT |
1817 | 1828 |
1818 | 1829 |
1819 } } // namespace v8::internal | 1830 } } // namespace v8::internal |
1820 | 1831 |
1821 #endif // V8_TARGET_ARCH_ARM | 1832 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |