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

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

Issue 582743002: Emit comment with instruction+reason before deopt calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 296 }
297 } 297 }
298 298
299 299
300 bool LCodeGen::GenerateJumpTable() { 300 bool LCodeGen::GenerateJumpTable() {
301 Label needs_frame; 301 Label needs_frame;
302 if (jump_table_.length() > 0) { 302 if (jump_table_.length() > 0) {
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 __ bind(&jump_table_[i].label); 306 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i];
307 Address entry = jump_table_[i].address; 307 __ bind(&table_entry->label);
308 Deoptimizer::BailoutType type = jump_table_[i].bailout_type; 308 Address entry = table_entry->address;
309 Deoptimizer::BailoutType type = table_entry->bailout_type;
309 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); 310 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
310 if (id == Deoptimizer::kNotDeoptimizationEntry) { 311 if (id == Deoptimizer::kNotDeoptimizationEntry) {
311 Comment(";;; jump table entry %d.", i); 312 Comment(";;; jump table entry %d.", i);
312 } else { 313 } else {
313 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); 314 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
314 } 315 }
315 if (jump_table_[i].needs_frame) { 316 DeoptComment(table_entry->mnemonic, table_entry->reason);
317 if (table_entry->needs_frame) {
316 DCHECK(!info()->saves_caller_doubles()); 318 DCHECK(!info()->saves_caller_doubles());
317 __ Move(kScratchRegister, ExternalReference::ForDeoptEntry(entry)); 319 __ Move(kScratchRegister, ExternalReference::ForDeoptEntry(entry));
318 if (needs_frame.is_bound()) { 320 if (needs_frame.is_bound()) {
319 __ jmp(&needs_frame); 321 __ jmp(&needs_frame);
320 } else { 322 } else {
321 __ bind(&needs_frame); 323 __ bind(&needs_frame);
322 __ movp(rsi, MemOperand(rbp, StandardFrameConstants::kContextOffset)); 324 __ movp(rsi, MemOperand(rbp, StandardFrameConstants::kContextOffset));
323 __ pushq(rbp); 325 __ pushq(rbp);
324 __ movp(rbp, rsp); 326 __ movp(rbp, rsp);
325 __ Push(rsi); 327 __ Push(rsi);
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 int pc_offset = masm()->pc_offset(); 725 int pc_offset = masm()->pc_offset();
724 environment->Register(deoptimization_index, 726 environment->Register(deoptimization_index,
725 translation.index(), 727 translation.index(),
726 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); 728 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1);
727 deoptimizations_.Add(environment, environment->zone()); 729 deoptimizations_.Add(environment, environment->zone());
728 } 730 }
729 } 731 }
730 732
731 733
732 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr, 734 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
735 const char* reason,
733 Deoptimizer::BailoutType bailout_type) { 736 Deoptimizer::BailoutType bailout_type) {
734 LEnvironment* environment = instr->environment(); 737 LEnvironment* environment = instr->environment();
735 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 738 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
736 DCHECK(environment->HasBeenRegistered()); 739 DCHECK(environment->HasBeenRegistered());
737 int id = environment->deoptimization_index(); 740 int id = environment->deoptimization_index();
738 DCHECK(info()->IsOptimizing() || info()->IsStub()); 741 DCHECK(info()->IsOptimizing() || info()->IsStub());
739 Address entry = 742 Address entry =
740 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); 743 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type);
741 if (entry == NULL) { 744 if (entry == NULL) {
742 Abort(kBailoutWasNotPrepared); 745 Abort(kBailoutWasNotPrepared);
(...skipping 29 matching lines...) Expand all
772 } 775 }
773 __ int3(); 776 __ int3();
774 __ bind(&done); 777 __ bind(&done);
775 } 778 }
776 779
777 DCHECK(info()->IsStub() || frame_is_built_); 780 DCHECK(info()->IsStub() || frame_is_built_);
778 // Go through jump table if we need to handle condition, build frame, or 781 // Go through jump table if we need to handle condition, build frame, or
779 // restore caller doubles. 782 // restore caller doubles.
780 if (cc == no_condition && frame_is_built_ && 783 if (cc == no_condition && frame_is_built_ &&
781 !info()->saves_caller_doubles()) { 784 !info()->saves_caller_doubles()) {
785 DeoptComment(instr->Mnemonic(), reason);
782 __ call(entry, RelocInfo::RUNTIME_ENTRY); 786 __ call(entry, RelocInfo::RUNTIME_ENTRY);
783 } else { 787 } else {
784 // We often have several deopts to the same entry, reuse the last 788 // We often have several deopts to the same entry, reuse the last
785 // jump entry if this is the case. 789 // jump entry if this is the case.
786 if (jump_table_.is_empty() || 790 if (jump_table_.is_empty() ||
787 jump_table_.last().address != entry || 791 jump_table_.last().address != entry ||
788 jump_table_.last().needs_frame != !frame_is_built_ || 792 jump_table_.last().needs_frame != !frame_is_built_ ||
789 jump_table_.last().bailout_type != bailout_type) { 793 jump_table_.last().bailout_type != bailout_type) {
790 Deoptimizer::JumpTableEntry table_entry(entry, 794 Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason,
791 bailout_type, 795 bailout_type, !frame_is_built_);
792 !frame_is_built_);
793 jump_table_.Add(table_entry, zone()); 796 jump_table_.Add(table_entry, zone());
794 } 797 }
795 if (cc == no_condition) { 798 if (cc == no_condition) {
796 __ jmp(&jump_table_.last().label); 799 __ jmp(&jump_table_.last().label);
797 } else { 800 } else {
798 __ j(cc, &jump_table_.last().label); 801 __ j(cc, &jump_table_.last().label);
799 } 802 }
800 } 803 }
801 } 804 }
802 805
803 806
804 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr) { 807 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
808 const char* reason) {
805 Deoptimizer::BailoutType bailout_type = info()->IsStub() 809 Deoptimizer::BailoutType bailout_type = info()->IsStub()
806 ? Deoptimizer::LAZY 810 ? Deoptimizer::LAZY
807 : Deoptimizer::EAGER; 811 : Deoptimizer::EAGER;
808 DeoptimizeIf(cc, instr, bailout_type); 812 DeoptimizeIf(cc, instr, reason, bailout_type);
809 } 813 }
810 814
811 815
812 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { 816 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
813 int length = deoptimizations_.length(); 817 int length = deoptimizations_.length();
814 if (length == 0) return; 818 if (length == 0) return;
815 Handle<DeoptimizationInputData> data = 819 Handle<DeoptimizationInputData> data =
816 DeoptimizationInputData::New(isolate(), length, TENURED); 820 DeoptimizationInputData::New(isolate(), length, TENURED);
817 821
818 Handle<ByteArray> translations = 822 Handle<ByteArray> translations =
(...skipping 4821 matching lines...) Expand 10 before | Expand all | Expand 10 after
5640 5644
5641 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { 5645 void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
5642 Deoptimizer::BailoutType type = instr->hydrogen()->type(); 5646 Deoptimizer::BailoutType type = instr->hydrogen()->type();
5643 // TODO(danno): Stubs expect all deopts to be lazy for historical reasons (the 5647 // TODO(danno): Stubs expect all deopts to be lazy for historical reasons (the
5644 // needed return address), even though the implementation of LAZY and EAGER is 5648 // needed return address), even though the implementation of LAZY and EAGER is
5645 // now identical. When LAZY is eventually completely folded into EAGER, remove 5649 // now identical. When LAZY is eventually completely folded into EAGER, remove
5646 // the special case below. 5650 // the special case below.
5647 if (info()->IsStub() && type == Deoptimizer::EAGER) { 5651 if (info()->IsStub() && type == Deoptimizer::EAGER) {
5648 type = Deoptimizer::LAZY; 5652 type = Deoptimizer::LAZY;
5649 } 5653 }
5650 5654 DeoptimizeIf(no_condition, instr, instr->hydrogen()->reason(), type);
5651 Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
5652 DeoptimizeIf(no_condition, instr, type);
5653 } 5655 }
5654 5656
5655 5657
5656 void LCodeGen::DoDummy(LDummy* instr) { 5658 void LCodeGen::DoDummy(LDummy* instr) {
5657 // Nothing to see here, move on! 5659 // Nothing to see here, move on!
5658 } 5660 }
5659 5661
5660 5662
5661 void LCodeGen::DoDummyUse(LDummyUse* instr) { 5663 void LCodeGen::DoDummyUse(LDummyUse* instr) {
5662 // Nothing to see here, move on! 5664 // Nothing to see here, move on!
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
5884 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5886 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5885 RecordSafepoint(Safepoint::kNoLazyDeopt); 5887 RecordSafepoint(Safepoint::kNoLazyDeopt);
5886 } 5888 }
5887 5889
5888 5890
5889 #undef __ 5891 #undef __
5890 5892
5891 } } // namespace v8::internal 5893 } } // namespace v8::internal
5892 5894
5893 #endif // V8_TARGET_ARCH_X64 5895 #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