Commit a2ec7535 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[serializer] Explicitly declare unused byte codes

Creates a macro that in debug builds generates case statements for
unused bytes codes (marked UNREACHABLE). This will catch the case where
a byte code declared to be unused is actually used. Should be easier to
maintain than the existing comments.

Change-Id: I0b5d830be88b7ef747975657283c1b1e98182360
Reviewed-on: https://chromium-review.googlesource.com/928650Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51482}
parent 8d889e39
......@@ -647,12 +647,17 @@ bool Deserializer<AllocatorT>::ReadData(Object** current, Object** limit,
break;
}
#ifdef DEBUG
#define UNUSED_CASE(byte_code) \
case byte_code: \
UNREACHABLE();
UNUSED_SERIALIZER_BYTE_CODES(UNUSED_CASE)
#endif
#undef UNUSED_CASE
#undef SIXTEEN_CASES
#undef FOUR_CASES
#undef SINGLE_CASE
default:
UNREACHABLE();
}
}
CHECK_EQ(limit, current);
......
......@@ -116,6 +116,40 @@ class SerializerDeserializer : public RootVisitor {
void RestoreExternalReferenceRedirectors(
const std::vector<CallHandlerInfo*>& call_handler_infos);
#define UNUSED_SERIALIZER_BYTE_CODES(V) \
V(0x1d) \
V(0x1e) \
V(0x55) \
V(0x56) \
V(0x57) \
V(0x75) \
V(0x76) \
V(0x77) \
V(0x78) \
V(0x79) \
V(0x7a) \
V(0x7b) \
V(0x7c) \
V(0x7d) \
V(0x7e) \
V(0x7f) \
V(0xf0) \
V(0xf1) \
V(0xf2) \
V(0xf3) \
V(0xf4) \
V(0xf5) \
V(0xf6) \
V(0xf7) \
V(0xf8) \
V(0xf9) \
V(0xfa) \
V(0xfb) \
V(0xfc) \
V(0xfd) \
V(0xfe) \
V(0xff)
// ---------- byte code range 0x00..0x7f ----------
// Byte codes in this range represent Where, HowToCode and WhereToPoint.
// Where the pointed-to object can be found:
......@@ -196,8 +230,6 @@ class SerializerDeserializer : public RootVisitor {
// Used for embedder-allocated backing stores for TypedArrays.
static const int kOffHeapBackingStore = 0x1c;
// 0x1d, 0x1e unused.
// Used for embedder-provided serialization data for embedder fields.
static const int kEmbedderFieldsData = 0x1f;
......@@ -217,8 +249,6 @@ class SerializerDeserializer : public RootVisitor {
static const int kHotObjectWithSkip = 0x58;
static const int kHotObjectMask = 0x07;
// 0x55..0x57, 0x75..0x7f unused.
// ---------- byte code range 0x80..0xff ----------
// First 32 root array items.
static const int kNumberOfRootArrayConstants = 0x20;
......@@ -241,8 +271,6 @@ class SerializerDeserializer : public RootVisitor {
static const int kFixedRepeat = 0xe0;
static const int kFixedRepeatStart = kFixedRepeat - 1;
// 0xf0..0xff unused.
// ---------- special values ----------
static const int kAnyOldSpace = -1;
......
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