Chromium Code Reviews| 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/deopt_instructions.h" | 5 #include "vm/deopt_instructions.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/locations.h" | 10 #include "vm/locations.h" |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 752 return i; | 752 return i; |
| 753 } | 753 } |
| 754 } | 754 } |
| 755 // Add object. | 755 // Add object. |
| 756 const intptr_t result = object_table_.Length(); | 756 const intptr_t result = object_table_.Length(); |
| 757 object_table_.Add(obj); | 757 object_table_.Add(obj); |
| 758 return result; | 758 return result; |
| 759 } | 759 } |
| 760 | 760 |
| 761 | 761 |
| 762 intptr_t DeoptInfoBuilder::CalculateStackIndex(const Location& from_loc) const { | |
| 763 return from_loc.stack_index() < 0 ? | |
| 764 from_loc.stack_index() + num_args_ : | |
| 765 from_loc.stack_index() + num_args_ - kFirstLocalSlotIndex + 1; | |
| 766 } | |
| 767 | |
|
Vyacheslav Egorov (Google)
2013/04/15 13:49:21
add empty line
Cutch
2013/04/15 14:07:06
Done.
| |
| 762 void DeoptInfoBuilder::AddReturnAddress(const Function& function, | 768 void DeoptInfoBuilder::AddReturnAddress(const Function& function, |
| 763 intptr_t deopt_id, | 769 intptr_t deopt_id, |
| 764 intptr_t to_index) { | 770 intptr_t to_index) { |
| 765 // Check that deopt_id exists. | 771 // Check that deopt_id exists. |
| 766 // TODO(vegorov): verify after deoptimization targets as well. | 772 // TODO(vegorov): verify after deoptimization targets as well. |
| 767 #ifdef DEBUG | 773 #ifdef DEBUG |
| 768 const Code& code = Code::Handle(function.unoptimized_code()); | 774 const Code& code = Code::Handle(function.unoptimized_code()); |
| 769 ASSERT(Isolate::IsDeoptAfter(deopt_id) || | 775 ASSERT(Isolate::IsDeoptAfter(deopt_id) || |
| 770 (code.GetPcForDeoptId(deopt_id, PcDescriptors::kDeopt) != 0)); | 776 (code.GetPcForDeoptId(deopt_id, PcDescriptors::kDeopt) != 0)); |
| 771 #endif | 777 #endif |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 800 } else if (value->definition()->representation() == kUnboxedMint) { | 806 } else if (value->definition()->representation() == kUnboxedMint) { |
| 801 deopt_instr = new DeoptInt64FpuRegisterInstr(from_loc.fpu_reg()); | 807 deopt_instr = new DeoptInt64FpuRegisterInstr(from_loc.fpu_reg()); |
| 802 } else if (value->definition()->representation() == kUnboxedFloat32x4) { | 808 } else if (value->definition()->representation() == kUnboxedFloat32x4) { |
| 803 deopt_instr = new DeoptFloat32x4FpuRegisterInstr(from_loc.fpu_reg()); | 809 deopt_instr = new DeoptFloat32x4FpuRegisterInstr(from_loc.fpu_reg()); |
| 804 } else { | 810 } else { |
| 805 ASSERT(value->definition()->representation() == kUnboxedUint32x4); | 811 ASSERT(value->definition()->representation() == kUnboxedUint32x4); |
| 806 deopt_instr = new DeoptUint32x4FpuRegisterInstr(from_loc.fpu_reg()); | 812 deopt_instr = new DeoptUint32x4FpuRegisterInstr(from_loc.fpu_reg()); |
| 807 } | 813 } |
| 808 } else if (from_loc.IsStackSlot()) { | 814 } else if (from_loc.IsStackSlot()) { |
| 809 ASSERT(value->definition()->representation() == kTagged); | 815 ASSERT(value->definition()->representation() == kTagged); |
| 810 intptr_t from_index = (from_loc.stack_index() < 0) ? | 816 intptr_t from_index = CalculateStackIndex(from_loc); |
| 811 from_loc.stack_index() + num_args_ : | |
| 812 from_loc.stack_index() + num_args_ - kFirstLocalSlotIndex + 1; | |
| 813 deopt_instr = new DeoptStackSlotInstr(from_index); | 817 deopt_instr = new DeoptStackSlotInstr(from_index); |
| 814 } else if (from_loc.IsDoubleStackSlot()) { | 818 } else if (from_loc.IsDoubleStackSlot()) { |
| 815 intptr_t from_index = (from_loc.stack_index() < 0) ? | 819 intptr_t from_index = CalculateStackIndex(from_loc); |
| 816 from_loc.stack_index() + num_args_ : | |
| 817 from_loc.stack_index() + num_args_ - kFirstLocalSlotIndex + 1; | |
| 818 if (value->definition()->representation() == kUnboxedDouble) { | 820 if (value->definition()->representation() == kUnboxedDouble) { |
| 819 deopt_instr = new DeoptDoubleStackSlotInstr(from_index); | 821 deopt_instr = new DeoptDoubleStackSlotInstr(from_index); |
| 820 } else { | 822 } else { |
| 821 ASSERT(value->definition()->representation() == kUnboxedMint); | 823 ASSERT(value->definition()->representation() == kUnboxedMint); |
| 822 deopt_instr = new DeoptInt64StackSlotInstr(from_index); | 824 deopt_instr = new DeoptInt64StackSlotInstr(from_index); |
| 823 } | 825 } |
| 826 } else if (from_loc.IsQuadStackSlot()) { | |
| 827 intptr_t from_index = CalculateStackIndex(from_loc); | |
| 828 if (value->definition()->representation() == kUnboxedFloat32x4) { | |
| 829 deopt_instr = new DeoptFloat32x4StackSlotInstr(from_index); | |
| 830 } else { | |
| 831 ASSERT(value->definition()->representation() == kUnboxedUint32x4); | |
| 832 deopt_instr = new DeoptUint32x4StackSlotInstr(from_index); | |
| 833 } | |
| 824 } else { | 834 } else { |
| 825 UNREACHABLE(); | 835 UNREACHABLE(); |
| 826 } | 836 } |
| 827 ASSERT(to_index == instructions_.length()); | 837 ASSERT(to_index == instructions_.length()); |
| 828 ASSERT(deopt_instr != NULL); | 838 ASSERT(deopt_instr != NULL); |
| 829 instructions_.Add(deopt_instr); | 839 instructions_.Add(deopt_instr); |
| 830 } | 840 } |
| 831 | 841 |
| 832 | 842 |
| 833 void DeoptInfoBuilder::AddCallerFp(intptr_t to_index) { | 843 void DeoptInfoBuilder::AddCallerFp(intptr_t to_index) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 915 Smi* offset, | 925 Smi* offset, |
| 916 DeoptInfo* info, | 926 DeoptInfo* info, |
| 917 Smi* reason) { | 927 Smi* reason) { |
| 918 intptr_t i = index * kEntrySize; | 928 intptr_t i = index * kEntrySize; |
| 919 *offset ^= table.At(i); | 929 *offset ^= table.At(i); |
| 920 *info ^= table.At(i + 1); | 930 *info ^= table.At(i + 1); |
| 921 *reason ^= table.At(i + 2); | 931 *reason ^= table.At(i + 2); |
| 922 } | 932 } |
| 923 | 933 |
| 924 } // namespace dart | 934 } // namespace dart |
| OLD | NEW |