OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 translation.index(), | 812 translation.index(), |
813 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); | 813 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); |
814 deoptimizations_.Add(environment, zone()); | 814 deoptimizations_.Add(environment, zone()); |
815 } | 815 } |
816 } | 816 } |
817 | 817 |
818 | 818 |
819 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, | 819 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, |
820 Deoptimizer::BailoutType bailout_type, | 820 Deoptimizer::BailoutType bailout_type, |
821 Register src1, const Operand& src2, | 821 Register src1, const Operand& src2, |
822 const char* reason) { | 822 const char* detail) { |
823 LEnvironment* environment = instr->environment(); | 823 LEnvironment* environment = instr->environment(); |
824 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 824 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
825 DCHECK(environment->HasBeenRegistered()); | 825 DCHECK(environment->HasBeenRegistered()); |
826 int id = environment->deoptimization_index(); | 826 int id = environment->deoptimization_index(); |
827 DCHECK(info()->IsOptimizing() || info()->IsStub()); | 827 DCHECK(info()->IsOptimizing() || info()->IsStub()); |
828 Address entry = | 828 Address entry = |
829 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); | 829 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); |
830 if (entry == NULL) { | 830 if (entry == NULL) { |
831 Abort(kBailoutWasNotPrepared); | 831 Abort(kBailoutWasNotPrepared); |
832 return; | 832 return; |
(...skipping 20 matching lines...) Expand all Loading... |
853 | 853 |
854 if (info()->ShouldTrapOnDeopt()) { | 854 if (info()->ShouldTrapOnDeopt()) { |
855 Label skip; | 855 Label skip; |
856 if (condition != al) { | 856 if (condition != al) { |
857 __ Branch(&skip, NegateCondition(condition), src1, src2); | 857 __ Branch(&skip, NegateCondition(condition), src1, src2); |
858 } | 858 } |
859 __ stop("trap_on_deopt"); | 859 __ stop("trap_on_deopt"); |
860 __ bind(&skip); | 860 __ bind(&skip); |
861 } | 861 } |
862 | 862 |
| 863 Deoptimizer::Reason reason(instr->Mnemonic(), detail); |
863 DCHECK(info()->IsStub() || frame_is_built_); | 864 DCHECK(info()->IsStub() || frame_is_built_); |
864 // Go through jump table if we need to handle condition, build frame, or | 865 // Go through jump table if we need to handle condition, build frame, or |
865 // restore caller doubles. | 866 // restore caller doubles. |
866 if (condition == al && frame_is_built_ && | 867 if (condition == al && frame_is_built_ && |
867 !info()->saves_caller_doubles()) { | 868 !info()->saves_caller_doubles()) { |
868 DeoptComment(instr->Mnemonic(), reason); | 869 DeoptComment(reason); |
869 __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2); | 870 __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2); |
870 } else { | 871 } else { |
871 // We often have several deopts to the same entry, reuse the last | 872 // We often have several deopts to the same entry, reuse the last |
872 // jump entry if this is the case. | 873 // jump entry if this is the case. |
873 if (deopt_jump_table_.is_empty() || | 874 if (deopt_jump_table_.is_empty() || |
874 (deopt_jump_table_.last().address != entry) || | 875 (deopt_jump_table_.last().address != entry) || |
875 (deopt_jump_table_.last().bailout_type != bailout_type) || | 876 (deopt_jump_table_.last().bailout_type != bailout_type) || |
876 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { | 877 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { |
877 Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason, | 878 Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type, |
878 bailout_type, !frame_is_built_); | 879 !frame_is_built_); |
879 deopt_jump_table_.Add(table_entry, zone()); | 880 deopt_jump_table_.Add(table_entry, zone()); |
880 } | 881 } |
881 __ Branch(&deopt_jump_table_.last().label, condition, src1, src2); | 882 __ Branch(&deopt_jump_table_.last().label, condition, src1, src2); |
882 } | 883 } |
883 } | 884 } |
884 | 885 |
885 | 886 |
886 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, | 887 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, |
887 Register src1, const Operand& src2, | 888 Register src1, const Operand& src2, |
888 const char* reason) { | 889 const char* detail) { |
889 Deoptimizer::BailoutType bailout_type = info()->IsStub() | 890 Deoptimizer::BailoutType bailout_type = info()->IsStub() |
890 ? Deoptimizer::LAZY | 891 ? Deoptimizer::LAZY |
891 : Deoptimizer::EAGER; | 892 : Deoptimizer::EAGER; |
892 DeoptimizeIf(condition, instr, bailout_type, src1, src2, reason); | 893 DeoptimizeIf(condition, instr, bailout_type, src1, src2, detail); |
893 } | 894 } |
894 | 895 |
895 | 896 |
896 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { | 897 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { |
897 int length = deoptimizations_.length(); | 898 int length = deoptimizations_.length(); |
898 if (length == 0) return; | 899 if (length == 0) return; |
899 Handle<DeoptimizationInputData> data = | 900 Handle<DeoptimizationInputData> data = |
900 DeoptimizationInputData::New(isolate(), length, TENURED); | 901 DeoptimizationInputData::New(isolate(), length, TENURED); |
901 | 902 |
902 Handle<ByteArray> translations = | 903 Handle<ByteArray> translations = |
(...skipping 5011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5914 __ li(at, scope_info); | 5915 __ li(at, scope_info); |
5915 __ Push(at, ToRegister(instr->function())); | 5916 __ Push(at, ToRegister(instr->function())); |
5916 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5917 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5917 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5918 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5918 } | 5919 } |
5919 | 5920 |
5920 | 5921 |
5921 #undef __ | 5922 #undef __ |
5922 | 5923 |
5923 } } // namespace v8::internal | 5924 } } // namespace v8::internal |
OLD | NEW |