Commit 7f3c7caf authored by darin@apple.com's avatar darin@apple.com

JavaScriptCore:

        Reviewed by Mitz.

        - fix http://bugs.webkit.org/show_bug.cgi?id=15848
          <rdar://problem/5619330> REGRESSION: Assertion failure viewing comments page on digg.com

        Test: fast/js/sparse-array.html

        * kjs/array_instance.cpp:
        (KJS::ArrayInstance::inlineGetOwnPropertySlot): Check sparse array cutoff before looking
        in hash map. Can't avoid the branch because we can't look for 0 in the hash.
        (KJS::ArrayInstance::deleteProperty): Ditto.

LayoutTests:

        Reviewed by Mitz.

        - test for http://bugs.webkit.org/show_bug.cgi?id=15848
          <rdar://problem/5619330> REGRESSION: Assertion failure viewing comments page on digg.com

        * fast/js/resources/sparse-array.js: Added.
        * fast/js/sparse-array-expected.txt: Added.
        * fast/js/sparse-array.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@28346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1d9e94a1
2007-12-02 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- fix http://bugs.webkit.org/show_bug.cgi?id=15848
<rdar://problem/5619330> REGRESSION: Assertion failure viewing comments page on digg.com
Test: fast/js/sparse-array.html
* kjs/array_instance.cpp:
(KJS::ArrayInstance::inlineGetOwnPropertySlot): Check sparse array cutoff before looking
in hash map. Can't avoid the branch because we can't look for 0 in the hash.
(KJS::ArrayInstance::deleteProperty): Ditto.
2007-12-02 Geoffrey Garen <ggaren@apple.com>
Build fix: added an #include.
......
......@@ -151,10 +151,12 @@ ALWAYS_INLINE bool ArrayInstance::inlineGetOwnPropertySlot(ExecState* exec, unsi
return true;
}
} else if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
SparseArrayValueMap::iterator it = map->find(i);
if (it != map->end()) {
slot.setValueSlot(this, &it->second);
return true;
if (i >= sparseArrayCutoff) {
SparseArrayValueMap::iterator it = map->find(i);
if (it != map->end()) {
slot.setValueSlot(this, &it->second);
return true;
}
}
}
......@@ -318,10 +320,12 @@ bool ArrayInstance::deleteProperty(ExecState* exec, unsigned i)
}
if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
SparseArrayValueMap::iterator it = map->find(i);
if (it != map->end()) {
map->remove(it);
return true;
if (i >= sparseArrayCutoff) {
SparseArrayValueMap::iterator it = map->find(i);
if (it != map->end()) {
map->remove(it);
return true;
}
}
}
......
2007-12-02 Darin Adler <darin@apple.com>
Reviewed by Mitz.
- test for http://bugs.webkit.org/show_bug.cgi?id=15848
<rdar://problem/5619330> REGRESSION: Assertion failure viewing comments page on digg.com
* fast/js/resources/sparse-array.js: Added.
* fast/js/sparse-array-expected.txt: Added.
* fast/js/sparse-array.html: Added.
2007-12-02 Darin Adler <darin@apple.com>
Reviewed by Mitz.
......
description(
'This tests some sparse array operations.'
);
var array = [ ];
array[50000] = 100;
shouldBe('array[0]', 'undefined');
shouldBe('array[49999]', 'undefined');
shouldBe('array[50000]', '100');
shouldBe('array[50001]', 'undefined');
array[0]++;
shouldBe('array[0]', 'NaN');
shouldBe('array[49999]', 'undefined');
shouldBe('array[50000]', '100');
shouldBe('array[50001]', 'undefined');
debug('');
successfullyParsed = true;
This tests some sparse array operations.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS array[0] is undefined
PASS array[49999] is undefined
PASS array[50000] is 100
PASS array[50001] is undefined
PASS array[0] is NaN
PASS array[49999] is undefined
PASS array[50000] is 100
PASS array[50001] is undefined
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="resources/js-test-style.css">
<script src="resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/sparse-array.js"></script>
<script src="resources/js-test-post.js"></script>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment