WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
145427
jsSubstring() should support creating substrings from substrings.
https://bugs.webkit.org/show_bug.cgi?id=145427
Summary
jsSubstring() should support creating substrings from substrings.
Andreas Kling
Reported
2015-05-27 21:13:33 PDT
It would be neat if jsSubstring() would be smarter when asked to create a substring of a JSString that is itself a substring. It should share the base string and just modify the offset instead.
Attachments
Patch
(2.81 KB, patch)
2015-05-27 21:30 PDT
,
Andreas Kling
darin
: review+
Details
Formatted Diff
Diff
Patch
(4.49 KB, patch)
2015-06-09 21:46 PDT
,
Andreas Kling
ggaren
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Andreas Kling
Comment 1
2015-05-27 21:30:27 PDT
Created
attachment 253831
[details]
Patch
Geoffrey Garen
Comment 2
2015-05-28 10:18:05 PDT
Comment on
attachment 253831
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=253831&action=review
Yo dawg.
> Source/JavaScriptCore/runtime/JSString.h:532 > + if (s->isRope() && !static_cast<JSRopeString*>(s)->isSubstring()) > + static_cast<JSRopeString*>(s)->resolveRope(exec);
Can we move this branch into the callee? It feels unsafe that the callee assumes it will not be passed a non-substring rope, when nothing in its type signature guarantees it.
Darin Adler
Comment 3
2015-05-28 13:04:19 PDT
Comment on
attachment 253831
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=253831&action=review
> Source/JavaScriptCore/runtime/JSString.h:304 > + JSRopeString* baseRope = static_cast<JSRopeString*>(base);
I suggest we use a reference rather than pointer here.
>> Source/JavaScriptCore/runtime/JSString.h:532 >> + static_cast<JSRopeString*>(s)->resolveRope(exec); > > Can we move this branch into the callee? > > It feels unsafe that the callee assumes it will not be passed a non-substring rope, when nothing in its type signature guarantees it.
I agree that would be better.
Andreas Kling
Comment 4
2015-06-09 21:46:22 PDT
Created
attachment 254629
[details]
Patch Take 2, rope resolution moved to callee as requested by reviewers.
Geoffrey Garen
Comment 5
2015-06-10 14:24:53 PDT
Comment on
attachment 254629
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=254629&action=review
r=me
> Source/JavaScriptCore/runtime/JSString.h:314 > + // For now, let's not allow substrings with a rope base. > + // Resolve non-substring rope bases so we don't have to deal with it.
Might be nice to elaborate on what we're trying to avoid.
> Source/JavaScriptCore/runtime/JSString.h:315 > + if (base.isRope() && !base.isSubstring())
Is it possible for our base to be a substring? I think it is not, since all substrings will do the base forwarding above upon creation.
Andreas Kling
Comment 6
2015-06-23 18:18:48 PDT
Landed in
r185486
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug