Commit fc95e35b authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

[jumbo] Avoid identical symbols between json and normal parser

The new json parser reuses a lot of symbol names from the
ordinary parser and in some extreme jumbo builds those
symbols end up in the same translation unit and prevents
compilation.

This adds "Json" to some duplicate symbol names.

Change-Id: Ie38ec7e65f9807b877d35689b654c696dc880998
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1602704
Auto-Submit: Daniel Bratell <bratell@opera.com>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61403}
parent 68449685
...@@ -49,7 +49,7 @@ class VectorSegment { ...@@ -49,7 +49,7 @@ class VectorSegment {
const typename Container::size_type begin_; const typename Container::size_type begin_;
}; };
constexpr JsonToken GetOneCharToken(uint8_t c) { constexpr JsonToken GetOneCharJsonToken(uint8_t c) {
// clang-format off // clang-format off
return return
c == '"' ? JsonToken::STRING : c == '"' ? JsonToken::STRING :
...@@ -73,11 +73,11 @@ constexpr JsonToken GetOneCharToken(uint8_t c) { ...@@ -73,11 +73,11 @@ constexpr JsonToken GetOneCharToken(uint8_t c) {
} }
// Table of one-character tokens, by character (0x00..0xFF only). // Table of one-character tokens, by character (0x00..0xFF only).
static const constexpr JsonToken one_char_tokens[256] = { static const constexpr JsonToken one_char_json_tokens[256] = {
#define CALL_GET_SCAN_FLAGS(N) GetOneCharToken(N), #define CALL_GET_SCAN_FLAGS(N) GetOneCharJsonToken(N),
INT_0_TO_127_LIST(CALL_GET_SCAN_FLAGS) INT_0_TO_127_LIST(CALL_GET_SCAN_FLAGS)
#undef CALL_GET_SCAN_FLAGS #undef CALL_GET_SCAN_FLAGS
#define CALL_GET_SCAN_FLAGS(N) GetOneCharToken(128 + N), #define CALL_GET_SCAN_FLAGS(N) GetOneCharJsonToken(128 + N),
INT_0_TO_127_LIST(CALL_GET_SCAN_FLAGS) INT_0_TO_127_LIST(CALL_GET_SCAN_FLAGS)
#undef CALL_GET_SCAN_FLAGS #undef CALL_GET_SCAN_FLAGS
}; };
...@@ -97,7 +97,7 @@ using EscapeKindField = BitField8<EscapeKind, 0, 3>; ...@@ -97,7 +97,7 @@ using EscapeKindField = BitField8<EscapeKind, 0, 3>;
using MayTerminateStringField = BitField8<bool, EscapeKindField::kNext, 1>; using MayTerminateStringField = BitField8<bool, EscapeKindField::kNext, 1>;
using NumberPartField = BitField8<bool, MayTerminateStringField::kNext, 1>; using NumberPartField = BitField8<bool, MayTerminateStringField::kNext, 1>;
constexpr bool MayTerminateString(uint8_t flags) { constexpr bool MayTerminateJsonString(uint8_t flags) {
return MayTerminateStringField::decode(flags); return MayTerminateStringField::decode(flags);
} }
...@@ -109,7 +109,7 @@ constexpr bool IsNumberPart(uint8_t flags) { ...@@ -109,7 +109,7 @@ constexpr bool IsNumberPart(uint8_t flags) {
return NumberPartField::decode(flags); return NumberPartField::decode(flags);
} }
constexpr uint8_t GetScanFlags(uint8_t c) { constexpr uint8_t GetJsonScanFlags(uint8_t c) {
// clang-format off // clang-format off
return (c == 'b' ? EscapeKindField::encode(EscapeKind::kBackspace) return (c == 'b' ? EscapeKindField::encode(EscapeKind::kBackspace)
: c == 't' ? EscapeKindField::encode(EscapeKind::kTab) : c == 't' ? EscapeKindField::encode(EscapeKind::kTab)
...@@ -135,11 +135,11 @@ constexpr uint8_t GetScanFlags(uint8_t c) { ...@@ -135,11 +135,11 @@ constexpr uint8_t GetScanFlags(uint8_t c) {
} }
// Table of one-character scan flags, by character (0x00..0xFF only). // Table of one-character scan flags, by character (0x00..0xFF only).
static const constexpr uint8_t character_scan_flags[256] = { static const constexpr uint8_t character_json_scan_flags[256] = {
#define CALL_GET_SCAN_FLAGS(N) GetScanFlags(N), #define CALL_GET_SCAN_FLAGS(N) GetJsonScanFlags(N),
INT_0_TO_127_LIST(CALL_GET_SCAN_FLAGS) INT_0_TO_127_LIST(CALL_GET_SCAN_FLAGS)
#undef CALL_GET_SCAN_FLAGS #undef CALL_GET_SCAN_FLAGS
#define CALL_GET_SCAN_FLAGS(N) GetScanFlags(128 + N), #define CALL_GET_SCAN_FLAGS(N) GetJsonScanFlags(128 + N),
INT_0_TO_127_LIST(CALL_GET_SCAN_FLAGS) INT_0_TO_127_LIST(CALL_GET_SCAN_FLAGS)
#undef CALL_GET_SCAN_FLAGS #undef CALL_GET_SCAN_FLAGS
}; };
...@@ -314,7 +314,7 @@ void JsonParser<Char>::ReportUnexpectedCharacter(uc32 c) { ...@@ -314,7 +314,7 @@ void JsonParser<Char>::ReportUnexpectedCharacter(uc32 c) {
if (c == kEndOfString) { if (c == kEndOfString) {
token = JsonToken::EOS; token = JsonToken::EOS;
} else if (c <= unibrow::Latin1::kMaxChar) { } else if (c <= unibrow::Latin1::kMaxChar) {
token = one_char_tokens[c]; token = one_char_json_tokens[c];
} }
return ReportUnexpectedToken(token); return ReportUnexpectedToken(token);
} }
...@@ -350,7 +350,7 @@ void JsonParser<Char>::SkipWhitespace() { ...@@ -350,7 +350,7 @@ void JsonParser<Char>::SkipWhitespace() {
cursor_ = std::find_if(cursor_, end_, [this](Char c) { cursor_ = std::find_if(cursor_, end_, [this](Char c) {
JsonToken current = V8_LIKELY(c <= unibrow::Latin1::kMaxChar) JsonToken current = V8_LIKELY(c <= unibrow::Latin1::kMaxChar)
? one_char_tokens[c] ? one_char_json_tokens[c]
: JsonToken::ILLEGAL; : JsonToken::ILLEGAL;
bool result = current != JsonToken::WHITESPACE; bool result = current != JsonToken::WHITESPACE;
if (result) next_ = current; if (result) next_ = current;
...@@ -677,7 +677,7 @@ Handle<Object> JsonParser<Char>::ParseJsonNumber(int sign, const Char* start) { ...@@ -677,7 +677,7 @@ Handle<Object> JsonParser<Char>::ParseJsonNumber(int sign, const Char* start) {
// a decimal point or exponent. // a decimal point or exponent.
uc32 c = NextCharacter(); uc32 c = NextCharacter();
if (IsInRange(c, 0, static_cast<int32_t>(unibrow::Latin1::kMaxChar)) && if (IsInRange(c, 0, static_cast<int32_t>(unibrow::Latin1::kMaxChar)) &&
IsNumberPart(character_scan_flags[c])) { IsNumberPart(character_json_scan_flags[c])) {
if (V8_UNLIKELY(IsDecimalDigit(c))) { if (V8_UNLIKELY(IsDecimalDigit(c))) {
AllowHeapAllocation allow_before_exception; AllowHeapAllocation allow_before_exception;
ReportUnexpectedToken(JsonToken::NUMBER); ReportUnexpectedToken(JsonToken::NUMBER);
...@@ -700,7 +700,7 @@ Handle<Object> JsonParser<Char>::ParseJsonNumber(int sign, const Char* start) { ...@@ -700,7 +700,7 @@ Handle<Object> JsonParser<Char>::ParseJsonNumber(int sign, const Char* start) {
const int kMaxSmiLength = 9; const int kMaxSmiLength = 9;
if ((cursor_ - smi_start) <= kMaxSmiLength && if ((cursor_ - smi_start) <= kMaxSmiLength &&
(!IsInRange(c, 0, static_cast<int32_t>(unibrow::Latin1::kMaxChar)) || (!IsInRange(c, 0, static_cast<int32_t>(unibrow::Latin1::kMaxChar)) ||
!IsNumberPart(character_scan_flags[c]))) { !IsNumberPart(character_json_scan_flags[c]))) {
// Smi. // Smi.
int32_t i = 0; int32_t i = 0;
for (; smi_start != cursor_; smi_start++) { for (; smi_start != cursor_; smi_start++) {
...@@ -828,7 +828,7 @@ Handle<String> JsonParser<Char>::ParseJsonString(bool requires_internalization, ...@@ -828,7 +828,7 @@ Handle<String> JsonParser<Char>::ParseJsonString(bool requires_internalization,
while (true) { while (true) {
cursor_ = std::find_if(cursor_, end_, [](Char c) { cursor_ = std::find_if(cursor_, end_, [](Char c) {
return MayTerminateString(character_scan_flags[c]); return MayTerminateJsonString(character_json_scan_flags[c]);
}); });
if (V8_UNLIKELY(is_at_end())) break; if (V8_UNLIKELY(is_at_end())) break;
...@@ -874,7 +874,7 @@ Handle<String> JsonParser<Char>::ParseJsonString(bool requires_internalization, ...@@ -874,7 +874,7 @@ Handle<String> JsonParser<Char>::ParseJsonString(bool requires_internalization,
AddLiteralChar(c); AddLiteralChar(c);
return false; return false;
} }
if (MayTerminateString(character_scan_flags[c])) { if (MayTerminateJsonString(character_json_scan_flags[c])) {
return true; return true;
} }
AddLiteralChar(c); AddLiteralChar(c);
...@@ -910,7 +910,7 @@ Handle<String> JsonParser<Char>::ParseJsonString(bool requires_internalization, ...@@ -910,7 +910,7 @@ Handle<String> JsonParser<Char>::ParseJsonString(bool requires_internalization,
uc32 value; uc32 value;
switch (GetEscapeKind(character_scan_flags[c])) { switch (GetEscapeKind(character_json_scan_flags[c])) {
case EscapeKind::kSelf: case EscapeKind::kSelf:
value = c; value = c;
break; break;
......
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