| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 saved_registers_address += kWordSize; | 1673 saved_registers_address += kWordSize; |
| 1674 } | 1674 } |
| 1675 *cpu_registers = cpu_registers_copy; | 1675 *cpu_registers = cpu_registers_copy; |
| 1676 } | 1676 } |
| 1677 | 1677 |
| 1678 | 1678 |
| 1679 // Copies saved registers and caller's frame into temporary buffers. | 1679 // Copies saved registers and caller's frame into temporary buffers. |
| 1680 // Returns the stack size of unoptimized frame. | 1680 // Returns the stack size of unoptimized frame. |
| 1681 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, | 1681 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, |
| 1682 1, uword saved_registers_address) { | 1682 1, uword saved_registers_address) { |
| 1683 Isolate* isolate = Isolate::Current(); | 1683 Thread* thread = Thread::Current(); |
| 1684 StackZone zone(isolate); | 1684 Isolate* isolate = thread->isolate(); |
| 1685 HANDLESCOPE(isolate); | 1685 StackZone zone(thread); |
| 1686 HANDLESCOPE(thread); |
| 1686 | 1687 |
| 1687 // All registers have been saved below last-fp as if they were locals. | 1688 // All registers have been saved below last-fp as if they were locals. |
| 1688 const uword last_fp = saved_registers_address | 1689 const uword last_fp = saved_registers_address |
| 1689 + (kNumberOfCpuRegisters * kWordSize) | 1690 + (kNumberOfCpuRegisters * kWordSize) |
| 1690 + (kNumberOfFpuRegisters * kFpuRegisterSize) | 1691 + (kNumberOfFpuRegisters * kFpuRegisterSize) |
| 1691 - ((kFirstLocalSlotFromFp + 1) * kWordSize); | 1692 - ((kFirstLocalSlotFromFp + 1) * kWordSize); |
| 1692 | 1693 |
| 1693 // Get optimized code and frame that need to be deoptimized. | 1694 // Get optimized code and frame that need to be deoptimized. |
| 1694 DartFrameIterator iterator(last_fp); | 1695 DartFrameIterator iterator(last_fp); |
| 1695 StackFrame* caller_frame = iterator.NextFrame(); | 1696 StackFrame* caller_frame = iterator.NextFrame(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1711 | 1712 |
| 1712 // Stack size (FP - SP) in bytes. | 1713 // Stack size (FP - SP) in bytes. |
| 1713 return deopt_context->DestStackAdjustment() * kWordSize; | 1714 return deopt_context->DestStackAdjustment() * kWordSize; |
| 1714 } | 1715 } |
| 1715 END_LEAF_RUNTIME_ENTRY | 1716 END_LEAF_RUNTIME_ENTRY |
| 1716 | 1717 |
| 1717 | 1718 |
| 1718 // The stack has been adjusted to fit all values for unoptimized frame. | 1719 // The stack has been adjusted to fit all values for unoptimized frame. |
| 1719 // Fill the unoptimized frame. | 1720 // Fill the unoptimized frame. |
| 1720 DEFINE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, 1, uword last_fp) { | 1721 DEFINE_LEAF_RUNTIME_ENTRY(void, DeoptimizeFillFrame, 1, uword last_fp) { |
| 1721 Isolate* isolate = Isolate::Current(); | 1722 Thread* thread = Thread::Current(); |
| 1722 StackZone zone(isolate); | 1723 Isolate* isolate = thread->isolate(); |
| 1723 HANDLESCOPE(isolate); | 1724 StackZone zone(thread); |
| 1725 HANDLESCOPE(thread); |
| 1724 | 1726 |
| 1725 DeoptContext* deopt_context = isolate->deopt_context(); | 1727 DeoptContext* deopt_context = isolate->deopt_context(); |
| 1726 DartFrameIterator iterator(last_fp); | 1728 DartFrameIterator iterator(last_fp); |
| 1727 StackFrame* caller_frame = iterator.NextFrame(); | 1729 StackFrame* caller_frame = iterator.NextFrame(); |
| 1728 ASSERT(caller_frame != NULL); | 1730 ASSERT(caller_frame != NULL); |
| 1729 | 1731 |
| 1730 #if defined(DEBUG) | 1732 #if defined(DEBUG) |
| 1731 { | 1733 { |
| 1732 // The code from the deopt_context. | 1734 // The code from the deopt_context. |
| 1733 const Code& code = Code::Handle(deopt_context->code()); | 1735 const Code& code = Code::Handle(deopt_context->code()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 // from the stack. | 1772 // from the stack. |
| 1771 arguments.SetReturn(Smi::Handle(Smi::New(deopt_arg_count * kWordSize))); | 1773 arguments.SetReturn(Smi::Handle(Smi::New(deopt_arg_count * kWordSize))); |
| 1772 } | 1774 } |
| 1773 | 1775 |
| 1774 | 1776 |
| 1775 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, | 1777 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, |
| 1776 BigintCompare, | 1778 BigintCompare, |
| 1777 2, | 1779 2, |
| 1778 RawBigint* left, | 1780 RawBigint* left, |
| 1779 RawBigint* right) { | 1781 RawBigint* right) { |
| 1780 Isolate* isolate = Isolate::Current(); | 1782 Thread* thread = Thread::Current(); |
| 1781 StackZone zone(isolate); | 1783 StackZone zone(thread); |
| 1782 HANDLESCOPE(isolate); | 1784 HANDLESCOPE(thread); |
| 1783 const Bigint& big_left = Bigint::Handle(left); | 1785 const Bigint& big_left = Bigint::Handle(left); |
| 1784 const Bigint& big_right = Bigint::Handle(right); | 1786 const Bigint& big_right = Bigint::Handle(right); |
| 1785 return big_left.CompareWith(big_right); | 1787 return big_left.CompareWith(big_right); |
| 1786 } | 1788 } |
| 1787 END_LEAF_RUNTIME_ENTRY | 1789 END_LEAF_RUNTIME_ENTRY |
| 1788 | 1790 |
| 1789 | 1791 |
| 1790 double DartModulo(double left, double right) { | 1792 double DartModulo(double left, double right) { |
| 1791 double remainder = fmod_ieee(left, right); | 1793 double remainder = fmod_ieee(left, right); |
| 1792 if (remainder == 0.0) { | 1794 if (remainder == 0.0) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1841 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
| 1840 const TypedData& new_data = | 1842 const TypedData& new_data = |
| 1841 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1843 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
| 1842 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1844 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
| 1843 typed_data_cell.SetAt(0, new_data); | 1845 typed_data_cell.SetAt(0, new_data); |
| 1844 arguments.SetReturn(new_data); | 1846 arguments.SetReturn(new_data); |
| 1845 } | 1847 } |
| 1846 | 1848 |
| 1847 | 1849 |
| 1848 } // namespace dart | 1850 } // namespace dart |
| OLD | NEW |