RESOLVED FIXED Bug 143181
class methods should be non-enumerable
https://bugs.webkit.org/show_bug.cgi?id=143181
Summary class methods should be non-enumerable
Ryosuke Niwa
Reported 2015-03-28 01:46:53 PDT
Both instance and static methods defined by ES6 class syntax should not be enumerable.
Attachments
WIP (17.28 KB, patch)
2015-04-01 02:49 PDT, Ryosuke Niwa
no flags
WIP2 (18.72 KB, patch)
2015-04-02 23:20 PDT, Ryosuke Niwa
no flags
Fixes the bug (30.85 KB, patch)
2015-04-12 03:22 PDT, Ryosuke Niwa
no flags
Updated for ToT (34.90 KB, patch)
2015-04-20 16:25 PDT, Ryosuke Niwa
no flags
Fixed Windows build (35.36 KB, patch)
2015-04-22 14:39 PDT, Ryosuke Niwa
no flags
Another attempt to fix Windows build (35.32 KB, patch)
2015-04-22 21:50 PDT, Ryosuke Niwa
no flags
Fixed Windows build for good; fuck off cl.exe (35.37 KB, patch)
2015-04-23 03:36 PDT, Ryosuke Niwa
no flags
Yet another Win build fix; fuck cl.exe (36.10 KB, patch)
2015-04-23 12:33 PDT, Ryosuke Niwa
no flags
Fixed builds (36.33 KB, patch)
2015-04-23 16:59 PDT, Ryosuke Niwa
no flags
Another build fix (36.32 KB, patch)
2015-04-23 18:09 PDT, Ryosuke Niwa
darin: review+
Ryosuke Niwa
Comment 1 2015-03-28 01:48:56 PDT
Also see the bug 142842: The prototype internal slot of an ES6 class should be non-configurable and non-writable See dependency tree for bug 142842. We can either add an extra argument to op_put_by_id or add a new op code to modify the descriptor of a property. Any preferences?
Radar WebKit Bug Importer
Comment 2 2015-03-28 01:51:53 PDT
Ryosuke Niwa
Comment 3 2015-03-29 23:48:28 PDT
Looks like defineProperty is mostly used to define a new accessor in benchmarks (run-jsc-benchmarks): The total number of calls to defineOwnIndexProperty: 8 The total number of calls to defineOwnNonIndexProperty: 3562 was a new entry: 3398 didn't change descriptor: 0 configurable: 2224 enumerable: 2168 writable: 1726 accessor: 1726
Ryosuke Niwa
Comment 4 2015-03-29 23:53:04 PDT
In Speedometer, it's mostly used to define non-enumerable and non-writable proeprties: The total number of calls to defineOwnIndexProperty: 22 The total number of calls to defineOwnNonIndexProperty: 103034 was a new entry: 66903 (65%) didn't change descriptor: 0 configurable: 73953 (72%) enumerable: 2168 (2%) writable: 1726 (2%) accessor: 1726 (2%)
Ryosuke Niwa
Comment 5 2015-03-30 18:42:58 PDT
*** Bug 143246 has been marked as a duplicate of this bug. ***
Ryosuke Niwa
Comment 6 2015-03-30 18:48:38 PDT
I talked with Geoff today about this bug, and he suggested that we can just make a function call to defineProperty. We can then add an intrinsic to defineProperty so that it'll go fast in DFG. That'll work nicely with the bug 143239.
Ryosuke Niwa
Comment 7 2015-04-01 02:49:04 PDT
Created attachment 249911 [details] WIP Some real craziness.
Ryosuke Niwa
Comment 8 2015-04-02 23:20:28 PDT
Ryosuke Niwa
Comment 9 2015-04-12 03:22:57 PDT
Created attachment 250598 [details] Fixes the bug
Ryosuke Niwa
Comment 10 2015-04-20 16:25:08 PDT
Created attachment 251202 [details] Updated for ToT
Darin Adler
Comment 11 2015-04-21 16:54:11 PDT
Comment on attachment 251202 [details] Updated for ToT View in context: https://bugs.webkit.org/attachment.cgi?id=251202&action=review > Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h:572 > + unsigned m_linkTimeConstants[LinkTimeConstantCount] { 0 }; Looks like Windows can’t handle this.
Oliver Hunt
Comment 12 2015-04-21 17:34:51 PDT
Comment on attachment 251202 [details] Updated for ToT View in context: https://bugs.webkit.org/attachment.cgi?id=251202&action=review >> Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h:572 >> + unsigned m_linkTimeConstants[LinkTimeConstantCount] { 0 }; > > Looks like Windows can’t handle this. I'd swear we've used things like this before -- you could try making LinkTimeConstantCount static or a class member. Also honestly i'd prefer it if you used std::array here sit has bounds checking at least in debug builds (alas not in release :-/ )
Ryosuke Niwa
Comment 13 2015-04-22 14:39:46 PDT
Created attachment 251369 [details] Fixed Windows build
Ryosuke Niwa
Comment 14 2015-04-22 21:50:02 PDT
Created attachment 251404 [details] Another attempt to fix Windows build
Ryosuke Niwa
Comment 15 2015-04-23 03:36:03 PDT
Created attachment 251425 [details] Fixed Windows build for good; fuck off cl.exe
Ryosuke Niwa
Comment 16 2015-04-23 12:33:58 PDT
Created attachment 251468 [details] Yet another Win build fix; fuck cl.exe
Ryosuke Niwa
Comment 17 2015-04-23 12:34:11 PDT
Fucking cl.exe needs to die.
Geoffrey Garen
Comment 18 2015-04-23 13:19:01 PDT
Comment on attachment 251468 [details] Yet another Win build fix; fuck cl.exe View in context: https://bugs.webkit.org/attachment.cgi?id=251468&action=review Patch looks OK to me. Please address the comments below, and fix the build. > Source/JavaScriptCore/bytecode/CodeBlock.cpp:1769 > + for (unsigned i = 0; i < LinkTimeConstantCount; i++) { > + LinkTimeConstant type = static_cast<LinkTimeConstant>(i); > + if (unsigned registerIndex = unlinkedCodeBlock->registerIndexForLinkTimeConstant(type)) > + m_constantRegisters[registerIndex].set(*m_vm, ownerExecutable, m_globalObject->jsCellForLinkTimeConstant(type)); > + } Can we unify LinkTimeConstant with SpecialPointer? They implement the same feature, so it would be nice to unify them. SpecialPointer is just a LinkTimeConstant for one of two possible functions (call, apply), and LinkTimeConstant adds another (defineProperty). > Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:152 > + m_linkTimeConstantRegisters = { {nullptr} }; Will this syntax fill all entries or just the first? We want to fill all.
Ryosuke Niwa
Comment 19 2015-04-23 14:13:25 PDT
(In reply to comment #18) > Comment on attachment 251468 [details] > Yet another Win build fix; fuck cl.exe > > View in context: > https://bugs.webkit.org/attachment.cgi?id=251468&action=review > > Patch looks OK to me. Please address the comments below, and fix the build. > > > Source/JavaScriptCore/bytecode/CodeBlock.cpp:1769 > > + for (unsigned i = 0; i < LinkTimeConstantCount; i++) { > > + LinkTimeConstant type = static_cast<LinkTimeConstant>(i); > > + if (unsigned registerIndex = unlinkedCodeBlock->registerIndexForLinkTimeConstant(type)) > > + m_constantRegisters[registerIndex].set(*m_vm, ownerExecutable, m_globalObject->jsCellForLinkTimeConstant(type)); > > + } > > Can we unify LinkTimeConstant with SpecialPointer? They implement the same > feature, so it would be nice to unify them. SpecialPointer is just a > LinkTimeConstant for one of two possible functions (call, apply), and > LinkTimeConstant adds another (defineProperty). Yeah, that's the plan but I didn't want to do that in this patch since it's already quite massive. > > Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:152 > > + m_linkTimeConstantRegisters = { {nullptr} }; > > Will this syntax fill all entries or just the first? We want to fill all. It should initiailize them all but I'm gonna just use loop since it doesn't seem like nothing compiles these days.
Ryosuke Niwa
Comment 20 2015-04-23 16:59:53 PDT
Created attachment 251514 [details] Fixed builds
Ryosuke Niwa
Comment 21 2015-04-23 18:09:54 PDT
Created attachment 251521 [details] Another build fix
Darin Adler
Comment 22 2015-04-23 19:17:17 PDT
Comment on attachment 251521 [details] Another build fix View in context: https://bugs.webkit.org/attachment.cgi?id=251521&action=review > Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h:334 > + unsigned addConstant(LinkTimeConstant type) ASSERT it’s < LinkTimeConstantCount? > Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h:343 > + unsigned registerIndexForLinkTimeConstant(LinkTimeConstant type) ASSERT it’s < LinkTimeConstantCount? > Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:153 > + for (unsigned i = 0; i < LinkTimeConstantCount; i++) > + m_linkTimeConstantRegisters[i] = nullptr; Can this use a modern for loop instead? > Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:186 > + for (unsigned i = 0; i < LinkTimeConstantCount; i++) > + m_linkTimeConstantRegisters[i] = nullptr; Can this use a modern for loop instead? > Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:504 > + for (unsigned i = 0; i < LinkTimeConstantCount; i++) > + m_linkTimeConstantRegisters[i] = nullptr; Can this use a modern for loop instead?
Ryosuke Niwa
Comment 23 2015-04-23 19:25:30 PDT
(In reply to comment #22) > Comment on attachment 251521 [details] > Another build fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=251521&action=review > > > Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:153 > > + for (unsigned i = 0; i < LinkTimeConstantCount; i++) > > + m_linkTimeConstantRegisters[i] = nullptr; > > Can this use a modern for loop instead? How do I do that?
Ryosuke Niwa
Comment 24 2015-04-25 14:43:47 PDT
Okay, we can just do: for (auto& constantRegister : m_linkTimeConstantRegisters) constantRegister = nullptr;
Ryosuke Niwa
Comment 25 2015-04-25 14:57:15 PDT
Thanks for the review! Will land the patch after using modern loops and adding assertions.
Ryosuke Niwa
Comment 26 2015-04-25 15:04:40 PDT
Note You need to log in before you can comment on or make changes to this bug.