@@ -2099,7 +2099,7 @@ template <typename Char>
20992099template <typename StringT>
21002100FastJsonStringifierResult FastJsonStringifier<Char>::SerializeObjectKey(
21012101 Tagged<String> obj, bool comma, const DisallowGarbageCollection& no_gc) {
2102- using StringChar = StringT::Char;
2102+ using StringChar = typename StringT::Char;
21032103 if constexpr (is_one_byte && sizeof (StringChar) == 2 ) {
21042104 return CHANGE_ENCODING;
21052105 } else {
@@ -2125,7 +2125,7 @@ template <typename StringT, bool deferred_key>
21252125FastJsonStringifierResult FastJsonStringifier<Char>::SerializeString(
21262126 Tagged<HeapObject> obj, bool comma, Tagged<String> key,
21272127 const DisallowGarbageCollection& no_gc) {
2128- using StringChar = StringT::Char;
2128+ using StringChar = typename StringT::Char;
21292129 if constexpr (is_one_byte && sizeof (StringChar) == 2 ) {
21302130 return CHANGE_ENCODING;
21312131 } else {
@@ -2304,36 +2304,39 @@ FastJsonStringifierResult FastJsonStringifier<Char>::SerializeJSObject(
23042304 break ;
23052305 case UNDEFINED:
23062306 break ;
2307- case UNCHANGED:
2308- stack_. emplace_back ( ContinuationRecord::kObject , obj,
2309- i. as_uint32 () + 1 );
2307+ case UNCHANGED: {
2308+ ContinuationRecord rec1{ContinuationRecord ::kObject , obj, i. as_uint32 () + 1 };
2309+ stack_. emplace_back ( std::move (rec1) );
23102310 // property can be an object or array. We don't need to distinguish
23112311 // as index is 0 anyways.
2312- stack_.emplace_back (ContinuationRecord::kObject , property, 0 );
2312+ ContinuationRecord rec2{ContinuationRecord::kObject , property, 0 };
2313+ stack_.emplace_back (std::move (rec2));
23132314 result = SerializeObjectKey (key_name, comma, no_gc);
23142315 if constexpr (is_one_byte) {
23152316 if (V8_UNLIKELY (result != SUCCESS)) {
23162317 DCHECK_EQ (result, CHANGE_ENCODING);
2317- stack_. emplace_back ( ContinuationRecord::kObjectKey , key_name,
2318- comma );
2318+ ContinuationRecord rec3{ContinuationRecord ::kObjectKey , key_name, comma};
2319+ stack_. emplace_back ( std::move (rec3) );
23192320 return result;
23202321 }
23212322 }
23222323 return result;
2323- case CHANGE_ENCODING:
2324+ }
2325+ case CHANGE_ENCODING: {
23242326 DCHECK (is_one_byte);
2325- stack_. emplace_back ( ContinuationRecord::kObject , obj,
2326- i. as_uint32 () + 1 );
2327- stack_. emplace_back ( ContinuationRecord::kResumeFromOther , property,
2328- 0 );
2327+ ContinuationRecord rec1{ContinuationRecord ::kObject , obj, i. as_uint32 () + 1 };
2328+ stack_. emplace_back ( std::move (rec1) );
2329+ ContinuationRecord rec2{ContinuationRecord ::kResumeFromOther , property, 0 };
2330+ stack_. emplace_back ( std::move (rec2) );
23292331 result = SerializeObjectKey (key_name, comma, no_gc);
23302332 if (V8_UNLIKELY (result != SUCCESS)) {
2331- stack_. emplace_back ( ContinuationRecord::kObjectKey , key_name,
2332- comma );
2333+ ContinuationRecord rec3{ContinuationRecord ::kObjectKey , key_name, comma};
2334+ stack_. emplace_back ( std::move (rec3) );
23332335 return result;
23342336 }
23352337 DCHECK (IsString (property));
23362338 return result;
2339+ }
23372340 case SLOW_PATH:
23382341 case EXCEPTION:
23392342 return result;
@@ -2476,15 +2479,21 @@ FastJsonStringifierResult FastJsonStringifier<Char>::SerializeFixedArrayElement(
24762479 case UNDEFINED:
24772480 AppendCStringLiteral (" null" );
24782481 return SUCCESS;
2479- case CHANGE_ENCODING:
2482+ case CHANGE_ENCODING: {
24802483 DCHECK (IsString (obj));
2481- stack_.emplace_back (ContinuationRecord::kArray , array, i + 1 );
2482- stack_.emplace_back (ContinuationRecord::kResumeFromOther , obj, 0 );
2484+ ContinuationRecord rec1{ContinuationRecord::kArray , array, i + 1 };
2485+ stack_.emplace_back (std::move (rec1));
2486+ ContinuationRecord rec2{ContinuationRecord::kResumeFromOther , obj, 0 };
2487+ stack_.emplace_back (std::move (rec2));
24832488 return result;
2484- case UNCHANGED:
2485- stack_.emplace_back (ContinuationRecord::kArray , array, i + 1 );
2486- stack_.emplace_back (ContinuationRecord::kResumeFromOther , obj, 0 );
2489+ }
2490+ case UNCHANGED: {
2491+ ContinuationRecord rec1{ContinuationRecord::kArray , array, i + 1 };
2492+ stack_.emplace_back (std::move (rec1));
2493+ ContinuationRecord rec2{ContinuationRecord::kResumeFromOther , obj, 0 };
2494+ stack_.emplace_back (std::move (rec2));
24872495 return result;
2496+ }
24882497 default :
24892498 return result;
24902499 }
@@ -2561,7 +2570,8 @@ FastJsonStringifierResult FastJsonStringifier<Char>::SerializeObject(
25612570 if constexpr (is_one_byte) {
25622571 if (result == CHANGE_ENCODING) {
25632572 DCHECK (IsString (object));
2564- stack_.emplace_back (ContinuationRecord::kResumeFromOther , object, 0 );
2573+ ContinuationRecord rec{ContinuationRecord::kResumeFromOther , object, 0 };
2574+ stack_.emplace_back (std::move (rec));
25652575 return result;
25662576 }
25672577 } else {
0 commit comments