Changeset 292484 in webkit
- Timestamp:
- Apr 6, 2022 11:48:46 AM (2 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r292481 r292484 1 2022-04-06 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Substring resolving should check 8bit / 16bit again 4 https://bugs.webkit.org/show_bug.cgi?id=236775 5 <rdar://problem/89253391> 6 7 Reviewed by Saam Barati. 8 9 * stress/8bit-16bit-atomize-conversion.js: Added. 10 (main.v64): 11 (main): 12 1 13 2022-04-06 Alexey Shvayka <ashvayka@apple.com> 2 14 -
trunk/Source/JavaScriptCore/ChangeLog
r292477 r292484 1 2022-04-06 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Substring resolving should check 8bit / 16bit again 4 https://bugs.webkit.org/show_bug.cgi?id=236775 5 <rdar://problem/89253391> 6 7 Reviewed by Saam Barati. 8 9 Substring JSString is wrapping JSString. Thus it is possible that underlying JSString's 8Bit / 16Bit status 10 becomes different from substring JSString wrapper's bit. We should not assume they are the same. 11 12 * runtime/JSString.cpp: 13 (JSC::JSRopeString::resolveRopeInternal const): 14 (JSC::JSRopeString::resolveRopeToAtomString const): 15 (JSC::JSRopeString::resolveRopeToExistingAtomString const): 16 (JSC::JSRopeString::resolveRopeInternal8 const): Deleted. 17 (JSC::JSRopeString::resolveRopeInternal16 const): Deleted. 18 * runtime/JSString.h: 19 1 20 2022-04-06 Chris Dumez <cdumez@apple.com> 2 21 -
trunk/Source/JavaScriptCore/runtime/JSString.cpp
r291937 r292484 153 153 static constexpr unsigned maxLengthForOnStackResolve = 2048; 154 154 155 void JSRopeString::resolveRopeInternal8(LChar* buffer) const 155 template<typename CharacterType> 156 void JSRopeString::resolveRopeInternal(CharacterType* buffer) const 156 157 { 157 158 if (isSubstring()) { 158 StringImpl::copyCharacters(buffer, substringBase()->valueInternal().characters8() + substringOffset(), length()); 159 return; 160 } 161 162 resolveRopeInternalNoSubstring(buffer); 163 } 164 165 void JSRopeString::resolveRopeInternal16(UChar* buffer) const 166 { 167 if (isSubstring()) { 168 StringImpl::copyCharacters( 169 buffer, substringBase()->valueInternal().characters16() + substringOffset(), length()); 159 // It is possible that underlying string becomes 8bit/16bit while wrapper substring is saying it is 16bit/8bit. 160 // But It is definitely true that substring part can be represented as its parent's status 8bit/16bit, which is described as CharacterType. 161 auto& string = substringBase()->valueInternal(); 162 if (string.is8Bit()) 163 StringImpl::copyCharacters(buffer, string.characters8() + substringOffset(), length()); 164 else 165 StringImpl::copyCharacters(buffer, string.characters16() + substringOffset(), length()); 170 166 return; 171 167 } … … 211 207 if (is8Bit()) { 212 208 LChar buffer[maxLengthForOnStackResolve]; 213 resolveRopeInternal 8(buffer);209 resolveRopeInternal(buffer); 214 210 convertToNonRope(AtomStringImpl::add(buffer, length())); 215 211 } else { 216 212 UChar buffer[maxLengthForOnStackResolve]; 217 resolveRopeInternal 16(buffer);213 resolveRopeInternal(buffer); 218 214 convertToNonRope(AtomStringImpl::add(buffer, length())); 219 215 } … … 256 252 if (is8Bit()) { 257 253 LChar buffer[maxLengthForOnStackResolve]; 258 resolveRopeInternal 8(buffer);254 resolveRopeInternal(buffer); 259 255 if (RefPtr<AtomStringImpl> existingAtomString = AtomStringImpl::lookUp(buffer, length())) { 260 256 convertToNonRope(*existingAtomString); … … 263 259 } else { 264 260 UChar buffer[maxLengthForOnStackResolve]; 265 resolveRopeInternal 16(buffer);261 resolveRopeInternal(buffer); 266 262 if (RefPtr<AtomStringImpl> existingAtomString = AtomStringImpl::lookUp(buffer, length())) { 267 263 convertToNonRope(*existingAtomString); -
trunk/Source/JavaScriptCore/runtime/JSString.h
r291937 r292484 609 609 Identifier toIdentifier(JSGlobalObject*) const; 610 610 void outOfMemory(JSGlobalObject* nullOrGlobalObjectForOOM) const; 611 void resolveRopeInternal8(LChar*) const; 612 void resolveRopeInternal16(UChar*) const; 611 template<typename CharacterType> void resolveRopeInternal(CharacterType*) const; 613 612 StringView unsafeView(JSGlobalObject*) const; 614 613 StringViewWithUnderlyingString viewWithUnderlyingString(JSGlobalObject*) const;
Note: See TracChangeset
for help on using the changeset viewer.