Bug 159542

Summary: We may add a ReadOnly property without setting the corresponding bit on Structure
Product: WebKit Reporter: Saam Barati <saam>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, commit-queue, fpizlo, ggaren, gskachkov, keith_miller, mark.lam, msaboff, oliver, sukolsak, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch none

Description Saam Barati 2016-07-07 20:11:43 PDT
...
Comment 1 Saam Barati 2016-07-07 20:13:06 PDT
<rdar://problem/27084591>
Comment 2 Saam Barati 2016-07-08 17:21:07 PDT
Created attachment 283228 [details]
patch
Comment 3 Saam Barati 2016-07-08 17:22:08 PDT
Comment on attachment 283228 [details]
patch

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

> Source/JavaScriptCore/runtime/JSObject.h:1569
> +    if (attributes & ReadOnly)
> +        structure->setContainsReadOnlyProperties();

I put this here to be consistent with JSObject::putDirectInternal,
but I almost feel like putting it inside Structure::addPropertyWithoutTransition
is a more natural place for it.
Comment 4 Benjamin Poulain 2016-07-08 17:29:21 PDT
Comment on attachment 283228 [details]
patch

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

>> Source/JavaScriptCore/runtime/JSObject.h:1569
>> +        structure->setContainsReadOnlyProperties();
> 
> I put this here to be consistent with JSObject::putDirectInternal,
> but I almost feel like putting it inside Structure::addPropertyWithoutTransition
> is a more natural place for it.

I think that makes sense in addPropertyWithoutTransition() for both call sites. What's wrong with that?
Comment 5 Saam Barati 2016-07-08 17:33:50 PDT
Comment on attachment 283228 [details]
patch

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

>>> Source/JavaScriptCore/runtime/JSObject.h:1569
>>> +        structure->setContainsReadOnlyProperties();
>> 
>> I put this here to be consistent with JSObject::putDirectInternal,
>> but I almost feel like putting it inside Structure::addPropertyWithoutTransition
>> is a more natural place for it.
> 
> I think that makes sense in addPropertyWithoutTransition() for both call sites. What's wrong with that?

I agree. I'm going to open another bug to consider this. I think we should also consider the Structure::addNewPropertyTransition to have it mark the bit on the new transition it's returning.
Comment 6 Saam Barati 2016-07-08 18:09:59 PDT
I opened:
https://bugs.webkit.org/show_bug.cgi?id=159593
Comment 7 WebKit Commit Bot 2016-07-08 18:30:35 PDT
Comment on attachment 283228 [details]
patch

Clearing flags on attachment: 283228

Committed r203015: <http://trac.webkit.org/changeset/203015>
Comment 8 WebKit Commit Bot 2016-07-08 18:30:40 PDT
All reviewed patches have been landed.  Closing bug.