Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r229036 - validateStackAccess should not validate if the offset…
… is within the stack bounds https://bugs.webkit.org/show_bug.cgi?id=183067 <rdar://problem/37749988> Reviewed by Mark Lam. JSTests: * stress/dont-validate-stack-offset-in-b3-because-it-might-be-guarded-by-control-flow.js: Added. (assert): (test.a): (test.b): (test): Source/JavaScriptCore: The validation rule was saying that any load from the stack must be within the stack bounds of the frame. However, it's natural for a user of B3 to emit code that may be outside of B3's stack bounds, but guard such a load with a branch. The FTL does exactly this with GetMyArgumentByVal. B3 is wrong to assert that this is a static property about all stack loads. * b3/B3Validate.cpp:
- Loading branch information
1 parent
37cc3d4
commit 67f53cd
Showing
4 changed files
with
56 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
26 changes: 26 additions & 0 deletions
26
...ts/stress/dont-validate-stack-offset-in-b3-because-it-might-be-guarded-by-control-flow.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,26 @@ | ||
function assert(b) { | ||
if (!b) | ||
throw new Error; | ||
} | ||
noInline(assert); | ||
|
||
function test() { | ||
function a(a1, a2, a3, ...rest) { | ||
return [rest.length, rest[0], rest[10]]; | ||
} | ||
|
||
function b(...rest) { | ||
return a.apply(null, rest); | ||
} | ||
noInline(b); | ||
|
||
for (let i = 0; i < 12000; i++) { | ||
b(); | ||
let r = a(undefined, 0); | ||
assert(r[0] === 0); | ||
assert(r[1] === undefined); | ||
assert(r[2] === undefined); | ||
} | ||
} | ||
|
||
test(); |
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