Bug 76232

Summary: Clean up putDirect
Product: WebKit Reporter: Gavin Barraclough <barraclough>
Component: JavaScriptCoreAssignee: Gavin Barraclough <barraclough>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Part 1
sam: review+
Part 2
sam: review+
Part 3 - merge op_put_getter & op_put_setter. sam: review+

Description Gavin Barraclough 2012-01-12 17:17:22 PST
putDirect has ambiguous semantics, clean these up a bit.

putDirect generally behaves a bit like a fast defineOwnProperty, but one that always creates the property, with no checking to validate the put it permitted.

It also encompasses two slightly different behaviors.
(1) a fast form of put for JSActivation, which doesn't have to handle searching the prototype chain, getter/setter properties, or the magic __proto__ value.  Break this out as a new method, 'putOwnDataProperty'.
(2) the version of putDirect on JSValue will also check for overwriting ReadOnly values, in strict mode.  This is, however, not so smart on a few level, since it is only called from op_put_by_id with direct set, which is only used with an object as the base, and is only used to put new properties onto objects.
Comment 1 Gavin Barraclough 2012-01-12 17:19:58 PST
Created attachment 122344 [details]
Part 1
Comment 2 Gavin Barraclough 2012-01-12 17:41:47 PST
Landed pt 1 in r104886.
Comment 3 Gavin Barraclough 2012-01-12 19:23:23 PST
Created attachment 122360 [details]
Part 2
Comment 4 Sam Weinig 2012-01-12 19:30:24 PST
Comment on attachment 122360 [details]
Part 2

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

> Source/JavaScriptCore/runtime/JSObject.h:81
> +            PutModePut,
> +            DefineOwnProperty,

I refuse the inconsistency. DefineOwnProperty should be, PutModeDefineOwnProperty!
Comment 5 Gavin Barraclough 2012-01-12 22:46:11 PST
Part 2 landed in r104899
Comment 6 Gavin Barraclough 2012-01-30 01:07:26 PST
Created attachment 124505 [details]
Part 3 - merge op_put_getter & op_put_setter.
Comment 7 Gavin Barraclough 2012-01-30 10:29:12 PST
Fixed in r106255