-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 4e48bda. rdar://123858251
[JSC] AI should observe attribute change transitions for PutByIdDirect in DFG compilation https://bugs.webkit.org/show_bug.cgi?id=270265 rdar://122515736 Reviewed by Yusuke Suzuki. Since DirectPutById can trigger and cache attribute change transitions, the AI should observe these kinds of transitions when computing for GetByStatus in the DFG compilation. * JSTests/stress/dfg-ai-attribute-change-transition-1.js: Added. (returnObject): (Opt): (createObjectA): (createObjectB): (initialize): * JSTests/stress/dfg-ai-attribute-change-transition-2.js: Added. (returnObject): (Opt): (createObject): (getStructureID): (main): * Source/JavaScriptCore/bytecode/PutByStatus.cpp: (JSC::PutByStatus::computeFor): * Source/JavaScriptCore/runtime/Structure.cpp: (JSC::Structure::attributeChangeTransitionToExistingStructureImpl): (JSC::Structure::attributeChangeTransitionToExistingStructure): (JSC::Structure::attributeChangeTransitionToExistingStructureConcurrently): * Source/JavaScriptCore/runtime/Structure.h: Canonical link: https://commits.webkit.org/272448.651@safari-7618-branch
- Loading branch information
Showing
4 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
JSTests/stress/dfg-ai-direct-get-by-id-attribute-change-transition.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
function returnObject(object) { | ||
return object; | ||
} | ||
|
||
class Opt extends returnObject { | ||
p2 = 1; | ||
|
||
constructor(object) { | ||
object.p1; | ||
|
||
super(object); | ||
} | ||
} | ||
|
||
function createObject() { | ||
const object = {p1: 1}; | ||
Object.defineProperty(object, 'p2', { | ||
configurable: true, | ||
enumerable: false, | ||
writable: true, | ||
value: 1 | ||
}); | ||
|
||
return object; | ||
} | ||
|
||
function getStructureID(object) { | ||
const desc = describe(object); | ||
|
||
return desc.match(/StructureID: (\d+)/)[1]; | ||
} | ||
|
||
function main() { | ||
const a = createObject(); | ||
new Opt(a); | ||
|
||
for (let i = 0; i < 100000; i++) { | ||
new Opt(createObject()); | ||
} | ||
|
||
const b = createObject(); | ||
new Opt(b); | ||
|
||
const aStructureID = getStructureID(a); | ||
const bStructureID = getStructureID(b); | ||
|
||
if (aStructureID !== bStructureID) | ||
throw new Error('Structure ID mismatch.'); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters