If you have class Foo { constructor() { this.property = 1; Object.preventExtensions(this); } } calling new Foo() seems to be 2-3x slower than doing so without the call to preventExtensions. This is not the case in v8 or Firefox. This pattern is really nice since it catches bad assignments and typos in code.
Created attachment 283875 [details] work in progress
Created attachment 283877 [details] the patch
Created attachment 283878 [details] the patch The previous patch didn't include the LayoutTests additions. I'm still testing this, but so far it appears to work like a charm.
Comment on attachment 283878 [details] the patch I'm seeing crashes. I'll put up a better patch once I figure out what those are all about.
Comment on attachment 283878 [details] the patch Attachment 283878 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/1699149 New failing tests: js/preventExtensions.html
Created attachment 283879 [details] Archive of layout-test-results from ews106 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Comment on attachment 283878 [details] the patch Attachment 283878 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/1699142 New failing tests: js/preventExtensions.html
Created attachment 283880 [details] Archive of layout-test-results from ews114 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-yosemite Platform: Mac OS X 10.10.5
Created attachment 283882 [details] the patch Fixed the test failure.
Created attachment 283883 [details] performance
Created attachment 283884 [details] the patch Included perf data.
Comment on attachment 283884 [details] the patch r=me
Landed in https://trac.webkit.org/changeset/203368
Looks like this breaks some test262 tests. Specifically: JSTests/test262/test/built-ins/Object/freeze/15.2.3.9-2-c-2.js JSTests/test262/test/built-ins/Object/freeze/15.2.3.9-2-c-3.js JSTests/test262/test/built-ins/Object/freeze/15.2.3.9-2-c-4.js Which can be run with: jsc JSTests/test262/harness/assert.js JSTests/test262/harness/sta.js JSTests/test262/harness/propertyHelper.js <testFile>
(In reply to comment #14) > Looks like this breaks some test262 tests. > > Specifically: > > JSTests/test262/test/built-ins/Object/freeze/15.2.3.9-2-c-2.js > JSTests/test262/test/built-ins/Object/freeze/15.2.3.9-2-c-3.js > JSTests/test262/test/built-ins/Object/freeze/15.2.3.9-2-c-4.js > > Which can be run with: > > jsc JSTests/test262/harness/assert.js JSTests/test262/harness/sta.js > JSTests/test262/harness/propertyHelper.js <testFile> Filed: https://bugs.webkit.org/show_bug.cgi?id=160479