OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
(...skipping 6804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6815 intptr_t DeoptInfo::FromIndex(intptr_t index) const { | 6815 intptr_t DeoptInfo::FromIndex(intptr_t index) const { |
6816 return *(EntryAddr(index, kFromIndex)); | 6816 return *(EntryAddr(index, kFromIndex)); |
6817 } | 6817 } |
6818 | 6818 |
6819 | 6819 |
6820 intptr_t DeoptInfo::Instruction(intptr_t index) const { | 6820 intptr_t DeoptInfo::Instruction(intptr_t index) const { |
6821 return *(EntryAddr(index, kInstruction)); | 6821 return *(EntryAddr(index, kInstruction)); |
6822 } | 6822 } |
6823 | 6823 |
6824 | 6824 |
| 6825 intptr_t DeoptInfo::TranslationLength() const { |
| 6826 intptr_t length = Length(); |
| 6827 if (Instruction(length - 1) != DeoptInstr::kSuffix) return length; |
| 6828 |
| 6829 // If the last command is a suffix, add in the length of the suffix and |
| 6830 // do not count the suffix command as a translation command. |
| 6831 intptr_t ignored = 0; |
| 6832 intptr_t suffix_length = |
| 6833 DeoptInstr::DecodeSuffix(FromIndex(length - 1), &ignored); |
| 6834 return length + suffix_length - 1; |
| 6835 } |
| 6836 |
| 6837 |
| 6838 void DeoptInfo::ToInstructions(const Array& table, |
| 6839 GrowableArray<DeoptInstr*>* instructions) const { |
| 6840 ASSERT(instructions->is_empty()); |
| 6841 Smi& offset = Smi::Handle(); |
| 6842 DeoptInfo& info = DeoptInfo::Handle(raw()); |
| 6843 Smi& reason = Smi::Handle(); |
| 6844 intptr_t index = 0; |
| 6845 intptr_t length = TranslationLength(); |
| 6846 while (index < length) { |
| 6847 intptr_t instruction = info.Instruction(index); |
| 6848 intptr_t from_index = info.FromIndex(index); |
| 6849 if (instruction == DeoptInstr::kSuffix) { |
| 6850 // Suffix instructions cause us to 'jump' to another translation, |
| 6851 // changing info, length and index. |
| 6852 intptr_t info_number = 0; |
| 6853 intptr_t suffix_length = |
| 6854 DeoptInstr::DecodeSuffix(from_index, &info_number); |
| 6855 DeoptTable::GetEntry(table, info_number, &offset, &info, &reason); |
| 6856 length = info.TranslationLength(); |
| 6857 index = length - suffix_length; |
| 6858 } else { |
| 6859 instructions->Add(DeoptInstr::Create(instruction, from_index)); |
| 6860 ++index; |
| 6861 } |
| 6862 } |
| 6863 } |
| 6864 |
| 6865 |
6825 const char* DeoptInfo::ToCString() const { | 6866 const char* DeoptInfo::ToCString() const { |
6826 if (Length() == 0) { | 6867 if (Length() == 0) { |
6827 return "No DeoptInfo"; | 6868 return "No DeoptInfo"; |
6828 } | 6869 } |
6829 // Convert to DeoptInstr. | 6870 // Convert to DeoptInstr. |
6830 GrowableArray<DeoptInstr*> deopt_instrs(Length()); | 6871 GrowableArray<DeoptInstr*> deopt_instrs(Length()); |
6831 for (intptr_t i = 0; i < Length(); i++) { | 6872 for (intptr_t i = 0; i < Length(); i++) { |
6832 deopt_instrs.Add(DeoptInstr::Create(Instruction(i), FromIndex(i))); | 6873 deopt_instrs.Add(DeoptInstr::Create(Instruction(i), FromIndex(i))); |
6833 } | 6874 } |
6834 // Compute the buffer size required. | 6875 // Compute the buffer size required. |
(...skipping 5363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12198 } | 12239 } |
12199 return result.raw(); | 12240 return result.raw(); |
12200 } | 12241 } |
12201 | 12242 |
12202 | 12243 |
12203 const char* WeakProperty::ToCString() const { | 12244 const char* WeakProperty::ToCString() const { |
12204 return "_WeakProperty"; | 12245 return "_WeakProperty"; |
12205 } | 12246 } |
12206 | 12247 |
12207 } // namespace dart | 12248 } // namespace dart |
OLD | NEW |