@@ -2072,7 +2072,7 @@ template <typename Char>
20722072template <typename StringT>
20732073FastJsonStringifierResult FastJsonStringifier<Char>::SerializeObjectKey(
20742074 Tagged<String> obj, bool comma, const DisallowGarbageCollection& no_gc) {
2075- using StringChar = StringT::Char;
2075+ using StringChar = typename StringT::Char;
20762076 if constexpr (is_one_byte && sizeof (StringChar) == 2 ) {
20772077 return CHANGE_ENCODING;
20782078 } else {
@@ -2098,7 +2098,7 @@ template <typename StringT, bool deferred_key>
20982098FastJsonStringifierResult FastJsonStringifier<Char>::SerializeString(
20992099 Tagged<HeapObject> obj, bool comma, Tagged<String> key,
21002100 const DisallowGarbageCollection& no_gc) {
2101- using StringChar = StringT::Char;
2101+ using StringChar = typename StringT::Char;
21022102 if constexpr (is_one_byte && sizeof (StringChar) == 2 ) {
21032103 return CHANGE_ENCODING;
21042104 } else {
@@ -2277,36 +2277,39 @@ FastJsonStringifierResult FastJsonStringifier<Char>::SerializeJSObject(
22772277 break ;
22782278 case UNDEFINED:
22792279 break ;
2280- case UNCHANGED:
2281- stack_. emplace_back ( ContinuationRecord::kObject , obj,
2282- i. as_uint32 () + 1 );
2280+ case UNCHANGED: {
2281+ ContinuationRecord rec1{ContinuationRecord ::kObject , obj, i. as_uint32 () + 1 };
2282+ stack_. emplace_back ( std::move (rec1) );
22832283 // property can be an object or array. We don't need to distinguish
22842284 // as index is 0 anyways.
2285- stack_.emplace_back (ContinuationRecord::kObject , property, 0 );
2285+ ContinuationRecord rec2{ContinuationRecord::kObject , property, 0 };
2286+ stack_.emplace_back (std::move (rec2));
22862287 result = SerializeObjectKey (key_name, comma, no_gc);
22872288 if constexpr (is_one_byte) {
22882289 if (V8_UNLIKELY (result != SUCCESS)) {
22892290 DCHECK_EQ (result, CHANGE_ENCODING);
2290- stack_. emplace_back ( ContinuationRecord::kObjectKey , key_name,
2291- comma );
2291+ ContinuationRecord rec3{ContinuationRecord ::kObjectKey , key_name, comma};
2292+ stack_. emplace_back ( std::move (rec3) );
22922293 return result;
22932294 }
22942295 }
22952296 return result;
2296- case CHANGE_ENCODING:
2297+ }
2298+ case CHANGE_ENCODING: {
22972299 DCHECK (is_one_byte);
2298- stack_. emplace_back ( ContinuationRecord::kObject , obj,
2299- i. as_uint32 () + 1 );
2300- stack_. emplace_back ( ContinuationRecord::kResumeFromOther , property,
2301- 0 );
2300+ ContinuationRecord rec1{ContinuationRecord ::kObject , obj, i. as_uint32 () + 1 };
2301+ stack_. emplace_back ( std::move (rec1) );
2302+ ContinuationRecord rec2{ContinuationRecord ::kResumeFromOther , property, 0 };
2303+ stack_. emplace_back ( std::move (rec2) );
23022304 result = SerializeObjectKey (key_name, comma, no_gc);
23032305 if (V8_UNLIKELY (result != SUCCESS)) {
2304- stack_. emplace_back ( ContinuationRecord::kObjectKey , key_name,
2305- comma );
2306+ ContinuationRecord rec3{ContinuationRecord ::kObjectKey , key_name, comma};
2307+ stack_. emplace_back ( std::move (rec3) );
23062308 return result;
23072309 }
23082310 DCHECK (IsString (property));
23092311 return result;
2312+ }
23102313 case SLOW_PATH:
23112314 case EXCEPTION:
23122315 return result;
@@ -2449,15 +2452,21 @@ FastJsonStringifierResult FastJsonStringifier<Char>::SerializeFixedArrayElement(
24492452 case UNDEFINED:
24502453 AppendCStringLiteral (" null" );
24512454 return SUCCESS;
2452- case CHANGE_ENCODING:
2455+ case CHANGE_ENCODING: {
24532456 DCHECK (IsString (obj));
2454- stack_.emplace_back (ContinuationRecord::kArray , array, i + 1 );
2455- stack_.emplace_back (ContinuationRecord::kResumeFromOther , obj, 0 );
2457+ ContinuationRecord rec1{ContinuationRecord::kArray , array, i + 1 };
2458+ stack_.emplace_back (std::move (rec1));
2459+ ContinuationRecord rec2{ContinuationRecord::kResumeFromOther , obj, 0 };
2460+ stack_.emplace_back (std::move (rec2));
24562461 return result;
2457- case UNCHANGED:
2458- stack_.emplace_back (ContinuationRecord::kArray , array, i + 1 );
2459- stack_.emplace_back (ContinuationRecord::kResumeFromOther , obj, 0 );
2462+ }
2463+ case UNCHANGED: {
2464+ ContinuationRecord rec1{ContinuationRecord::kArray , array, i + 1 };
2465+ stack_.emplace_back (std::move (rec1));
2466+ ContinuationRecord rec2{ContinuationRecord::kResumeFromOther , obj, 0 };
2467+ stack_.emplace_back (std::move (rec2));
24602468 return result;
2469+ }
24612470 default :
24622471 return result;
24632472 }
@@ -2534,7 +2543,8 @@ FastJsonStringifierResult FastJsonStringifier<Char>::SerializeObject(
25342543 if constexpr (is_one_byte) {
25352544 if (result == CHANGE_ENCODING) {
25362545 DCHECK (IsString (object));
2537- stack_.emplace_back (ContinuationRecord::kResumeFromOther , object, 0 );
2546+ ContinuationRecord rec{ContinuationRecord::kResumeFromOther , object, 0 };
2547+ stack_.emplace_back (std::move (rec));
25382548 return result;
25392549 }
25402550 } else {
0 commit comments