Bug 95633 - Improve JSC use of Strings after the UString->String change
Summary: Improve JSC use of Strings after the UString->String change
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Benjamin Poulain
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-31 21:43 PDT by Benjamin Poulain
Modified: 2012-09-04 14:18 PDT (History)
1 user (show)

See Also:


Attachments
Patch (103.75 KB, patch)
2012-08-31 22:33 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (102.67 KB, patch)
2012-08-31 23:03 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (102.75 KB, patch)
2012-09-02 13:27 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (103.15 KB, patch)
2012-09-02 14:09 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff
Patch (97.10 KB, patch)
2012-09-04 12:31 PDT, Benjamin Poulain
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Poulain 2012-08-31 21:43:16 PDT
Take advantage of the goodness of String.

Some microbenchmark improved: http://jsperf.com/js-error-bench
Comment 1 Benjamin Poulain 2012-08-31 22:33:32 PDT
Created attachment 161815 [details]
Patch
Comment 2 Benjamin Poulain 2012-08-31 23:03:57 PDT
Created attachment 161817 [details]
Patch
Comment 3 Build Bot 2012-08-31 23:21:34 PDT
Comment on attachment 161817 [details]
Patch

Attachment 161817 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/13724456
Comment 4 Geoffrey Garen 2012-09-01 01:23:34 PDT
Comment on attachment 161817 [details]
Patch

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

This patch looks good, but I'm wondering about these null -> empty string changes.

> Source/JavaScriptCore/runtime/Error.h:92
> -            function->finishCreation(exec->globalData(), "");
> +            function->finishCreation(exec->globalData(), String());

Why is this change from empty string to null string OK?

> Source/JavaScriptCore/runtime/FunctionPrototype.h:35
> -            prototype->finishCreation(exec, "");
> +            prototype->finishCreation(exec, String());

Why is this change from empty string to null string OK?

> Source/JavaScriptCore/runtime/InternalFunction.cpp:47
> -    putDirect(globalData, globalData.propertyNames->name, jsString(&globalData, name.isNull() ? "" : name), DontDelete | ReadOnly | DontEnum);
> +    putDirect(globalData, globalData.propertyNames->name, jsString(&globalData, name), DontDelete | ReadOnly | DontEnum);

Why is this change from empty string to null string OK?

> Source/JavaScriptCore/runtime/JSFunction.cpp:99
> -    putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name.isNull() ? "" : name), DontDelete | ReadOnly | DontEnum);
> +    putDirect(exec->globalData(), exec->globalData().propertyNames->name, jsString(exec, name), DontDelete | ReadOnly | DontEnum);

Why is this change from empty string to null string OK?

> Source/JavaScriptCore/runtime/JSGlobalObject.cpp:210
> -    protoAccessor->setGetter(exec->globalData(), JSFunction::create(exec, this, 0, "", globalFuncProtoGetter));
> -    protoAccessor->setSetter(exec->globalData(), JSFunction::create(exec, this, 0, "", globalFuncProtoSetter));
> +    protoAccessor->setGetter(exec->globalData(), JSFunction::create(exec, this, 0, String(), globalFuncProtoGetter));
> +    protoAccessor->setSetter(exec->globalData(), JSFunction::create(exec, this, 0, String(), globalFuncProtoSetter));

Why is this change from empty string to null string OK?

> Source/JavaScriptCore/runtime/JSGlobalObject.cpp:329
> -    JSFunction* thrower = JSFunction::create(exec, this, 0, "", globalFuncThrowTypeError);
> +    JSFunction* thrower = JSFunction::create(exec, this, 0, String(), globalFuncThrowTypeError);

Why is this change from empty string to null string OK?
Comment 5 Benjamin Poulain 2012-09-01 01:29:38 PDT
(In reply to comment #4)
> (From update of attachment 161817 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=161817&action=review
> 
> This patch looks good, but I'm wondering about these null -> empty string changes.

Every case is described in the ChangeLog.

They are in the comments per function, not at the beginning.
Comment 6 Geoffrey Garen 2012-09-01 10:56:20 PDT
Comment on attachment 161817 [details]
Patch

Reading is fundamental! :)

r=me
Comment 7 Benjamin Poulain 2012-09-02 13:27:22 PDT
Created attachment 161847 [details]
Patch
Comment 8 Benjamin Poulain 2012-09-02 14:09:47 PDT
Created attachment 161849 [details]
Patch
Comment 9 Benjamin Poulain 2012-09-02 14:11:22 PDT
GCC 4.2 has a bug with CFSTR and strict-aliasing. I don't really get why it believes there is aliasing there...

Anyway, I added a workaround for EWS, just using the old code. I think every other bot use Clang.
Comment 10 Benjamin Poulain 2012-09-04 12:31:34 PDT
Created attachment 162079 [details]
Patch
Comment 11 Benjamin Poulain 2012-09-04 14:18:57 PDT
Committed r127505: <http://trac.webkit.org/changeset/127505>