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( ...@@ -689,7 +689,6 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
type = JS_OBJECT_TYPE; // Keep the compiler happy.
break; break;
} }
......
...@@ -985,9 +985,6 @@ ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type, ...@@ -985,9 +985,6 @@ ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type,
} }
} }
UNREACHABLE(); UNREACHABLE();
ElementAccess access = {kUntaggedBase, 0, Type::None(), MachineType::None(),
kNoWriteBarrier};
return access;
} }
// static // static
......
...@@ -2465,7 +2465,6 @@ void BytecodeGraphBuilder::VisitTestTypeOf() { ...@@ -2465,7 +2465,6 @@ void BytecodeGraphBuilder::VisitTestTypeOf() {
break; break;
case interpreter::TestTypeOfFlags::LiteralFlag::kOther: case interpreter::TestTypeOfFlags::LiteralFlag::kOther:
UNREACHABLE(); // Should never be emitted. UNREACHABLE(); // Should never be emitted.
result = nullptr;
break; break;
} }
environment()->BindAccumulator(result); environment()->BindAccumulator(result);
......
...@@ -3318,10 +3318,6 @@ int TranslatedState::CreateNextTranslatedValue( ...@@ -3318,10 +3318,6 @@ int TranslatedState::CreateNextTranslatedValue(
} }
FATAL("We should never get here - unexpected deopt info."); 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) TranslatedState::TranslatedState(const JavaScriptFrame* frame)
......
...@@ -68,7 +68,6 @@ void DoubleToAscii(double v, DtoaMode mode, int requested_digits, ...@@ -68,7 +68,6 @@ void DoubleToAscii(double v, DtoaMode mode, int requested_digits,
break; break;
default: default:
UNREACHABLE(); UNREACHABLE();
fast_worked = false;
} }
if (fast_worked) return; if (fast_worked) return;
......
...@@ -288,7 +288,6 @@ Handle<FeedbackVector> FeedbackVector::New(Isolate* isolate, ...@@ -288,7 +288,6 @@ Handle<FeedbackVector> FeedbackVector::New(Isolate* isolate,
case FeedbackSlotKind::kInvalid: case FeedbackSlotKind::kInvalid:
case FeedbackSlotKind::kKindsNumber: case FeedbackSlotKind::kKindsNumber:
UNREACHABLE(); UNREACHABLE();
vector->set(index, Smi::kZero, SKIP_WRITE_BARRIER);
break; break;
} }
for (int j = 1; j < entry_size; j++) { for (int j = 1; j < entry_size; j++) {
......
...@@ -158,7 +158,6 @@ Cell* Module::GetCell(int cell_index) { ...@@ -158,7 +158,6 @@ Cell* Module::GetCell(int cell_index) {
break; break;
case ModuleDescriptor::kInvalid: case ModuleDescriptor::kInvalid:
UNREACHABLE(); UNREACHABLE();
cell = nullptr;
break; break;
} }
return Cell::cast(cell); return Cell::cast(cell);
......
...@@ -45,8 +45,6 @@ RUNTIME_FUNCTION(Runtime_GetSubstitution) { ...@@ -45,8 +45,6 @@ RUNTIME_FUNCTION(Runtime_GetSubstitution) {
MaybeHandle<String> GetNamedCapture(Handle<String> name, MaybeHandle<String> GetNamedCapture(Handle<String> name,
CaptureState* state) override { CaptureState* state) override {
UNREACHABLE(); UNREACHABLE();
*state = INVALID;
return MaybeHandle<String>();
} }
private: 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