WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
154927
RegExpPrototype should check for exceptions after calling toString and doing so should not be expensive
https://bugs.webkit.org/show_bug.cgi?id=154927
Summary
RegExpPrototype should check for exceptions after calling toString and doing ...
Filip Pizlo
Reported
2016-03-02 12:12:44 PST
Patch forthcoming.
Attachments
the patch
(4.46 KB, patch)
2016-03-02 12:14 PST
,
Filip Pizlo
saam
: review+
Details
Formatted Diff
Diff
patch for landing
(5.65 KB, patch)
2016-03-02 12:42 PST
,
Filip Pizlo
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from ews100 for mac-yosemite
(1.36 MB, application/zip)
2016-03-02 13:41 PST
,
Build Bot
no flags
Details
Archive of layout-test-results from ews104 for mac-yosemite-wk2
(1.13 MB, application/zip)
2016-03-02 13:41 PST
,
Build Bot
no flags
Details
Archive of layout-test-results from ews116 for mac-yosemite
(1.04 MB, application/zip)
2016-03-02 13:48 PST
,
Build Bot
no flags
Details
the patch
(6.85 KB, patch)
2016-03-02 14:17 PST
,
Filip Pizlo
saam
: review+
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Filip Pizlo
Comment 1
2016-03-02 12:14:53 PST
Created
attachment 272673
[details]
the patch
Saam Barati
Comment 2
2016-03-02 12:16:29 PST
Comment on
attachment 272673
[details]
the patch View in context:
https://bugs.webkit.org/attachment.cgi?id=272673&action=review
> Source/JavaScriptCore/runtime/JSCJSValue.cpp:391 > if (exec->hadException())
this can be "vm.exception()"
> Source/JavaScriptCore/runtime/JSCJSValue.cpp:395 > + if (exec->hadException())
this can be "vm.exception()"
Filip Pizlo
Comment 3
2016-03-02 12:17:07 PST
(In reply to
comment #2
)
> Comment on
attachment 272673
[details]
> the patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=272673&action=review
> > > Source/JavaScriptCore/runtime/JSCJSValue.cpp:391 > > if (exec->hadException()) > > this can be "vm.exception()" > > > Source/JavaScriptCore/runtime/JSCJSValue.cpp:395 > > + if (exec->hadException()) > > this can be "vm.exception()"
Thanks, fixed!
Filip Pizlo
Comment 4
2016-03-02 12:42:36 PST
Created
attachment 272679
[details]
patch for landing
Build Bot
Comment 5
2016-03-02 13:41:00 PST
Comment on
attachment 272679
[details]
patch for landing
Attachment 272679
[details]
did not pass mac-ews (mac): Output:
http://webkit-queues.webkit.org/results/912394
Number of test failures exceeded the failure limit.
Build Bot
Comment 6
2016-03-02 13:41:03 PST
Created
attachment 272682
[details]
Archive of layout-test-results from ews100 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 7
2016-03-02 13:41:32 PST
Comment on
attachment 272679
[details]
patch for landing
Attachment 272679
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.webkit.org/results/912390
Number of test failures exceeded the failure limit.
Build Bot
Comment 8
2016-03-02 13:41:34 PST
Created
attachment 272683
[details]
Archive of layout-test-results from ews104 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 9
2016-03-02 13:48:11 PST
Comment on
attachment 272679
[details]
patch for landing
Attachment 272679
[details]
did not pass mac-debug-ews (mac): Output:
http://webkit-queues.webkit.org/results/912384
Number of test failures exceeded the failure limit.
Build Bot
Comment 10
2016-03-02 13:48:14 PST
Created
attachment 272684
[details]
Archive of layout-test-results from ews116 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-yosemite Platform: Mac OS X 10.10.5
Filip Pizlo
Comment 11
2016-03-02 14:17:08 PST
Created
attachment 272687
[details]
the patch Lets try this again.
Saam Barati
Comment 12
2016-03-02 14:20:28 PST
Comment on
attachment 272687
[details]
the patch View in context:
https://bugs.webkit.org/attachment.cgi?id=272687&action=review
> Source/JavaScriptCore/runtime/RegExpPrototype.cpp:104 > + if (!string) > + return JSValue::encode(jsUndefined());
It might be worth adding a debug assert that an exception was thrown to make the call site contract of toStringFast more explicit
> Source/JavaScriptCore/runtime/RegExpPrototype.cpp:115 > + return JSValue::encode(jsUndefined());
ditto
Filip Pizlo
Comment 13
2016-03-02 14:22:27 PST
(In reply to
comment #12
)
> Comment on
attachment 272687
[details]
> the patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=272687&action=review
> > > Source/JavaScriptCore/runtime/RegExpPrototype.cpp:104 > > + if (!string) > > + return JSValue::encode(jsUndefined()); > > It might be worth adding a debug assert that an exception was thrown to make > the call site contract of toStringFast more explicit > > > Source/JavaScriptCore/runtime/RegExpPrototype.cpp:115 > > + return JSValue::encode(jsUndefined()); > > ditto
I want to call toStringFast() in a lot of places. My next patch will add several more calls. The idea is that null-checking the return is even faster than vm.exception() in this case. So, maybe we can either agree that "toStringFast()" means this, or we can come up with a better name for the function that does convey this meaning? I'm fine with renaming it if the new name is not long. If the alternatives use a word that is longer than "fast" then I think "fast" is least bad.
Geoffrey Garen
Comment 14
2016-03-02 14:32:07 PST
Comment on
attachment 272687
[details]
the patch View in context:
https://bugs.webkit.org/attachment.cgi?id=272687&action=review
> Source/JavaScriptCore/runtime/JSCJSValue.h:256 > + JSString* toStringFast(ExecState*) const; // On exception, this returns null, to make exception checks faster.
I would call this toStringOrNull. It's two letters / one word longer than "fast" but I think it conveys the meaning, and the action required by the caller, much more clearly. So, I think it's worth it. A shorter option, which I like less but still keeps with project naming conventions, is "tryToString".
Filip Pizlo
Comment 15
2016-03-02 14:34:13 PST
(In reply to
comment #14
)
> Comment on
attachment 272687
[details]
> the patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=272687&action=review
> > > Source/JavaScriptCore/runtime/JSCJSValue.h:256 > > + JSString* toStringFast(ExecState*) const; // On exception, this returns null, to make exception checks faster. > > I would call this toStringOrNull. It's two letters / one word longer than > "fast" but I think it conveys the meaning, and the action required by the > caller, much more clearly. So, I think it's worth it.
OK.
> > A shorter option, which I like less but still keeps with project naming > conventions, is "tryToString".
tryToString would not be consistent - that is used in other string code to mean "try to give me the string without doing anything effectful".
Filip Pizlo
Comment 16
2016-03-02 18:06:42 PST
Landed in
http://trac.webkit.org/changeset/197485
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