@@ -2078,7 +2078,7 @@ template <typename Char>
20782078template <typename StringT>
20792079FastJsonStringifierResult FastJsonStringifier<Char>::SerializeObjectKey(
20802080 Tagged<String> obj, bool comma, const DisallowGarbageCollection& no_gc) {
2081- using StringChar = StringT::Char;
2081+ using StringChar = typename StringT::Char;
20822082 if constexpr (is_one_byte && sizeof (StringChar) == 2 ) {
20832083 return CHANGE_ENCODING;
20842084 } else {
@@ -2104,7 +2104,7 @@ template <typename StringT, bool deferred_key>
21042104FastJsonStringifierResult FastJsonStringifier<Char>::SerializeString(
21052105 Tagged<HeapObject> obj, bool comma, Tagged<String> key,
21062106 const DisallowGarbageCollection& no_gc) {
2107- using StringChar = StringT::Char;
2107+ using StringChar = typename StringT::Char;
21082108 if constexpr (is_one_byte && sizeof (StringChar) == 2 ) {
21092109 return CHANGE_ENCODING;
21102110 } else {
@@ -2283,36 +2283,39 @@ FastJsonStringifierResult FastJsonStringifier<Char>::SerializeJSObject(
22832283 break ;
22842284 case UNDEFINED:
22852285 break ;
2286- case UNCHANGED:
2287- stack_. emplace_back ( ContinuationRecord::kObject , obj,
2288- i. as_uint32 () + 1 );
2286+ case UNCHANGED: {
2287+ ContinuationRecord rec1{ContinuationRecord ::kObject , obj, i. as_uint32 () + 1 };
2288+ stack_. emplace_back ( std::move (rec1) );
22892289 // property can be an object or array. We don't need to distinguish
22902290 // as index is 0 anyways.
2291- stack_.emplace_back (ContinuationRecord::kObject , property, 0 );
2291+ ContinuationRecord rec2{ContinuationRecord::kObject , property, 0 };
2292+ stack_.emplace_back (std::move (rec2));
22922293 result = SerializeObjectKey (key_name, comma, no_gc);
22932294 if constexpr (is_one_byte) {
22942295 if (V8_UNLIKELY (result != SUCCESS)) {
22952296 DCHECK_EQ (result, CHANGE_ENCODING);
2296- stack_. emplace_back ( ContinuationRecord::kObjectKey , key_name,
2297- comma );
2297+ ContinuationRecord rec3{ContinuationRecord ::kObjectKey , key_name, comma};
2298+ stack_. emplace_back ( std::move (rec3) );
22982299 return result;
22992300 }
23002301 }
23012302 return result;
2302- case CHANGE_ENCODING:
2303+ }
2304+ case CHANGE_ENCODING: {
23032305 DCHECK (is_one_byte);
2304- stack_. emplace_back ( ContinuationRecord::kObject , obj,
2305- i. as_uint32 () + 1 );
2306- stack_. emplace_back ( ContinuationRecord::kResumeFromOther , property,
2307- 0 );
2306+ ContinuationRecord rec1{ContinuationRecord ::kObject , obj, i. as_uint32 () + 1 };
2307+ stack_. emplace_back ( std::move (rec1) );
2308+ ContinuationRecord rec2{ContinuationRecord ::kResumeFromOther , property, 0 };
2309+ stack_. emplace_back ( std::move (rec2) );
23082310 result = SerializeObjectKey (key_name, comma, no_gc);
23092311 if (V8_UNLIKELY (result != SUCCESS)) {
2310- stack_. emplace_back ( ContinuationRecord::kObjectKey , key_name,
2311- comma );
2312+ ContinuationRecord rec3{ContinuationRecord ::kObjectKey , key_name, comma};
2313+ stack_. emplace_back ( std::move (rec3) );
23122314 return result;
23132315 }
23142316 DCHECK (IsString (property));
23152317 return result;
2318+ }
23162319 case SLOW_PATH:
23172320 case EXCEPTION:
23182321 return result;
@@ -2455,15 +2458,21 @@ FastJsonStringifierResult FastJsonStringifier<Char>::SerializeFixedArrayElement(
24552458 case UNDEFINED:
24562459 AppendCStringLiteral (" null" );
24572460 return SUCCESS;
2458- case CHANGE_ENCODING:
2461+ case CHANGE_ENCODING: {
24592462 DCHECK (IsString (obj));
2460- stack_.emplace_back (ContinuationRecord::kArray , array, i + 1 );
2461- stack_.emplace_back (ContinuationRecord::kResumeFromOther , obj, 0 );
2463+ ContinuationRecord rec1{ContinuationRecord::kArray , array, i + 1 };
2464+ stack_.emplace_back (std::move (rec1));
2465+ ContinuationRecord rec2{ContinuationRecord::kResumeFromOther , obj, 0 };
2466+ stack_.emplace_back (std::move (rec2));
24622467 return result;
2463- case UNCHANGED:
2464- stack_.emplace_back (ContinuationRecord::kArray , array, i + 1 );
2465- stack_.emplace_back (ContinuationRecord::kResumeFromOther , obj, 0 );
2468+ }
2469+ case UNCHANGED: {
2470+ ContinuationRecord rec1{ContinuationRecord::kArray , array, i + 1 };
2471+ stack_.emplace_back (std::move (rec1));
2472+ ContinuationRecord rec2{ContinuationRecord::kResumeFromOther , obj, 0 };
2473+ stack_.emplace_back (std::move (rec2));
24662474 return result;
2475+ }
24672476 default :
24682477 return result;
24692478 }
@@ -2540,7 +2549,8 @@ FastJsonStringifierResult FastJsonStringifier<Char>::SerializeObject(
25402549 if constexpr (is_one_byte) {
25412550 if (result == CHANGE_ENCODING) {
25422551 DCHECK (IsString (object));
2543- stack_.emplace_back (ContinuationRecord::kResumeFromOther , object, 0 );
2552+ ContinuationRecord rec{ContinuationRecord::kResumeFromOther , object, 0 };
2553+ stack_.emplace_back (std::move (rec));
25442554 return result;
25452555 }
25462556 } else {
0 commit comments