Commit d44f75f5 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[deoptimizer] Report if speculation bit changed with --trace-deopt

This CL adds output related to the no speculation bit on the feedback
vector. Messages appear on two occasions:
  - if a feedback vector is read from the deoptimization entry
  - if the no-speculation bit on a feedback vector is set
The latter only happens during object materialization.

Bug: v8:7127
Change-Id: I9676323d3223441472539a544d3309687dba27a3
Reviewed-on: https://chromium-review.googlesource.com/849092Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50496}
parent 3eab6df1
......@@ -605,7 +605,8 @@ void Deoptimizer::DoComputeOutputFrames() {
input_data->OptimizationId()->value(), bailout_id_, fp_to_sp_delta_,
caller_frame_top_);
if (bailout_type_ == EAGER || bailout_type_ == SOFT) {
compiled_code_->PrintDeoptLocation(trace_scope_->file(), from_);
compiled_code_->PrintDeoptLocation(
trace_scope_->file(), " ;;; deoptimize at ", from_);
}
}
......@@ -1715,7 +1716,12 @@ void Deoptimizer::MaterializeHeapObjects() {
translated_state_.VerifyMaterializedObjects();
translated_state_.DoUpdateFeedback();
bool feedback_updated = translated_state_.DoUpdateFeedback();
if (trace_scope_ != nullptr && feedback_updated) {
PrintF(trace_scope_->file(), "Feedback updated");
compiled_code_->PrintDeoptLocation(trace_scope_->file(),
" from deoptimization at ", from_);
}
isolate_->materialized_object_store()->Remove(
reinterpret_cast<Address>(stack_fp_));
......@@ -3229,7 +3235,7 @@ void TranslatedState::Init(Address input_frame_pointer,
CHECK_LE(update_feedback_count, 1);
if (update_feedback_count == 1) {
ReadUpdateFeedback(iterator, literal_array);
ReadUpdateFeedback(iterator, literal_array, trace_file);
}
std::stack<int> nested_counts;
......@@ -3896,20 +3902,27 @@ void TranslatedState::VerifyMaterializedObjects() {
#endif
}
void TranslatedState::DoUpdateFeedback() {
bool TranslatedState::DoUpdateFeedback() {
if (!feedback_vector_handle_.is_null()) {
CHECK(!feedback_slot_.IsInvalid());
isolate()->CountUsage(v8::Isolate::kDeoptimizerDisableSpeculation);
CallICNexus nexus(feedback_vector_handle_, feedback_slot_);
nexus.SetSpeculationMode(SpeculationMode::kDisallowSpeculation);
return true;
}
return false;
}
void TranslatedState::ReadUpdateFeedback(TranslationIterator* iterator,
FixedArray* literal_array) {
FixedArray* literal_array,
FILE* trace_file) {
CHECK_EQ(Translation::UPDATE_FEEDBACK, iterator->Next());
feedback_vector_ = FeedbackVector::cast(literal_array->get(iterator->Next()));
feedback_slot_ = FeedbackSlot(iterator->Next());
if (trace_file != nullptr) {
PrintF(trace_file, " reading FeedbackVector (slot %d)\n",
feedback_slot_.ToInt());
}
}
} // namespace internal
......
......@@ -297,7 +297,7 @@ class TranslatedState {
FILE* trace_file, int parameter_count);
void VerifyMaterializedObjects();
void DoUpdateFeedback();
bool DoUpdateFeedback();
private:
friend TranslatedValue;
......@@ -345,7 +345,7 @@ class TranslatedState {
Handle<Map> map, const DisallowHeapAllocation& no_allocation);
void ReadUpdateFeedback(TranslationIterator* iterator,
FixedArray* literal_array);
FixedArray* literal_array, FILE* trace_file);
TranslatedValue* ResolveCapturedObject(TranslatedValue* slot);
TranslatedValue* GetValueByObjectIndex(int object_index);
......
......@@ -14142,11 +14142,11 @@ void JSFunction::ClearTypeFeedbackInfo() {
}
}
void Code::PrintDeoptLocation(FILE* out, Address pc) {
void Code::PrintDeoptLocation(FILE* out, const char* str, Address pc) {
Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(this, pc);
class SourcePosition pos = info.position;
if (info.deopt_reason != DeoptimizeReason::kUnknown || pos.IsKnown()) {
PrintF(out, " ;;; deoptimize at ");
PrintF(out, "%s", str);
OFStream outstr(out);
pos.Print(outstr, this);
PrintF(out, ", %s\n", DeoptimizeReasonToString(info.deopt_reason));
......
......@@ -389,7 +389,7 @@ class Code : public HeapObject {
DECL_PRINTER(Code)
DECL_VERIFIER(Code)
void PrintDeoptLocation(FILE* out, Address pc);
void PrintDeoptLocation(FILE* out, const char* str, Address pc);
bool CanDeoptAt(Address pc);
inline HandlerTable::CatchPrediction GetBuiltinCatchPrediction();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment