Changeset 216699 in webkit for trunk/Source/JavaScriptCore/runtime/JSString.h
- Timestamp:
- May 11, 2017, 4:05:01 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSString.h
r212365 r216699 29 29 #include "PropertySlot.h" 30 30 #include "Structure.h" 31 #include "ThrowScope.h" 31 32 #include <array> 32 33 #include <wtf/text/StringView.h> … … 157 158 RefPtr<AtomicStringImpl> toExistingAtomicString(ExecState*) const; 158 159 159 StringViewWithUnderlyingString viewWithUnderlyingString(ExecState &) const;160 StringViewWithUnderlyingString viewWithUnderlyingString(ExecState*) const; 160 161 161 162 inline bool equal(ExecState*, JSString* other) const; … … 235 236 236 237 String& string() { ASSERT(!isRope()); return m_value; } 237 StringView unsafeView(ExecState &) const;238 StringView unsafeView(ExecState*) const; 238 239 239 240 friend JSString* jsString(ExecState*, JSString*, JSString*); … … 431 432 void resolveRopeInternal16NoSubstring(UChar*) const; 432 433 void clearFibers() const; 433 StringView unsafeView(ExecState &) const;434 StringViewWithUnderlyingString viewWithUnderlyingString(ExecState &) const;434 StringView unsafeView(ExecState*) const; 435 StringViewWithUnderlyingString viewWithUnderlyingString(ExecState*) const; 435 436 436 437 WriteBarrierBase<JSString>& fiber(unsigned i) const … … 557 558 inline JSString* JSString::getIndex(ExecState* exec, unsigned i) 558 559 { 560 VM& vm = exec->vm(); 561 auto scope = DECLARE_THROW_SCOPE(vm); 559 562 ASSERT(canGetIndex(i)); 560 return jsSingleCharacterString(exec, unsafeView(*exec)[i]); 563 StringView view = unsafeView(exec); 564 RETURN_IF_EXCEPTION(scope, nullptr); 565 return jsSingleCharacterString(exec, view[i]); 561 566 } 562 567 … … 706 711 } 707 712 708 ALWAYS_INLINE StringView JSRopeString::unsafeView(ExecState & state) const713 ALWAYS_INLINE StringView JSRopeString::unsafeView(ExecState* exec) const 709 714 { 710 715 if (isSubstring()) { … … 713 718 return StringView(substringBase()->m_value.characters16() + substringOffset(), length()); 714 719 } 715 resolveRope( &state);720 resolveRope(exec); 716 721 return m_value; 717 722 } 718 723 719 ALWAYS_INLINE StringViewWithUnderlyingString JSRopeString::viewWithUnderlyingString(ExecState & state) const724 ALWAYS_INLINE StringViewWithUnderlyingString JSRopeString::viewWithUnderlyingString(ExecState* exec) const 720 725 { 721 726 if (isSubstring()) { … … 725 730 return { { base.characters16() + substringOffset(), length() }, base }; 726 731 } 727 resolveRope( &state);732 resolveRope(exec); 728 733 return { m_value, m_value }; 729 734 } 730 735 731 ALWAYS_INLINE StringView JSString::unsafeView(ExecState & state) const736 ALWAYS_INLINE StringView JSString::unsafeView(ExecState* exec) const 732 737 { 733 738 if (isRope()) 734 return static_cast<const JSRopeString*>(this)->unsafeView( state);739 return static_cast<const JSRopeString*>(this)->unsafeView(exec); 735 740 return m_value; 736 741 } 737 742 738 ALWAYS_INLINE StringViewWithUnderlyingString JSString::viewWithUnderlyingString(ExecState & state) const743 ALWAYS_INLINE StringViewWithUnderlyingString JSString::viewWithUnderlyingString(ExecState* exec) const 739 744 { 740 745 if (isRope()) 741 return static_cast<const JSRopeString&>(*this).viewWithUnderlyingString( state);746 return static_cast<const JSRopeString&>(*this).viewWithUnderlyingString(exec); 742 747 return { m_value, m_value }; 743 748 }
Note:
See TracChangeset
for help on using the changeset viewer.