| 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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 | 839 |
| 840 void DeoptInfoBuilder::AddPcMarker(const Function& function, | 840 void DeoptInfoBuilder::AddPcMarker(const Function& function, |
| 841 intptr_t to_index) { | 841 intptr_t to_index) { |
| 842 // Function object was already added by AddReturnAddress, find it. | 842 // Function object was already added by AddReturnAddress, find it. |
| 843 intptr_t from_index = FindOrAddObjectInTable(function); | 843 intptr_t from_index = FindOrAddObjectInTable(function); |
| 844 ASSERT(to_index == instructions_.length()); | 844 ASSERT(to_index == instructions_.length()); |
| 845 instructions_.Add(new DeoptPcMarkerInstr(from_index)); | 845 instructions_.Add(new DeoptPcMarkerInstr(from_index)); |
| 846 } | 846 } |
| 847 | 847 |
| 848 | 848 |
| 849 void DeoptInfoBuilder::AddCopy(const Location& from_loc, | 849 void DeoptInfoBuilder::AddCopy(Value* value, |
| 850 const Location& from_loc, |
| 850 const intptr_t to_index) { | 851 const intptr_t to_index) { |
| 851 DeoptInstr* deopt_instr = NULL; | 852 DeoptInstr* deopt_instr = NULL; |
| 852 if (from_loc.IsConstant()) { | 853 if (from_loc.IsConstant()) { |
| 853 intptr_t object_table_index = FindOrAddObjectInTable(from_loc.constant()); | 854 intptr_t object_table_index = FindOrAddObjectInTable(from_loc.constant()); |
| 854 deopt_instr = new DeoptConstantInstr(object_table_index); | 855 deopt_instr = new DeoptConstantInstr(object_table_index); |
| 855 } else if (from_loc.IsRegister()) { | 856 } else if (from_loc.IsRegister()) { |
| 856 ASSERT(from_loc.representation() == kTagged); | 857 ASSERT(value->definition()->representation() == kTagged); |
| 857 deopt_instr = new DeoptRegisterInstr(from_loc.reg()); | 858 deopt_instr = new DeoptRegisterInstr(from_loc.reg()); |
| 858 } else if (from_loc.IsFpuRegister()) { | 859 } else if (from_loc.IsFpuRegister()) { |
| 859 if (from_loc.representation() == kUnboxedDouble) { | 860 if (value->definition()->representation() == kUnboxedDouble) { |
| 860 deopt_instr = new DeoptFpuRegisterInstr(from_loc.fpu_reg()); | 861 deopt_instr = new DeoptFpuRegisterInstr(from_loc.fpu_reg()); |
| 861 } else { | 862 } else { |
| 862 ASSERT(from_loc.representation() == kUnboxedMint); | 863 ASSERT(value->definition()->representation() == kUnboxedMint); |
| 863 deopt_instr = new DeoptInt64FpuRegisterInstr(from_loc.fpu_reg()); | 864 deopt_instr = new DeoptInt64FpuRegisterInstr(from_loc.fpu_reg()); |
| 864 } | 865 } |
| 865 } else if (from_loc.IsStackSlot()) { | 866 } else if (from_loc.IsStackSlot()) { |
| 866 ASSERT(from_loc.representation() == kTagged); | 867 ASSERT(value->definition()->representation() == kTagged); |
| 867 intptr_t from_index = (from_loc.stack_index() < 0) ? | 868 intptr_t from_index = (from_loc.stack_index() < 0) ? |
| 868 from_loc.stack_index() + num_args_ : | 869 from_loc.stack_index() + num_args_ : |
| 869 from_loc.stack_index() + num_args_ - kFirstLocalSlotIndex + 1; | 870 from_loc.stack_index() + num_args_ - kFirstLocalSlotIndex + 1; |
| 870 deopt_instr = new DeoptStackSlotInstr(from_index); | 871 deopt_instr = new DeoptStackSlotInstr(from_index); |
| 871 } else if (from_loc.IsDoubleStackSlot()) { | 872 } else if (from_loc.IsDoubleStackSlot()) { |
| 872 intptr_t from_index = (from_loc.stack_index() < 0) ? | 873 intptr_t from_index = (from_loc.stack_index() < 0) ? |
| 873 from_loc.stack_index() + num_args_ : | 874 from_loc.stack_index() + num_args_ : |
| 874 from_loc.stack_index() + num_args_ - kFirstLocalSlotIndex + 1; | 875 from_loc.stack_index() + num_args_ - kFirstLocalSlotIndex + 1; |
| 875 if (from_loc.representation() == kUnboxedDouble) { | 876 if (value->definition()->representation() == kUnboxedDouble) { |
| 876 deopt_instr = new DeoptDoubleStackSlotInstr(from_index); | 877 deopt_instr = new DeoptDoubleStackSlotInstr(from_index); |
| 877 } else { | 878 } else { |
| 878 ASSERT(from_loc.representation() == kUnboxedMint); | 879 ASSERT(value->definition()->representation() == kUnboxedMint); |
| 879 deopt_instr = new DeoptInt64StackSlotInstr(from_index); | 880 deopt_instr = new DeoptInt64StackSlotInstr(from_index); |
| 880 } | 881 } |
| 881 } else { | 882 } else { |
| 882 UNREACHABLE(); | 883 UNREACHABLE(); |
| 883 } | 884 } |
| 884 ASSERT(to_index == instructions_.length()); | 885 ASSERT(to_index == instructions_.length()); |
| 885 ASSERT(deopt_instr != NULL); | 886 ASSERT(deopt_instr != NULL); |
| 886 instructions_.Add(deopt_instr); | 887 instructions_.Add(deopt_instr); |
| 887 } | 888 } |
| 888 | 889 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 Smi* offset, | 973 Smi* offset, |
| 973 DeoptInfo* info, | 974 DeoptInfo* info, |
| 974 Smi* reason) { | 975 Smi* reason) { |
| 975 intptr_t i = index * kEntrySize; | 976 intptr_t i = index * kEntrySize; |
| 976 *offset ^= table.At(i); | 977 *offset ^= table.At(i); |
| 977 *info ^= table.At(i + 1); | 978 *info ^= table.At(i + 1); |
| 978 *reason ^= table.At(i + 2); | 979 *reason ^= table.At(i + 2); |
| 979 } | 980 } |
| 980 | 981 |
| 981 } // namespace dart | 982 } // namespace dart |
| OLD | NEW |