12020-09-06 Alexey Shvayka <shvaikalesh@gmail.com>
2
3 Proxy's "ownKeys" trap result should not be sorted
4 https://bugs.webkit.org/show_bug.cgi?id=216227
5
6 Reviewed by NOBODY (OOPS!).
7
8 Given that we can't know whether ownPropertyKeys() received property names from
9 userland Proxy's "ownKeys" trap, this patch moves symbols after strings sorting [1]
10 to Structure::getPropertyNamesFromStructure(), aligning observed property order
11 (via Proxy's "getOwnPropertyDescriptor" trap) with V8 and SpiderMonkey.
12
13 Also, removes sorting logic duplication in objectConstructorAssign().
14
15 This change is neutral-ish on uncached Object.getOwnPropertySymbols() and
16 Reflect.ownKeys() microbenchmarks and doesn't affect property name collection
17 besides PropertyNameMode::StringsAndSymbols cases.
18
19 [1]: https://tc39.es/ecma262/#sec-ordinaryownpropertykeys (steps 3-4)
20
21 * runtime/ObjectConstructor.cpp:
22 (JSC::objectConstructorAssign):
23 (JSC::ownPropertyKeys):
24 * runtime/Structure.cpp:
25 (JSC::Structure::getPropertyNamesFromStructure):
26