Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r182058 - Objects with numeric properties intermittently get a …
…phantom 'length' property https://bugs.webkit.org/show_bug.cgi?id=142792 Reviewed by Csaba Osztrogonác. Source/JavaScriptCore: Fixed a > (greater than) that should be a >> (right shift) in the code that disassembles test and branch instructions. This function is used for linking tbz/tbnz branches between two seperately JIT'ed sections of code. Sometime we'd create a bogus tbz instruction in the failure case checks in the GetById array length stub created for "obj.length" access. If the failure case code address was at a negative offset from the stub, we'd look for bit 1 being set when we should have been looking for bit 0. * assembler/ARM64Assembler.h: (JSC::ARM64Assembler::disassembleTestAndBranchImmediate): LayoutTests: New regression test. * js/regress-142792-expected.txt: Added. * js/regress-142792.html: Added. * js/script-tests/regress-142792.js: Added. (isArrayLike): (filter):
- Loading branch information
1 parent
195f59d
commit f8611a8
Showing
6 changed files
with
105 additions
and
1 deletion.
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
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,10 @@ | ||
Verify that objects with numeric named properties don't set length like an array. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS Correct number of iterated keys: 3 | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
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,10 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../resources/js-test-pre.js"></script> | ||
</head> | ||
<body> | ||
<script src="script-tests/regress-142792.js"></script> | ||
<script src="../resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
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,52 @@ | ||
description("Verify that objects with numeric named properties don't set length like an array."); | ||
|
||
var numOfIterations = 10000; | ||
var count = 0; | ||
var obj = { | ||
1: 'foo', | ||
8: 'bar', | ||
50: 'baz' | ||
}; | ||
|
||
var expectedCount = Object.keys(obj).length; | ||
|
||
function isArrayLike(collection) { | ||
var length = collection && collection.length; | ||
|
||
return typeof length == 'number'; | ||
} | ||
|
||
function filter(obj, callback, context) { | ||
var results = []; | ||
var i, length; | ||
|
||
if (isArrayLike(obj)) { | ||
for (i = 0, length = obj.length; i < length; i++) { | ||
var value = obj[i]; | ||
if (callback(value)) | ||
results.push(value); | ||
} | ||
} else { | ||
for (var key in obj) { | ||
var value = obj[key]; | ||
if (callback(value)) | ||
results.push(value); | ||
} | ||
} | ||
|
||
return results; | ||
} | ||
|
||
for (var i = 0; i < numOfIterations; i++) { | ||
filter([], function() { return true; }); | ||
} | ||
|
||
filter(obj, function() { | ||
count++; | ||
return true; | ||
}); | ||
|
||
if (count !== expectedCount) | ||
testFailed("Incorrect number of iterated keys: " + count + ", expected: " + expectedCount); | ||
else | ||
testPassed("Correct number of iterated keys: " + count); |
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