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

Side by Side Diff: src/x64/lithium-codegen-x64.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/x64/lithium-codegen-x64.h ('k') | src/x87/lithium-codegen-x87.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 Comment(";;; -------------------- Jump table --------------------"); 303 Comment(";;; -------------------- Jump table --------------------");
304 } 304 }
305 for (int i = 0; i < jump_table_.length(); i++) { 305 for (int i = 0; i < jump_table_.length(); i++) {
306 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i]; 306 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i];
307 __ bind(&table_entry->label); 307 __ bind(&table_entry->label);
308 Address entry = table_entry->address; 308 Address entry = table_entry->address;
309 Deoptimizer::BailoutType type = table_entry->bailout_type; 309 Deoptimizer::BailoutType type = table_entry->bailout_type;
310 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); 310 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
311 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id); 311 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id);
312 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); 312 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
313 DeoptComment(table_entry->mnemonic, table_entry->reason); 313 DeoptComment(table_entry->reason);
314 if (table_entry->needs_frame) { 314 if (table_entry->needs_frame) {
315 DCHECK(!info()->saves_caller_doubles()); 315 DCHECK(!info()->saves_caller_doubles());
316 __ Move(kScratchRegister, ExternalReference::ForDeoptEntry(entry)); 316 __ Move(kScratchRegister, ExternalReference::ForDeoptEntry(entry));
317 if (needs_frame.is_bound()) { 317 if (needs_frame.is_bound()) {
318 __ jmp(&needs_frame); 318 __ jmp(&needs_frame);
319 } else { 319 } else {
320 __ bind(&needs_frame); 320 __ bind(&needs_frame);
321 __ movp(rsi, MemOperand(rbp, StandardFrameConstants::kContextOffset)); 321 __ movp(rsi, MemOperand(rbp, StandardFrameConstants::kContextOffset));
322 __ pushq(rbp); 322 __ pushq(rbp);
323 __ movp(rbp, rsp); 323 __ movp(rbp, rsp);
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 int pc_offset = masm()->pc_offset(); 722 int pc_offset = masm()->pc_offset();
723 environment->Register(deoptimization_index, 723 environment->Register(deoptimization_index,
724 translation.index(), 724 translation.index(),
725 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); 725 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1);
726 deoptimizations_.Add(environment, environment->zone()); 726 deoptimizations_.Add(environment, environment->zone());
727 } 727 }
728 } 728 }
729 729
730 730
731 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr, 731 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
732 const char* reason, 732 const char* detail,
733 Deoptimizer::BailoutType bailout_type) { 733 Deoptimizer::BailoutType bailout_type) {
734 LEnvironment* environment = instr->environment(); 734 LEnvironment* environment = instr->environment();
735 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 735 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
736 DCHECK(environment->HasBeenRegistered()); 736 DCHECK(environment->HasBeenRegistered());
737 int id = environment->deoptimization_index(); 737 int id = environment->deoptimization_index();
738 DCHECK(info()->IsOptimizing() || info()->IsStub()); 738 DCHECK(info()->IsOptimizing() || info()->IsStub());
739 Address entry = 739 Address entry =
740 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); 740 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type);
741 if (entry == NULL) { 741 if (entry == NULL) {
742 Abort(kBailoutWasNotPrepared); 742 Abort(kBailoutWasNotPrepared);
(...skipping 24 matching lines...) Expand all
767 767
768 if (info()->ShouldTrapOnDeopt()) { 768 if (info()->ShouldTrapOnDeopt()) {
769 Label done; 769 Label done;
770 if (cc != no_condition) { 770 if (cc != no_condition) {
771 __ j(NegateCondition(cc), &done, Label::kNear); 771 __ j(NegateCondition(cc), &done, Label::kNear);
772 } 772 }
773 __ int3(); 773 __ int3();
774 __ bind(&done); 774 __ bind(&done);
775 } 775 }
776 776
777 Deoptimizer::Reason reason(instr->Mnemonic(), detail);
777 DCHECK(info()->IsStub() || frame_is_built_); 778 DCHECK(info()->IsStub() || frame_is_built_);
778 // Go through jump table if we need to handle condition, build frame, or 779 // Go through jump table if we need to handle condition, build frame, or
779 // restore caller doubles. 780 // restore caller doubles.
780 if (cc == no_condition && frame_is_built_ && 781 if (cc == no_condition && frame_is_built_ &&
781 !info()->saves_caller_doubles()) { 782 !info()->saves_caller_doubles()) {
782 DeoptComment(instr->Mnemonic(), reason); 783 DeoptComment(reason);
783 __ call(entry, RelocInfo::RUNTIME_ENTRY); 784 __ call(entry, RelocInfo::RUNTIME_ENTRY);
784 } else { 785 } else {
785 // We often have several deopts to the same entry, reuse the last 786 // We often have several deopts to the same entry, reuse the last
786 // jump entry if this is the case. 787 // jump entry if this is the case.
787 if (jump_table_.is_empty() || 788 if (jump_table_.is_empty() ||
788 jump_table_.last().address != entry || 789 jump_table_.last().address != entry ||
789 jump_table_.last().needs_frame != !frame_is_built_ || 790 jump_table_.last().needs_frame != !frame_is_built_ ||
790 jump_table_.last().bailout_type != bailout_type) { 791 jump_table_.last().bailout_type != bailout_type) {
791 Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason, 792 Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type,
792 bailout_type, !frame_is_built_); 793 !frame_is_built_);
793 jump_table_.Add(table_entry, zone()); 794 jump_table_.Add(table_entry, zone());
794 } 795 }
795 if (cc == no_condition) { 796 if (cc == no_condition) {
796 __ jmp(&jump_table_.last().label); 797 __ jmp(&jump_table_.last().label);
797 } else { 798 } else {
798 __ j(cc, &jump_table_.last().label); 799 __ j(cc, &jump_table_.last().label);
799 } 800 }
800 } 801 }
801 } 802 }
802 803
803 804
804 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr, 805 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
805 const char* reason) { 806 const char* detail) {
806 Deoptimizer::BailoutType bailout_type = info()->IsStub() 807 Deoptimizer::BailoutType bailout_type = info()->IsStub()
807 ? Deoptimizer::LAZY 808 ? Deoptimizer::LAZY
808 : Deoptimizer::EAGER; 809 : Deoptimizer::EAGER;
809 DeoptimizeIf(cc, instr, reason, bailout_type); 810 DeoptimizeIf(cc, instr, detail, bailout_type);
810 } 811 }
811 812
812 813
813 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { 814 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
814 int length = deoptimizations_.length(); 815 int length = deoptimizations_.length();
815 if (length == 0) return; 816 if (length == 0) return;
816 Handle<DeoptimizationInputData> data = 817 Handle<DeoptimizationInputData> data =
817 DeoptimizationInputData::New(isolate(), length, TENURED); 818 DeoptimizationInputData::New(isolate(), length, TENURED);
818 819
819 Handle<ByteArray> translations = 820 Handle<ByteArray> translations =
(...skipping 5063 matching lines...) Expand 10 before | Expand all | Expand 10 after
5883 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5884 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5884 RecordSafepoint(Safepoint::kNoLazyDeopt); 5885 RecordSafepoint(Safepoint::kNoLazyDeopt);
5885 } 5886 }
5886 5887
5887 5888
5888 #undef __ 5889 #undef __
5889 5890
5890 } } // namespace v8::internal 5891 } } // namespace v8::internal
5891 5892
5892 #endif // V8_TARGET_ARCH_X64 5893 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x87/lithium-codegen-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698