Commit 255bf2d6 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

v8: Fix most -Wunreachable-code warnings.

Do this by deleting code after calls to V8_Fatal() (either through
UNREACHABLE() or FATAL()). Comments suggest that the returns there
were needed to make a compiler happy, but all compilers seem to be
happy with this change too. My guess is that either
https://codereview.chromium.org/1393023003 which marked V8_Fatal()
as noreturn, or https://chromium-review.googlesource.com/#/c/544845/
which switched to the C++11 spelling of noreturn, fixed the warnings
that the explicit code after V8_Fatal() was supposed to silence.

There's one more warning in src/compiler/machine-graph-verifier.cc,
but fixing that changes behavior.  I asked about that one in
https://codereview.chromium.org/2573573004/#msg27 instead.

Bug: chromium:346399
Change-Id: Ie9519d5432bdeaaf382e8390d8254d3b79e622e4
Reviewed-on: https://chromium-review.googlesource.com/669803Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48092}
parent 5c2ffc9c
......@@ -689,7 +689,6 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
break;
default:
UNREACHABLE();
type = JS_OBJECT_TYPE; // Keep the compiler happy.
break;
}
......
......@@ -985,9 +985,6 @@ ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type,
}
}
UNREACHABLE();
ElementAccess access = {kUntaggedBase, 0, Type::None(), MachineType::None(),
kNoWriteBarrier};
return access;
}
// static
......
......@@ -2465,7 +2465,6 @@ void BytecodeGraphBuilder::VisitTestTypeOf() {
break;
case interpreter::TestTypeOfFlags::LiteralFlag::kOther:
UNREACHABLE(); // Should never be emitted.
result = nullptr;
break;
}
environment()->BindAccumulator(result);
......
......@@ -3318,10 +3318,6 @@ int TranslatedState::CreateNextTranslatedValue(
}
FATAL("We should never get here - unexpected deopt info.");
TranslatedValue translated_value =
TranslatedValue(nullptr, TranslatedValue::kInvalid);
frame.Add(translated_value);
return translated_value.GetChildrenCount();
}
TranslatedState::TranslatedState(const JavaScriptFrame* frame)
......
......@@ -68,7 +68,6 @@ void DoubleToAscii(double v, DtoaMode mode, int requested_digits,
break;
default:
UNREACHABLE();
fast_worked = false;
}
if (fast_worked) return;
......
......@@ -288,7 +288,6 @@ Handle<FeedbackVector> FeedbackVector::New(Isolate* isolate,
case FeedbackSlotKind::kInvalid:
case FeedbackSlotKind::kKindsNumber:
UNREACHABLE();
vector->set(index, Smi::kZero, SKIP_WRITE_BARRIER);
break;
}
for (int j = 1; j < entry_size; j++) {
......
......@@ -158,7 +158,6 @@ Cell* Module::GetCell(int cell_index) {
break;
case ModuleDescriptor::kInvalid:
UNREACHABLE();
cell = nullptr;
break;
}
return Cell::cast(cell);
......
......@@ -45,8 +45,6 @@ RUNTIME_FUNCTION(Runtime_GetSubstitution) {
MaybeHandle<String> GetNamedCapture(Handle<String> name,
CaptureState* state) override {
UNREACHABLE();
*state = INVALID;
return MaybeHandle<String>();
}
private:
......
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