Bug 76232 - Clean up putDirect
Summary: Clean up putDirect
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gavin Barraclough
Depends on:
Reported: 2012-01-12 17:17 PST by Gavin Barraclough
Modified: 2012-01-30 10:29 PST (History)
0 users

See Also:

Part 1 (14.08 KB, patch)
2012-01-12 17:19 PST, Gavin Barraclough
sam: review+
Details | Formatted Diff | Diff
Part 2 (34.19 KB, patch)
2012-01-12 19:23 PST, Gavin Barraclough
sam: review+
Details | Formatted Diff | Diff
Part 3 - merge op_put_getter & op_put_setter. (29.09 KB, patch)
2012-01-30 01:07 PST, Gavin Barraclough
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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