[Webkit-unassigned] [Bug 194095] [JSC] Add support for static public class fields
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Jul 21 20:13:50 PDT 2020
https://bugs.webkit.org/show_bug.cgi?id=194095
--- Comment #8 from Saam Barati <sbarati at apple.com> ---
Comment on attachment 404819
--> https://bugs.webkit.org/attachment.cgi?id=404819
Add support for static public fields, v5
View in context: https://bugs.webkit.org/attachment.cgi?id=404819&action=review
> Source/JavaScriptCore/ChangeLog:43
> + following order: b, c, a, d. Since each group of fields is
> + initialized independently we can trivially retrieve the property
> + keys for each group just by getting the odd property keys for
> + static fields (indexes 1 and 3) and the even ones for instance
> + fields (indexes 0 and 2).
I don't get this. Why do we need property keys of numbers ever? Are we looking up in an array or something?
> Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:823
> + RefPtr<RegisterID> propertyExpr = generator.emitNode(node.m_expression);
> + RefPtr<RegisterID> propertyName = generator.emitToPropertyKey(generator.newTemporary(), propertyExpr.get());
> +
> + Ref<Label> validPropertyNameLabel = generator.newLabel();
> + RefPtr<RegisterID> prototypeString = generator.emitLoad(nullptr, JSValue(generator.addStringConstant(generator.propertyNames().prototype)));
> + generator.emitJumpIfFalse(generator.emitBinaryOp<OpEq>(generator.newTemporary(), prototypeString.get(), propertyName.get(), OperandTypes(ResultType::stringType(), ResultType::stringType())), validPropertyNameLabel.get());
> + generator.emitThrowTypeError("Cannot declare a static field named 'prototype'");
>
> + generator.emitLabel(validPropertyNameLabel.get());
this code in emitSaveComputedFieldName is only called for static fields?
> Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:4822
> +
nit: revert
> Source/JavaScriptCore/parser/Parser.cpp:2885
> + unsigned nextInstanceComputedFieldID = 0, nextStaticComputedFieldID = 1;
nit: separate declarations on individual lines..
> Source/JavaScriptCore/parser/Parser.cpp:3087
> + // Property keys for computed fields start at 0 for instance
this is a confusing model to me. Why do we have numeric identifiers for each field?
> Source/JavaScriptCore/parser/Parser.cpp:3110
> + if (!nextComputedFieldID)
> + nextComputedFieldID++;
so the first field dictates if all other fields are static or not static?
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200722/c17de6c8/attachment.htm>
More information about the webkit-unassigned
mailing list