Skip to content

Commit

Permalink
[deoptimizer] Turn always-true condition into (D)CHECK
Browse files Browse the repository at this point in the history
Also fix a typo in a log message.

Change-Id: I247e5347b7f7d71b08630489896da463dd76b8a3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2277885
Auto-Submit: Georg Neis <neis@chromium.org>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68635}
  • Loading branch information
GeorgNeis authored and Commit Bot committed Jul 1, 2020
1 parent 3a4a023 commit f672635
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
27 changes: 13 additions & 14 deletions src/deoptimizer/deoptimizer.cc
Expand Up @@ -176,7 +176,7 @@ Code Deoptimizer::FindDeoptimizingCode(Address addr) {
Object element = native_context.DeoptimizedCodeListHead();
while (!element.IsUndefined(isolate)) {
Code code = Code::cast(element);
CHECK(code.kind() == Code::OPTIMIZED_FUNCTION);
CHECK_EQ(code.kind(), Code::OPTIMIZED_FUNCTION);
if (code.contains(addr)) return code;
element = code.next_code_link();
}
Expand Down Expand Up @@ -528,13 +528,13 @@ Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction function,
DCHECK(AllowHeapAllocation::IsAllowed());
disallow_heap_allocation_ = new DisallowHeapAllocation();
#endif // DEBUG
if ((compiled_code_.kind() != Code::OPTIMIZED_FUNCTION ||
!compiled_code_.deopt_already_counted()) &&
CHECK_EQ(compiled_code_.kind(), Code::OPTIMIZED_FUNCTION);
if (!compiled_code_.deopt_already_counted() &&
deopt_kind_ == DeoptimizeKind::kSoft) {
isolate->counters()->soft_deopts_executed()->Increment();
}
if (compiled_code_.kind() == Code::OPTIMIZED_FUNCTION) {
compiled_code_.set_deopt_already_counted(true);
compiled_code_.set_deopt_already_counted(true);
{
HandleScope scope(isolate_);
PROFILE(isolate_, CodeDeoptEvent(handle(compiled_code_, isolate_), kind,
from_, fp_to_sp_delta_));
Expand Down Expand Up @@ -665,7 +665,7 @@ int Deoptimizer::GetDeoptimizedCodeCount(Isolate* isolate) {
Object element = native_context.DeoptimizedCodeListHead();
while (!element.IsUndefined(isolate)) {
Code code = Code::cast(element);
DCHECK(code.kind() == Code::OPTIMIZED_FUNCTION);
DCHECK_EQ(code.kind(), Code::OPTIMIZED_FUNCTION);
if (!code.marked_for_deoptimization()) {
length++;
}
Expand Down Expand Up @@ -1819,14 +1819,13 @@ unsigned Deoptimizer::ComputeInputFrameSize() const {
// function into account so we have to avoid double counting them.
unsigned fixed_size_above_fp = ComputeInputFrameAboveFpFixedSize();
unsigned result = fixed_size_above_fp + fp_to_sp_delta_;
if (compiled_code_.kind() == Code::OPTIMIZED_FUNCTION) {
unsigned stack_slots = compiled_code_.stack_slots();
unsigned outgoing_size = 0;
// ComputeOutgoingArgumentSize(compiled_code_, bailout_id_);
CHECK_EQ(fixed_size_above_fp + (stack_slots * kSystemPointerSize) -
CommonFrameConstants::kFixedFrameSizeAboveFp + outgoing_size,
result);
}
DCHECK_EQ(compiled_code_.kind(), Code::OPTIMIZED_FUNCTION);
unsigned stack_slots = compiled_code_.stack_slots();
unsigned outgoing_size = 0;
// ComputeOutgoingArgumentSize(compiled_code_, bailout_id_);
CHECK_EQ(fixed_size_above_fp + (stack_slots * kSystemPointerSize) -
CommonFrameConstants::kFixedFrameSizeAboveFp + outgoing_size,
result);
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion src/objects/feedback-vector.cc
Expand Up @@ -411,7 +411,7 @@ void FeedbackVector::EvictOptimizedCodeMarkedForDeoptimization(
if (FLAG_trace_deopt) {
CodeTracer::Scope scope(GetIsolate()->GetCodeTracer());
PrintF(scope.file(),
"[evicting optimizing code marked for deoptimization (%s) for ",
"[evicting optimized code marked for deoptimization (%s) for ",
reason);
shared.ShortPrint(scope.file());
PrintF(scope.file(), "]\n");
Expand Down

0 comments on commit f672635

Please sign in to comment.