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/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/intermediate_language.h" | 10 #include "vm/intermediate_language.h" |
11 #include "vm/locations.h" | 11 #include "vm/locations.h" |
12 #include "vm/parser.h" | 12 #include "vm/parser.h" |
13 #include "vm/stack_frame.h" | 13 #include "vm/stack_frame.h" |
14 #include "vm/thread.h" | 14 #include "vm/thread.h" |
15 | 15 |
16 namespace dart { | 16 namespace dart { |
17 | 17 |
18 DEFINE_FLAG(bool, compress_deopt_info, true, | 18 DEFINE_FLAG(bool, compress_deopt_info, true, |
19 "Compress the size of the deoptimization info for optimized code."); | 19 "Compress the size of the deoptimization info for optimized code."); |
20 DECLARE_FLAG(bool, trace_deoptimization); | 20 DECLARE_FLAG(bool, trace_deoptimization); |
21 DECLARE_FLAG(bool, trace_deoptimization_verbose); | 21 DECLARE_FLAG(bool, trace_deoptimization_verbose); |
22 | 22 |
23 | 23 |
24 DeoptContext::DeoptContext(const StackFrame* frame, | 24 DeoptContext::DeoptContext(const StackFrame* frame, |
25 const Code& code, | 25 const Code& code, |
26 DestFrameOptions dest_options, | 26 DestFrameOptions dest_options, |
27 fpu_register_t* fpu_registers, | 27 fpu_register_t* fpu_registers, |
28 intptr_t* cpu_registers) | 28 intptr_t* cpu_registers) |
29 : code_(code.raw()), | 29 : code_(code.raw()), |
30 object_pool_(code.ObjectPool()), | 30 object_pool_(code.GetObjectPool()), |
31 deopt_info_(TypedData::null()), | 31 deopt_info_(TypedData::null()), |
32 dest_frame_is_allocated_(false), | 32 dest_frame_is_allocated_(false), |
33 dest_frame_(NULL), | 33 dest_frame_(NULL), |
34 dest_frame_size_(0), | 34 dest_frame_size_(0), |
35 source_frame_is_allocated_(false), | 35 source_frame_is_allocated_(false), |
36 source_frame_(NULL), | 36 source_frame_(NULL), |
37 source_frame_size_(0), | 37 source_frame_size_(0), |
38 cpu_registers_(cpu_registers), | 38 cpu_registers_(cpu_registers), |
39 fpu_registers_(fpu_registers), | 39 fpu_registers_(fpu_registers), |
40 num_args_(0), | 40 num_args_(0), |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 } | 767 } |
768 | 768 |
769 private: | 769 private: |
770 intptr_t field_count_; | 770 intptr_t field_count_; |
771 | 771 |
772 DISALLOW_COPY_AND_ASSIGN(DeoptMaterializeObjectInstr); | 772 DISALLOW_COPY_AND_ASSIGN(DeoptMaterializeObjectInstr); |
773 }; | 773 }; |
774 | 774 |
775 | 775 |
776 uword DeoptInstr::GetRetAddress(DeoptInstr* instr, | 776 uword DeoptInstr::GetRetAddress(DeoptInstr* instr, |
777 const Array& object_table, | 777 const ObjectPool& object_table, |
778 Code* code) { | 778 Code* code) { |
779 ASSERT(instr->kind() == kRetAddress); | 779 ASSERT(instr->kind() == kRetAddress); |
780 DeoptRetAddressInstr* ret_address_instr = | 780 DeoptRetAddressInstr* ret_address_instr = |
781 static_cast<DeoptRetAddressInstr*>(instr); | 781 static_cast<DeoptRetAddressInstr*>(instr); |
782 // The following assert may trigger when displaying a backtrace | 782 // The following assert may trigger when displaying a backtrace |
783 // from the simulator. | 783 // from the simulator. |
784 ASSERT(Isolate::IsDeoptAfter(ret_address_instr->deopt_id())); | 784 ASSERT(Isolate::IsDeoptAfter(ret_address_instr->deopt_id())); |
785 ASSERT(!object_table.IsNull()); | 785 ASSERT(!object_table.IsNull()); |
786 Thread* thread = Thread::Current(); | 786 Thread* thread = Thread::Current(); |
787 Zone* zone = thread->zone(); | 787 Zone* zone = thread->zone(); |
788 Function& function = Function::Handle(zone); | 788 Function& function = Function::Handle(zone); |
789 function ^= object_table.At(ret_address_instr->object_table_index()); | 789 function ^= object_table.ObjectAt(ret_address_instr->object_table_index()); |
790 ASSERT(code != NULL); | 790 ASSERT(code != NULL); |
791 const Error& error = Error::Handle(zone, | 791 const Error& error = Error::Handle(zone, |
792 Compiler::EnsureUnoptimizedCode(thread, function)); | 792 Compiler::EnsureUnoptimizedCode(thread, function)); |
793 if (!error.IsNull()) { | 793 if (!error.IsNull()) { |
794 Exceptions::PropagateError(error); | 794 Exceptions::PropagateError(error); |
795 } | 795 } |
796 *code ^= function.unoptimized_code(); | 796 *code ^= function.unoptimized_code(); |
797 ASSERT(!code->IsNull()); | 797 ASSERT(!code->IsNull()); |
798 uword res = code->GetPcForDeoptId(ret_address_instr->deopt_id(), | 798 uword res = code->GetPcForDeoptId(ret_address_instr->deopt_id(), |
799 RawPcDescriptors::kDeopt); | 799 RawPcDescriptors::kDeopt); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 num_args_(num_args), | 930 num_args_(num_args), |
931 assembler_(assembler), | 931 assembler_(assembler), |
932 trie_root_(new(zone) TrieNode()), | 932 trie_root_(new(zone) TrieNode()), |
933 current_info_number_(0), | 933 current_info_number_(0), |
934 frame_start_(-1), | 934 frame_start_(-1), |
935 materializations_() { | 935 materializations_() { |
936 } | 936 } |
937 | 937 |
938 | 938 |
939 intptr_t DeoptInfoBuilder::FindOrAddObjectInTable(const Object& obj) const { | 939 intptr_t DeoptInfoBuilder::FindOrAddObjectInTable(const Object& obj) const { |
940 return assembler_->object_pool().FindObject(obj, kNotPatchable); | 940 return assembler_->object_pool_wrapper().FindObject(obj); |
941 } | 941 } |
942 | 942 |
943 | 943 |
944 intptr_t DeoptInfoBuilder::CalculateStackIndex( | 944 intptr_t DeoptInfoBuilder::CalculateStackIndex( |
945 const Location& source_loc) const { | 945 const Location& source_loc) const { |
946 return source_loc.stack_index() < 0 ? | 946 return source_loc.stack_index() < 0 ? |
947 source_loc.stack_index() + num_args_ : | 947 source_loc.stack_index() + num_args_ : |
948 source_loc.stack_index() + num_args_ + kDartFrameFixedSize; | 948 source_loc.stack_index() + num_args_ + kDartFrameFixedSize; |
949 } | 949 } |
950 | 950 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 Smi* offset, | 1260 Smi* offset, |
1261 TypedData* info, | 1261 TypedData* info, |
1262 Smi* reason) { | 1262 Smi* reason) { |
1263 intptr_t i = index * kEntrySize; | 1263 intptr_t i = index * kEntrySize; |
1264 *offset ^= table.At(i); | 1264 *offset ^= table.At(i); |
1265 *info ^= table.At(i + 1); | 1265 *info ^= table.At(i + 1); |
1266 *reason ^= table.At(i + 2); | 1266 *reason ^= table.At(i + 2); |
1267 } | 1267 } |
1268 | 1268 |
1269 } // namespace dart | 1269 } // namespace dart |
OLD | NEW |