Changeset 194509 in webkit for trunk/Source/JavaScriptCore/runtime/JSString.h
- Timestamp:
- Jan 3, 2016, 1:48:58 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSString.h
r194496 r194509 48 48 JSString* jsSubstring(VM*, const String&, unsigned offset, unsigned length); 49 49 JSString* jsSubstring(ExecState*, const String&, unsigned offset, unsigned length); 50 JSString* jsSubstring8(VM*, const String&, unsigned offset, unsigned length);51 JSString* jsSubstring8(ExecState*, const String&, unsigned offset, unsigned length);52 50 53 51 // Non-trivial strings are two or more characters long. … … 556 554 } 557 555 558 inline JSString* jsSubstring 8(VM* vm, const String& s, unsigned offset, unsigned length)556 inline JSString* jsSubstring(VM* vm, const String& s, unsigned offset, unsigned length) 559 557 { 560 558 ASSERT(offset <= static_cast<unsigned>(s.length())); … … 568 566 return vm->smallStrings.singleCharacterString(c); 569 567 } 570 return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl8(s.impl(), offset, length));571 }572 573 inline JSString* jsSubstring(VM* vm, const String& s, unsigned offset, unsigned length)574 {575 ASSERT(offset <= static_cast<unsigned>(s.length()));576 ASSERT(length <= static_cast<unsigned>(s.length()));577 ASSERT(offset + length <= static_cast<unsigned>(s.length()));578 if (!length)579 return vm->smallStrings.emptyString();580 if (length == 1) {581 UChar c = s.characterAt(offset);582 if (c <= maxSingleCharacterString)583 return vm->smallStrings.singleCharacterString(c);584 }585 568 return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl(s.impl(), offset, length)); 586 569 } … … 607 590 inline JSString* jsString(ExecState* exec, const String& s) { return jsString(&exec->vm(), s); } 608 591 inline JSString* jsSingleCharacterString(ExecState* exec, UChar c) { return jsSingleCharacterString(&exec->vm(), c); } 609 inline JSString* jsSubstring8(ExecState* exec, const String& s, unsigned offset, unsigned length) { return jsSubstring8(&exec->vm(), s, offset, length); }610 592 inline JSString* jsSubstring(ExecState* exec, const String& s, unsigned offset, unsigned length) { return jsSubstring(&exec->vm(), s, offset, length); } 611 593 inline JSString* jsNontrivialString(ExecState* exec, const String& s) { return jsNontrivialString(&exec->vm(), s); }
Note:
See TracChangeset
for help on using the changeset viewer.