Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: src/mips64/lithium-codegen-mips64.cc

Issue 587623002: Introduce a class to carry around a deoptimization reason. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Re-added a few Comment calls which were accidentally removed. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips64/lithium-codegen-mips64.h ('k') | src/x64/lithium-codegen-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/hydrogen-osr.h" 9 #include "src/hydrogen-osr.h"
10 #include "src/ic/ic.h" 10 #include "src/ic/ic.h"
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 translation.index(), 762 translation.index(),
763 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); 763 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1);
764 deoptimizations_.Add(environment, zone()); 764 deoptimizations_.Add(environment, zone());
765 } 765 }
766 } 766 }
767 767
768 768
769 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, 769 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
770 Deoptimizer::BailoutType bailout_type, 770 Deoptimizer::BailoutType bailout_type,
771 Register src1, const Operand& src2, 771 Register src1, const Operand& src2,
772 const char* reason) { 772 const char* detail) {
773 LEnvironment* environment = instr->environment(); 773 LEnvironment* environment = instr->environment();
774 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 774 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
775 DCHECK(environment->HasBeenRegistered()); 775 DCHECK(environment->HasBeenRegistered());
776 int id = environment->deoptimization_index(); 776 int id = environment->deoptimization_index();
777 DCHECK(info()->IsOptimizing() || info()->IsStub()); 777 DCHECK(info()->IsOptimizing() || info()->IsStub());
778 Address entry = 778 Address entry =
779 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); 779 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type);
780 if (entry == NULL) { 780 if (entry == NULL) {
781 Abort(kBailoutWasNotPrepared); 781 Abort(kBailoutWasNotPrepared);
782 return; 782 return;
(...skipping 20 matching lines...) Expand all
803 803
804 if (info()->ShouldTrapOnDeopt()) { 804 if (info()->ShouldTrapOnDeopt()) {
805 Label skip; 805 Label skip;
806 if (condition != al) { 806 if (condition != al) {
807 __ Branch(&skip, NegateCondition(condition), src1, src2); 807 __ Branch(&skip, NegateCondition(condition), src1, src2);
808 } 808 }
809 __ stop("trap_on_deopt"); 809 __ stop("trap_on_deopt");
810 __ bind(&skip); 810 __ bind(&skip);
811 } 811 }
812 812
813 Deoptimizer::Reason reason(instr->Mnemonic(), detail);
813 DCHECK(info()->IsStub() || frame_is_built_); 814 DCHECK(info()->IsStub() || frame_is_built_);
814 // Go through jump table if we need to handle condition, build frame, or 815 // Go through jump table if we need to handle condition, build frame, or
815 // restore caller doubles. 816 // restore caller doubles.
816 if (condition == al && frame_is_built_ && 817 if (condition == al && frame_is_built_ &&
817 !info()->saves_caller_doubles()) { 818 !info()->saves_caller_doubles()) {
818 DeoptComment(instr->Mnemonic(), reason); 819 DeoptComment(reason);
819 __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2); 820 __ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2);
820 } else { 821 } else {
821 // We often have several deopts to the same entry, reuse the last 822 // We often have several deopts to the same entry, reuse the last
822 // jump entry if this is the case. 823 // jump entry if this is the case.
823 if (deopt_jump_table_.is_empty() || 824 if (deopt_jump_table_.is_empty() ||
824 (deopt_jump_table_.last().address != entry) || 825 (deopt_jump_table_.last().address != entry) ||
825 (deopt_jump_table_.last().bailout_type != bailout_type) || 826 (deopt_jump_table_.last().bailout_type != bailout_type) ||
826 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { 827 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
827 Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason, 828 Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type,
828 bailout_type, !frame_is_built_); 829 !frame_is_built_);
829 deopt_jump_table_.Add(table_entry, zone()); 830 deopt_jump_table_.Add(table_entry, zone());
830 } 831 }
831 __ Branch(&deopt_jump_table_.last().label, condition, src1, src2); 832 __ Branch(&deopt_jump_table_.last().label, condition, src1, src2);
832 } 833 }
833 } 834 }
834 835
835 836
836 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, 837 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
837 Register src1, const Operand& src2, 838 Register src1, const Operand& src2,
838 const char* reason) { 839 const char* detail) {
839 Deoptimizer::BailoutType bailout_type = info()->IsStub() 840 Deoptimizer::BailoutType bailout_type = info()->IsStub()
840 ? Deoptimizer::LAZY 841 ? Deoptimizer::LAZY
841 : Deoptimizer::EAGER; 842 : Deoptimizer::EAGER;
842 DeoptimizeIf(condition, instr, bailout_type, src1, src2, reason); 843 DeoptimizeIf(condition, instr, bailout_type, src1, src2, detail);
843 } 844 }
844 845
845 846
846 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { 847 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
847 int length = deoptimizations_.length(); 848 int length = deoptimizations_.length();
848 if (length == 0) return; 849 if (length == 0) return;
849 Handle<DeoptimizationInputData> data = 850 Handle<DeoptimizationInputData> data =
850 DeoptimizationInputData::New(isolate(), length, TENURED); 851 DeoptimizationInputData::New(isolate(), length, TENURED);
851 852
852 Handle<ByteArray> translations = 853 Handle<ByteArray> translations =
(...skipping 5092 matching lines...) Expand 10 before | Expand all | Expand 10 after
5945 __ li(at, scope_info); 5946 __ li(at, scope_info);
5946 __ Push(at, ToRegister(instr->function())); 5947 __ Push(at, ToRegister(instr->function()));
5947 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5948 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5948 RecordSafepoint(Safepoint::kNoLazyDeopt); 5949 RecordSafepoint(Safepoint::kNoLazyDeopt);
5949 } 5950 }
5950 5951
5951 5952
5952 #undef __ 5953 #undef __
5953 5954
5954 } } // namespace v8::internal 5955 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips64/lithium-codegen-mips64.h ('k') | src/x64/lithium-codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698