Bug 80654 - Allocate the RegExpObject's data with the Cell
Summary: Allocate the RegExpObject's data with the Cell
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-03-08 16:26 PST by Benjamin Poulain
Modified: 2012-03-08 22:50 PST (History)
2 users (show)

See Also:


Attachments
Patch (9.83 KB, patch)
2012-03-08 16:34 PST, Benjamin Poulain
barraclough: review+
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-03-08 16:26:17 PST
Currently, RegExpObject's data is allocated with new() in the constructor.

This is a problem in peacekeeper. In that case, the tests repeatedly create very small and simple regexp, and use them only one. Currently, the allocation and destruction of RegExpObjectData take more time than the math() itself.
Comment 1 Benjamin Poulain 2012-03-08 16:34:53 PST
Created attachment 130938 [details]
Patch
Comment 2 Benjamin Poulain 2012-03-08 16:37:56 PST
I also tried Sunspider but there is no change.

While trying this, I also noticed JSNonFinalObject has some spare memory:
   WriteBarrierBase<Unknown> m_inlineStorage[JSFinalObject_inlineStorageCapacity];
Since I am not familiar with that, I did not abuse it to store anything from RegExp. I don't know if anything could be done there?
Comment 3 Gavin Barraclough 2012-03-08 17:14:06 PST
(In reply to comment #2)
> I also tried Sunspider but there is no change.
> 
> While trying this, I also noticed JSNonFinalObject has some spare memory:
>    WriteBarrierBase<Unknown> m_inlineStorage[JSFinalObject_inlineStorageCapacity];
> Since I am not familiar with that, I did not abuse it to store anything from RegExp. I don't know if anything could be done there?

We used to have a concept of 'anonymous slots', to allocate storage within the object's property storage, but I think that has been removed.  ES6 will require support for 'private names', we may be able to use these to store internal values (e.g. the regexp) – once we have a mechanism to support this implemented!  Right now, no obvious clean way to use the internal property storage springs to mind.
Comment 4 Benjamin Poulain 2012-03-08 22:50:51 PST
Committed r110266: <http://trac.webkit.org/changeset/110266>