RESOLVED FIXED 221093
Support Ergonomic Brand Checks proposal (`#x in obj`)
https://bugs.webkit.org/show_bug.cgi?id=221093
Summary Support Ergonomic Brand Checks proposal (`#x in obj`)
Jordan Harband
Reported 2021-01-28 10:27:55 PST
See https://github.com/tc39/proposal-private-fields-in-in - as of yesterday, it is now stage 3. It'd be great to see Webkit ship this feature ASAP!
Attachments
Patch (44.98 KB, patch)
2021-05-06 16:53 PDT, Ross Kirsling
no flags
Patch (45.07 KB, patch)
2021-05-17 12:45 PDT, Ross Kirsling
ews-feeder: commit-queue-
Patch (45.08 KB, patch)
2021-05-17 13:16 PDT, Ross Kirsling
no flags
Patch (47.49 KB, patch)
2021-05-22 16:23 PDT, Ross Kirsling
no flags
Patch for landing (47.53 KB, patch)
2021-05-22 20:03 PDT, Ross Kirsling
no flags
Radar WebKit Bug Importer
Comment 1 2021-02-04 10:28:12 PST
Jordan Harband
Comment 2 2021-04-19 07:53:26 PDT
test262 tests have landed: https://github.com/tc39/test262/pull/2963 it'd be great to see this implemented :-D
Ross Kirsling
Comment 3 2021-05-06 16:53:42 PDT
Ross Kirsling
Comment 4 2021-05-10 13:50:56 PDT
Comment on attachment 427961 [details] Patch (Marking r? since this is a fully-working patch, but I've asked for backend guidance on Slack.)
Caio Lima
Comment 5 2021-05-11 12:13:59 PDT
Comment on attachment 427961 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=427961&action=review Patch LGTM. I left couple of suggestions. > Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:2823 > + emitThrowTypeError("Cannot access static private method or accessor"); Thank you for fixing this. > Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:2111 > + fixEdge<CellUse>(node->child1()); Since we throw on anything but Object, I think it would be fine use `ObjectUse` here. However, this choice will cause OSR whenever `base` (i.e child1) is not an object. It is also true for non-cell types for the code as it is. > Source/JavaScriptCore/jit/JITOperations.cpp:484 > + return JSValue::encode(jsBoolean(false)); I’d prefer return here `JSValue()` > Source/JavaScriptCore/jit/JITOperations.cpp:506 > + return JSValue::encode(jsBoolean(false)); ditto
Ross Kirsling
Comment 6 2021-05-11 14:34:50 PDT
(In reply to Caio Lima from comment #5) > > Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:2111 > > + fixEdge<CellUse>(node->child1()); > > Since we throw on anything but Object, I think it would be fine use > `ObjectUse` here. However, this choice will cause OSR whenever `base` (i.e > child1) is not an object. It is also true for non-cell types for the code as > it is. Hmm, one way or another, I think I'd like to keep this part consistent with InByVal/InById, since this operand behaves identically.
Ross Kirsling
Comment 7 2021-05-17 12:45:44 PDT
Created attachment 428855 [details] Patch Addressed comments and made the feature off-by-default per our meeting. Will aim to optimize InByVal itself next and then mimic that functionality for this feature.
Ross Kirsling
Comment 8 2021-05-17 13:16:07 PDT
Caio Lima
Comment 9 2021-05-21 09:51:17 PDT
Comment on attachment 428857 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=428857&action=review r=me with comments > Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:3220 > + } I’d assert here if it’s a private method or accessor > Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:8279 > + auto bytecode = currentInstruction->as<OpHasPrivateName>(); Could you add a FIXME to point to a bug where we could inline this operation? > Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:8285 > + auto bytecode = currentInstruction->as<OpHasPrivateBrand>(); Ditto > Source/JavaScriptCore/runtime/JSObjectInlines.h:702 > + ASSERT(brand.isSymbol()); Could we assert here that it’s also a PrivateSymbol? > JSTests/stress/private-in.js:58 > + shouldThrowTypeError(() => SS.isSS(3)); It would be nice test cases where we evaluate a class more than once.
Ross Kirsling
Comment 10 2021-05-22 16:23:00 PDT
EWS
Comment 11 2021-05-22 19:45:40 PDT
Caio Lima found in /Volumes/Data/worker/Commit-Queue/build/JSTests/ChangeLog does not appear to be a valid reviewer according to contributors.json. /Volumes/Data/worker/Commit-Queue/build/JSTests/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).
Ross Kirsling
Comment 12 2021-05-22 20:03:05 PDT
Created attachment 429451 [details] Patch for landing
EWS
Comment 13 2021-05-22 20:50:14 PDT
Committed r277926 (238057@main): <https://commits.webkit.org/238057@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 429451 [details].
Note You need to log in before you can comment on or make changes to this bug.