Bug 104206 - [V8] Optimize v8StringOrNull() and v8StringOrUndefined()
Summary: [V8] Optimize v8StringOrNull() and v8StringOrUndefined()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kentaro Hara
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-05 21:17 PST by Kentaro Hara
Modified: 2012-12-05 21:48 PST (History)
3 users (show)

See Also:


Attachments
Patch (2.66 KB, patch)
2012-12-05 21:18 PST, Kentaro Hara
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kentaro Hara 2012-12-05 21:17:27 PST
Currently v8StringOrNull() and v8StringOrUndefined() are checking a null string twice. It is redundant.
Comment 1 Kentaro Hara 2012-12-05 21:18:54 PST
Created attachment 177921 [details]
Patch
Comment 2 Adam Barth 2012-12-05 21:26:26 PST
Comment on attachment 177921 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=177921&action=review

> Source/WebCore/bindings/v8/V8Binding.h:161
> +        if (UNLIKELY(!isolate))
> +            isolate = v8::Isolate::GetCurrent();

Some day we'll make isolate mandatory and remove all these branches.
Comment 3 Kentaro Hara 2012-12-05 21:28:28 PST
(In reply to comment #2)
> (From update of attachment 177921 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=177921&action=review
> 
> > Source/WebCore/bindings/v8/V8Binding.h:161
> > +        if (UNLIKELY(!isolate))
> > +            isolate = v8::Isolate::GetCurrent();
> 
> Some day we'll make isolate mandatory and remove all these branches.

I'm doing it today:)

Actually all call sites of v8StringOrNull() and v8StringOrUndefined() have an isolate. Almost all call sites of v8String() have an isolate. (I'll add v8StringWithCheck(), which has an isolate check, and will use it for call sites that don't have an isolate.)
Comment 4 Kentaro Hara 2012-12-05 21:32:17 PST
Also I've implemented an isolate-version V8 APIs for Local<T>::New() and IsWeak(), which will land this week or next week. It will speed up v8String() and others.
Comment 5 WebKit Review Bot 2012-12-05 21:48:46 PST
Comment on attachment 177921 [details]
Patch

Clearing flags on attachment: 177921

Committed r136797: <http://trac.webkit.org/changeset/136797>
Comment 6 WebKit Review Bot 2012-12-05 21:48:49 PST
All reviewed patches have been landed.  Closing bug.