Bug 175432 - [JSC] Use @putByValDirect instead array.prototyp.@push in builtins
Summary: [JSC] Use @putByValDirect instead array.prototyp.@push in builtins
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-10 11:02 PDT by GSkachkov
Modified: 2017-08-16 00:13 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description GSkachkov 2017-08-10 11:02:54 PDT
We need use @putByValDirect instead array.prototyp.@push. @push is observable because it uses Set operation
Comment 1 GSkachkov 2017-08-14 12:36:46 PDT
It seems that this task will require anther approach, than just replace @push by @putByValDirect. For instance Object.entries, that is implemented in builtins\ObjectConstructor.js, used [Set] operation somewhere in getOwnPropertyNames, tested by following code:
```
Object.defineProperty(Array.prototype, '0', { 
    set : function (x) { throw new Error('Should not be raised:' + x); }
});
```
Possible we need some internal data structure that closed to Array and implement push, slice and access to index item, but did not open its API
Comment 2 Saam Barati 2017-08-14 15:56:56 PDT
It seems like we should only replace this when the spec doesn't call Set(...), e.g, when we're using the Array for internal bookkeeping. If the spec exposes that we call Set(...), then we can keep using @push or push depending on what the spec says for property access of "push"
Comment 3 GSkachkov 2017-08-16 00:13:45 PDT
(In reply to Saam Barati from comment #2)
> It seems like we should only replace this when the spec doesn't call
> Set(...), e.g, when we're using the Array for internal bookkeeping. If the
> spec exposes that we call Set(...), then we can keep using @push or push
> depending on what the spec says for property access of "push"

Ok. I see, I'll check spec where @push is used.