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/deopt_instructions.h" | 5 #include "vm/deopt_instructions.h" |
6 | 6 |
7 #include "vm/assembler_macros.h" | 7 #include "vm/assembler_macros.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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) { | 202 void Execute(DeoptimizationContext* deopt_context, intptr_t to_index) { |
203 Function& function = Function::Handle(deopt_context->isolate()); | 203 Function& function = Function::Handle(deopt_context->isolate()); |
204 function ^= deopt_context->ObjectAt(object_table_index_); | 204 function ^= deopt_context->ObjectAt(object_table_index_); |
205 const Code& code = | 205 const Code& code = |
206 Code::Handle(deopt_context->isolate(), function.unoptimized_code()); | 206 Code::Handle(deopt_context->isolate(), function.unoptimized_code()); |
207 uword continue_at_pc = code.GetDeoptAfterPcAtDeoptId(deopt_id_); | 207 uword continue_at_pc = code.GetDeoptAfterPcAtDeoptId(deopt_id_); |
208 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index); | 208 intptr_t* to_addr = deopt_context->GetToFrameAddressAt(to_index); |
209 *to_addr = continue_at_pc; | 209 *to_addr = continue_at_pc; |
210 } | 210 } |
211 | 211 |
212 static void GetEncodedValues(intptr_t from_index, | |
213 intptr_t* object_table_index, | |
214 intptr_t* deopt_id) { | |
215 *object_table_index = ObjectTableIndex::decode(from_index); | |
216 *deopt_id = DeoptId::decode(from_index); | |
217 } | |
218 | |
212 private: | 219 private: |
213 static const intptr_t kFieldWidth = kBitsPerWord / 2; | 220 static const intptr_t kFieldWidth = kBitsPerWord / 2; |
214 class ObjectTableIndex : public BitField<intptr_t, 0, kFieldWidth> { }; | 221 class ObjectTableIndex : public BitField<intptr_t, 0, kFieldWidth> { }; |
215 class DeoptId : public BitField<intptr_t, kFieldWidth, kFieldWidth> { }; | 222 class DeoptId : public BitField<intptr_t, kFieldWidth, kFieldWidth> { }; |
216 | 223 |
217 const intptr_t object_table_index_; | 224 const intptr_t object_table_index_; |
218 const intptr_t deopt_id_; | 225 const intptr_t deopt_id_; |
219 | 226 |
220 DISALLOW_COPY_AND_ASSIGN(DeoptRetAfterAddressInstr); | 227 DISALLOW_COPY_AND_ASSIGN(DeoptRetAfterAddressInstr); |
221 }; | 228 }; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
556 DISALLOW_COPY_AND_ASSIGN(DeoptSuffixInstr); | 563 DISALLOW_COPY_AND_ASSIGN(DeoptSuffixInstr); |
557 }; | 564 }; |
558 | 565 |
559 | 566 |
560 intptr_t DeoptInstr::DecodeSuffix(intptr_t from_index, intptr_t* info_number) { | 567 intptr_t DeoptInstr::DecodeSuffix(intptr_t from_index, intptr_t* info_number) { |
561 *info_number = DeoptSuffixInstr::InfoNumber::decode(from_index); | 568 *info_number = DeoptSuffixInstr::InfoNumber::decode(from_index); |
562 return DeoptSuffixInstr::SuffixLength::decode(from_index); | 569 return DeoptSuffixInstr::SuffixLength::decode(from_index); |
563 } | 570 } |
564 | 571 |
565 | 572 |
573 uword DeoptInstr::GetReturnAddress(intptr_t deopt_instr, | |
srdjan
2013/01/10 21:53:57
You could remove argument deopt_instr.
siva
2013/01/12 00:20:54
Done.
I also renamed the function to GetRetAfterA
| |
574 intptr_t from_index, | |
575 const Array& object_table, | |
576 Function* func) { | |
577 ASSERT(deopt_instr == kRetAfterAddress); | |
578 ASSERT(!object_table.IsNull()); | |
579 ASSERT(func != NULL); | |
580 intptr_t object_table_index; | |
581 intptr_t deopt_id; | |
582 DeoptRetAfterAddressInstr::GetEncodedValues(from_index, | |
583 &object_table_index, | |
584 &deopt_id); | |
585 *func ^= object_table.At(object_table_index); | |
586 const Code& code = Code::Handle(func->unoptimized_code()); | |
587 return code.GetDeoptAfterPcAtDeoptId(deopt_id); | |
588 } | |
589 | |
590 | |
566 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t from_index) { | 591 DeoptInstr* DeoptInstr::Create(intptr_t kind_as_int, intptr_t from_index) { |
567 Kind kind = static_cast<Kind>(kind_as_int); | 592 Kind kind = static_cast<Kind>(kind_as_int); |
568 switch (kind) { | 593 switch (kind) { |
569 case kStackSlot: return new DeoptStackSlotInstr(from_index); | 594 case kStackSlot: return new DeoptStackSlotInstr(from_index); |
570 case kDoubleStackSlot: return new DeoptDoubleStackSlotInstr(from_index); | 595 case kDoubleStackSlot: return new DeoptDoubleStackSlotInstr(from_index); |
571 case kInt64StackSlot: return new DeoptInt64StackSlotInstr(from_index); | 596 case kInt64StackSlot: return new DeoptInt64StackSlotInstr(from_index); |
572 case kRetAfterAddress: return new DeoptRetAfterAddressInstr(from_index); | 597 case kRetAfterAddress: return new DeoptRetAfterAddressInstr(from_index); |
573 case kRetBeforeAddress: return new DeoptRetBeforeAddressInstr(from_index); | 598 case kRetBeforeAddress: return new DeoptRetBeforeAddressInstr(from_index); |
574 case kConstant: return new DeoptConstantInstr(from_index); | 599 case kConstant: return new DeoptConstantInstr(from_index); |
575 case kRegister: return new DeoptRegisterInstr(from_index); | 600 case kRegister: return new DeoptRegisterInstr(from_index); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
794 Smi* offset, | 819 Smi* offset, |
795 DeoptInfo* info, | 820 DeoptInfo* info, |
796 Smi* reason) { | 821 Smi* reason) { |
797 intptr_t i = index * kEntrySize; | 822 intptr_t i = index * kEntrySize; |
798 *offset ^= table.At(i); | 823 *offset ^= table.At(i); |
799 *info ^= table.At(i + 1); | 824 *info ^= table.At(i + 1); |
800 *reason ^= table.At(i + 2); | 825 *reason ^= table.At(i + 2); |
801 } | 826 } |
802 | 827 |
803 } // namespace dart | 828 } // namespace dart |
OLD | NEW |