@@ -2098,7 +2098,7 @@ template <typename Char>
20982098template <typename StringT>
20992099FastJsonStringifierResult FastJsonStringifier<Char>::SerializeObjectKey(
21002100 Tagged<String> obj, bool comma, 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 {
@@ -2124,7 +2124,7 @@ template <typename StringT, bool deferred_key>
21242124FastJsonStringifierResult FastJsonStringifier<Char>::SerializeString(
21252125 Tagged<HeapObject> obj, bool comma, Tagged<String> key,
21262126 const DisallowGarbageCollection& no_gc) {
2127- using StringChar = StringT::Char;
2127+ using StringChar = typename StringT::Char;
21282128 if constexpr (is_one_byte && sizeof (StringChar) == 2 ) {
21292129 return CHANGE_ENCODING;
21302130 } else {
@@ -2303,36 +2303,39 @@ FastJsonStringifierResult FastJsonStringifier<Char>::SerializeJSObject(
23032303 break ;
23042304 case UNDEFINED:
23052305 break ;
2306- case UNCHANGED:
2307- stack_. emplace_back ( ContinuationRecord::kObject , obj,
2308- i. as_uint32 () + 1 );
2306+ case UNCHANGED: {
2307+ ContinuationRecord rec1{ContinuationRecord ::kObject , obj, i. as_uint32 () + 1 };
2308+ stack_. emplace_back ( std::move (rec1) );
23092309 // property can be an object or array. We don't need to distinguish
23102310 // as index is 0 anyways.
2311- stack_.emplace_back (ContinuationRecord::kObject , property, 0 );
2311+ ContinuationRecord rec2{ContinuationRecord::kObject , property, 0 };
2312+ stack_.emplace_back (std::move (rec2));
23122313 result = SerializeObjectKey (key_name, comma, no_gc);
23132314 if constexpr (is_one_byte) {
23142315 if (V8_UNLIKELY (result != SUCCESS)) {
23152316 DCHECK_EQ (result, CHANGE_ENCODING);
2316- stack_. emplace_back ( ContinuationRecord::kObjectKey , key_name,
2317- comma );
2317+ ContinuationRecord rec3{ContinuationRecord ::kObjectKey , key_name, comma};
2318+ stack_. emplace_back ( std::move (rec3) );
23182319 return result;
23192320 }
23202321 }
23212322 return result;
2322- case CHANGE_ENCODING:
2323+ }
2324+ case CHANGE_ENCODING: {
23232325 DCHECK (is_one_byte);
2324- stack_. emplace_back ( ContinuationRecord::kObject , obj,
2325- i. as_uint32 () + 1 );
2326- stack_. emplace_back ( ContinuationRecord::kResumeFromOther , property,
2327- 0 );
2326+ ContinuationRecord rec1{ContinuationRecord ::kObject , obj, i. as_uint32 () + 1 };
2327+ stack_. emplace_back ( std::move (rec1) );
2328+ ContinuationRecord rec2{ContinuationRecord ::kResumeFromOther , property, 0 };
2329+ stack_. emplace_back ( std::move (rec2) );
23282330 result = SerializeObjectKey (key_name, comma, no_gc);
23292331 if (V8_UNLIKELY (result != SUCCESS)) {
2330- stack_. emplace_back ( ContinuationRecord::kObjectKey , key_name,
2331- comma );
2332+ ContinuationRecord rec3{ContinuationRecord ::kObjectKey , key_name, comma};
2333+ stack_. emplace_back ( std::move (rec3) );
23322334 return result;
23332335 }
23342336 DCHECK (IsString (property));
23352337 return result;
2338+ }
23362339 case SLOW_PATH:
23372340 case EXCEPTION:
23382341 return result;
@@ -2475,15 +2478,21 @@ FastJsonStringifierResult FastJsonStringifier<Char>::SerializeFixedArrayElement(
24752478 case UNDEFINED:
24762479 AppendCStringLiteral (" null" );
24772480 return SUCCESS;
2478- case CHANGE_ENCODING:
2481+ case CHANGE_ENCODING: {
24792482 DCHECK (IsString (obj));
2480- stack_.emplace_back (ContinuationRecord::kArray , array, i + 1 );
2481- stack_.emplace_back (ContinuationRecord::kResumeFromOther , obj, 0 );
2483+ ContinuationRecord rec1{ContinuationRecord::kArray , array, i + 1 };
2484+ stack_.emplace_back (std::move (rec1));
2485+ ContinuationRecord rec2{ContinuationRecord::kResumeFromOther , obj, 0 };
2486+ stack_.emplace_back (std::move (rec2));
24822487 return result;
2483- case UNCHANGED:
2484- stack_.emplace_back (ContinuationRecord::kArray , array, i + 1 );
2485- stack_.emplace_back (ContinuationRecord::kResumeFromOther , obj, 0 );
2488+ }
2489+ case UNCHANGED: {
2490+ ContinuationRecord rec1{ContinuationRecord::kArray , array, i + 1 };
2491+ stack_.emplace_back (std::move (rec1));
2492+ ContinuationRecord rec2{ContinuationRecord::kResumeFromOther , obj, 0 };
2493+ stack_.emplace_back (std::move (rec2));
24862494 return result;
2495+ }
24872496 default :
24882497 return result;
24892498 }
@@ -2560,7 +2569,8 @@ FastJsonStringifierResult FastJsonStringifier<Char>::SerializeObject(
25602569 if constexpr (is_one_byte) {
25612570 if (result == CHANGE_ENCODING) {
25622571 DCHECK (IsString (object));
2563- stack_.emplace_back (ContinuationRecord::kResumeFromOther , object, 0 );
2572+ ContinuationRecord rec{ContinuationRecord::kResumeFromOther , object, 0 };
2573+ stack_.emplace_back (std::move (rec));
25642574 return result;
25652575 }
25662576 } else {
0 commit comments