OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); | 814 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); |
815 deoptimizations_.Add(environment, zone()); | 815 deoptimizations_.Add(environment, zone()); |
816 } | 816 } |
817 } | 817 } |
818 | 818 |
819 | 819 |
820 void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) { | 820 void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) { |
821 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 821 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
822 ASSERT(environment->HasBeenRegistered()); | 822 ASSERT(environment->HasBeenRegistered()); |
823 int id = environment->deoptimization_index(); | 823 int id = environment->deoptimization_index(); |
824 | 824 ASSERT(info()->IsOptimizing() || info()->IsStub()); |
825 Deoptimizer::BailoutType bailout_type = info()->IsStub() | 825 Deoptimizer::BailoutType bailout_type = info()->IsStub() |
826 ? Deoptimizer::LAZY | 826 ? Deoptimizer::LAZY |
827 : Deoptimizer::EAGER; | 827 : Deoptimizer::EAGER; |
828 Address entry = Deoptimizer::GetDeoptimizationEntry(id, bailout_type); | 828 Address entry = Deoptimizer::GetDeoptimizationEntry(id, bailout_type); |
829 if (entry == NULL) { | 829 if (entry == NULL) { |
830 Abort("bailout was not prepared"); | 830 Abort("bailout was not prepared"); |
831 return; | 831 return; |
832 } | 832 } |
833 | 833 |
834 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM. | 834 ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on ARM. |
835 | |
836 if (FLAG_deopt_every_n_times == 1 && info_->opt_count() == id) { | 835 if (FLAG_deopt_every_n_times == 1 && info_->opt_count() == id) { |
837 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); | 836 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); |
838 return; | 837 return; |
839 } | 838 } |
840 | 839 |
841 if (FLAG_trap_on_deopt) __ stop("trap_on_deopt", cc); | 840 if (FLAG_trap_on_deopt) { |
| 841 __ stop("trap_on_deopt", cc); |
| 842 } |
842 | 843 |
| 844 ASSERT(info()->IsStub() || frame_is_built_); |
843 bool needs_lazy_deopt = info()->IsStub(); | 845 bool needs_lazy_deopt = info()->IsStub(); |
844 ASSERT(info()->IsStub() || frame_is_built_); | 846 if (cc == al && frame_is_built_) { |
845 if (cc == al && !needs_lazy_deopt) { | 847 if (needs_lazy_deopt) { |
846 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); | 848 __ Call(entry, RelocInfo::RUNTIME_ENTRY); |
| 849 } else { |
| 850 __ Jump(entry, RelocInfo::RUNTIME_ENTRY); |
| 851 } |
847 } else { | 852 } else { |
848 // We often have several deopts to the same entry, reuse the last | 853 // We often have several deopts to the same entry, reuse the last |
849 // jump entry if this is the case. | 854 // jump entry if this is the case. |
850 if (deopt_jump_table_.is_empty() || | 855 if (deopt_jump_table_.is_empty() || |
851 (deopt_jump_table_.last().address != entry) || | 856 (deopt_jump_table_.last().address != entry) || |
852 (deopt_jump_table_.last().is_lazy_deopt != needs_lazy_deopt) || | 857 (deopt_jump_table_.last().is_lazy_deopt != needs_lazy_deopt) || |
853 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { | 858 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { |
854 JumpTableEntry table_entry(entry, !frame_is_built_, needs_lazy_deopt); | 859 JumpTableEntry table_entry(entry, !frame_is_built_, needs_lazy_deopt); |
855 deopt_jump_table_.Add(table_entry, zone()); | 860 deopt_jump_table_.Add(table_entry, zone()); |
856 } | 861 } |
(...skipping 5442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6299 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 6304 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
6300 __ ldr(result, FieldMemOperand(scratch, | 6305 __ ldr(result, FieldMemOperand(scratch, |
6301 FixedArray::kHeaderSize - kPointerSize)); | 6306 FixedArray::kHeaderSize - kPointerSize)); |
6302 __ bind(&done); | 6307 __ bind(&done); |
6303 } | 6308 } |
6304 | 6309 |
6305 | 6310 |
6306 #undef __ | 6311 #undef __ |
6307 | 6312 |
6308 } } // namespace v8::internal | 6313 } } // namespace v8::internal |
OLD | NEW |