Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r250585 - ObjectAllocationSinkingPhase shouldn't insert hints f…
…or allocations which are no longer valid https://bugs.webkit.org/show_bug.cgi?id=199361 <rdar://problem/52454940> Reviewed by Yusuke Suzuki. JSTests: * stress/allocation-sinking-hints-are-valid-ssa-2.js: Added. (main.fn): (main.executor): (main): * stress/allocation-sinking-hints-are-valid-ssa.js: Added. (main.fn): (main.executor): (main): Source/JavaScriptCore: In a prior fix to the object allocation sinking phase, I added code where we made sure to insert PutHints over Phis for fields of an object at control flow merge points. However, that code didn't consider that the base of the PutHint may no longer be a valid heap location. This could cause us to emit invalid SSA code by referring to a node which does not dominate the PutHint location. This patch fixes the bug to only emit the PutHints when valid. This patch also makes it so that DFGValidate actually validates that the graph is in valid SSA form. E.g, any use of a node N must be dominated by N. * dfg/DFGObjectAllocationSinkingPhase.cpp: * dfg/DFGValidate.cpp:
- Loading branch information
1 parent
596264d
commit 985f0fc
Showing
6 changed files
with
118 additions
and
3 deletions.
There are no files selected for viewing
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
31 changes: 31 additions & 0 deletions
31
JSTests/stress/allocation-sinking-hints-are-valid-ssa-2.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,31 @@ | ||
function main() { | ||
const arr = [0]; | ||
function executor(resolve, ...reject) { | ||
arr; | ||
if (resolve > arr) { | ||
const fn = () => { | ||
return fn; | ||
}; | ||
for (const _ of arr) { | ||
function fn() {} | ||
arr.toString(arr, arr, arr, arr, arr, arr); | ||
throw new Error(); | ||
} | ||
} else { | ||
for (const _ of [arr]) { | ||
arr.toString(); | ||
} | ||
const fn = () => {}; | ||
} | ||
new Promise(executor, arr); | ||
let some = {}; | ||
with(arr) {} | ||
return reject; | ||
} | ||
executor(); | ||
|
||
for (let i = 0; i < 100; i++) { | ||
executor(); | ||
} | ||
} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function main() { | ||
const arr = [0]; | ||
function executor(resolve, ...reject) { | ||
arr; | ||
if (resolve > arr) { | ||
const fn = () => { | ||
return fn; | ||
}; | ||
for (const _ of arr) { | ||
function fn() {} | ||
arr.toString(arr, arr, arr, arr, arr, arr); | ||
throw new Error(); | ||
} | ||
} else { | ||
for (const _ of [arr]) { | ||
arr.toString(); | ||
} | ||
const fn = () => {}; | ||
} | ||
new Promise(executor, arr); | ||
let some = {}; | ||
with(arr) {} | ||
return reject; | ||
} | ||
executor(); | ||
|
||
for (let i = 0; i < 100; i++) { | ||
executor(); | ||
} | ||
} | ||
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