Share structure across instances of classes exported through the ObjC API
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jun 2018 18:49:01 +0000 (18:49 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jun 2018 18:49:01 +0000 (18:49 +0000)
commitdbae2aa3ef858b48796c8fd2e337c927dd857ffe
tree53ea6fe979f05120e1e68658d06bcbd484762921
parenta5e7993275ff0399d488b6e415ccf0d1888155a6
Share structure across instances of classes exported through the ObjC API
https://bugs.webkit.org/show_bug.cgi?id=186579
<rdar://problem/40969212>

Patch by Tadeu Zagallo <tzagallo@apple.com> on 2018-06-18
Reviewed by Saam Barati.

A new structure was being created for each instance of exported ObjC
classes due to setting the prototype in the structure for every object,
since prototype transitions are not cached by the structure. Cache the
Structure in the JSObjcClassInfo to avoid the transition.

* API/JSWrapperMap.mm:
(-[JSObjCClassInfo wrapperForObject:inContext:]):
(-[JSObjCClassInfo structureInContext:]):
* API/tests/JSWrapperMapTests.h: Added.
* API/tests/JSWrapperMapTests.mm: Added.
(+[JSWrapperMapTests testStructureIdentity]):
(runJSWrapperMapTests):
* API/tests/testapi.mm:
(testObjectiveCAPIMain):
* JavaScriptCore.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232936 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/API/JSWrapperMap.mm
Source/JavaScriptCore/API/tests/JSWrapperMapTests.h [new file with mode: 0644]
Source/JavaScriptCore/API/tests/JSWrapperMapTests.mm [new file with mode: 0644]
Source/JavaScriptCore/API/tests/testapi.mm
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj