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

Side by Side Diff: src/compiler/code-generator.cc

Issue 2560743002: [turbofan] Fix skipping of translations for lazy deopt return value stores. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-671574.js » ('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/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/address-map.h" 7 #include "src/address-map.h"
8 #include "src/base/adapters.h" 8 #include "src/base/adapters.h"
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler/code-generator-impl.h" 10 #include "src/compiler/code-generator-impl.h"
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 DeoptimizeReason CodeGenerator::GetDeoptimizationReason( 665 DeoptimizeReason CodeGenerator::GetDeoptimizationReason(
666 int deoptimization_id) const { 666 int deoptimization_id) const {
667 size_t const index = static_cast<size_t>(deoptimization_id); 667 size_t const index = static_cast<size_t>(deoptimization_id);
668 DCHECK_LT(index, deoptimization_states_.size()); 668 DCHECK_LT(index, deoptimization_states_.size());
669 return deoptimization_states_[index]->reason(); 669 return deoptimization_states_[index]->reason();
670 } 670 }
671 671
672 void CodeGenerator::TranslateStateValueDescriptor( 672 void CodeGenerator::TranslateStateValueDescriptor(
673 StateValueDescriptor* desc, StateValueList* nested, 673 StateValueDescriptor* desc, StateValueList* nested,
674 Translation* translation, InstructionOperandIterator* iter) { 674 Translation* translation, InstructionOperandIterator* iter) {
675 // Note:
676 // If translation is null, we just skip the relevant instruction operands.
675 if (desc->IsNested()) { 677 if (desc->IsNested()) {
676 translation->BeginCapturedObject(static_cast<int>(nested->size())); 678 if (translation != nullptr) {
679 translation->BeginCapturedObject(static_cast<int>(nested->size()));
680 }
677 for (auto field : *nested) { 681 for (auto field : *nested) {
678 TranslateStateValueDescriptor(field.desc, field.nested, translation, 682 TranslateStateValueDescriptor(field.desc, field.nested, translation,
679 iter); 683 iter);
680 } 684 }
681 } else if (desc->IsDuplicate()) { 685 } else if (desc->IsDuplicate()) {
682 translation->DuplicateObject(static_cast<int>(desc->id())); 686 if (translation != nullptr) {
687 translation->DuplicateObject(static_cast<int>(desc->id()));
688 }
683 } else if (desc->IsPlain()) { 689 } else if (desc->IsPlain()) {
684 AddTranslationForOperand(translation, iter->instruction(), iter->Advance(), 690 InstructionOperand* op = iter->Advance();
685 desc->type()); 691 if (translation != nullptr) {
692 AddTranslationForOperand(translation, iter->instruction(), op,
693 desc->type());
694 }
686 } else { 695 } else {
687 DCHECK(desc->IsOptimizedOut()); 696 DCHECK(desc->IsOptimizedOut());
688 if (optimized_out_literal_id_ == -1) { 697 if (translation != nullptr) {
689 optimized_out_literal_id_ = 698 if (optimized_out_literal_id_ == -1) {
690 DefineDeoptimizationLiteral(isolate()->factory()->optimized_out()); 699 optimized_out_literal_id_ =
700 DefineDeoptimizationLiteral(isolate()->factory()->optimized_out());
701 }
702 translation->StoreLiteral(optimized_out_literal_id_);
691 } 703 }
692 translation->StoreLiteral(optimized_out_literal_id_);
693 } 704 }
694 } 705 }
695 706
696 707
697 void CodeGenerator::TranslateFrameStateDescriptorOperands( 708 void CodeGenerator::TranslateFrameStateDescriptorOperands(
698 FrameStateDescriptor* desc, InstructionOperandIterator* iter, 709 FrameStateDescriptor* desc, InstructionOperandIterator* iter,
699 OutputFrameStateCombine combine, Translation* translation) { 710 OutputFrameStateCombine combine, Translation* translation) {
700 size_t index = 0; 711 size_t index = 0;
701 StateValueList* values = desc->GetStateValueDescriptors(); 712 StateValueList* values = desc->GetStateValueDescriptors();
702 for (StateValueList::iterator it = values->begin(); it != values->end(); 713 for (StateValueList::iterator it = values->begin(); it != values->end();
703 ++it, ++index) { 714 ++it, ++index) {
715 StateValueDescriptor* value_desc = (*it).desc;
704 if (combine.kind() == OutputFrameStateCombine::kPokeAt) { 716 if (combine.kind() == OutputFrameStateCombine::kPokeAt) {
705 // The result of the call should be placed at position 717 // The result of the call should be placed at position
706 // [index_from_top] in the stack (overwriting whatever was 718 // [index_from_top] in the stack (overwriting whatever was
707 // previously there). 719 // previously there).
708 size_t index_from_top = 720 size_t index_from_top =
709 desc->GetSize(combine) - 1 - combine.GetOffsetToPokeAt(); 721 desc->GetSize(combine) - 1 - combine.GetOffsetToPokeAt();
710 if (index >= index_from_top && 722 if (index >= index_from_top &&
711 index < index_from_top + iter->instruction()->OutputCount()) { 723 index < index_from_top + iter->instruction()->OutputCount()) {
724 DCHECK_NOT_NULL(translation);
712 AddTranslationForOperand( 725 AddTranslationForOperand(
713 translation, iter->instruction(), 726 translation, iter->instruction(),
714 iter->instruction()->OutputAt(index - index_from_top), 727 iter->instruction()->OutputAt(index - index_from_top),
715 MachineType::AnyTagged()); 728 MachineType::AnyTagged());
716 iter->Advance(); // We do not use this input, but we need to 729 // Skip the instruction operands.
717 // advace, as the input got replaced. 730 TranslateStateValueDescriptor(value_desc, (*it).nested, nullptr, iter);
718 continue; 731 continue;
719 } 732 }
720 } 733 }
721 TranslateStateValueDescriptor((*it).desc, (*it).nested, translation, iter); 734 TranslateStateValueDescriptor(value_desc, (*it).nested, translation, iter);
722 } 735 }
723 DCHECK_EQ(desc->GetSize(OutputFrameStateCombine::Ignore()), index); 736 DCHECK_EQ(desc->GetSize(OutputFrameStateCombine::Ignore()), index);
724 737
725 if (combine.kind() == OutputFrameStateCombine::kPushOutput) { 738 if (combine.kind() == OutputFrameStateCombine::kPushOutput) {
726 DCHECK(combine.GetPushCount() <= iter->instruction()->OutputCount()); 739 DCHECK(combine.GetPushCount() <= iter->instruction()->OutputCount());
727 for (size_t output = 0; output < combine.GetPushCount(); output++) { 740 for (size_t output = 0; output < combine.GetPushCount(); output++) {
728 // Materialize the result of the call instruction in this slot. 741 // Materialize the result of the call instruction in this slot.
729 AddTranslationForOperand(translation, iter->instruction(), 742 AddTranslationForOperand(translation, iter->instruction(),
730 iter->instruction()->OutputAt(output), 743 iter->instruction()->OutputAt(output),
731 MachineType::AnyTagged()); 744 MachineType::AnyTagged());
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { 980 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) {
968 gen->ools_ = this; 981 gen->ools_ = this;
969 } 982 }
970 983
971 984
972 OutOfLineCode::~OutOfLineCode() {} 985 OutOfLineCode::~OutOfLineCode() {}
973 986
974 } // namespace compiler 987 } // namespace compiler
975 } // namespace internal 988 } // namespace internal
976 } // namespace v8 989 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-671574.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698