IndexedDB: additional checks on LevelDB decoding
https://bugs.webkit.org/show_bug.cgi?id=109711

Reviewed by Tony Chang.

Source/WebCore:

Watch out for decoding errors caused by corrupted data, and exit various
decode/compare operations earlier.

Covered by existing LayoutTests and Chromium's webkit_unit_tests

* Modules/indexeddb/IDBLevelDBCoding.cpp:
(WebCore::IDBLevelDBCoding::decodeStringWithLength): Bail if length is negative.
(WebCore::IDBLevelDBCoding::compareEncodedStringsWithLength): Distinguish error case.
(WebCore::IDBLevelDBCoding::extractEncodedIDBKey): Bail if length is negative.
(WebCore::IDBLevelDBCoding::compareEncodedIDBKeys): Distinguish error case.
(WebCore::IDBLevelDBCoding::compare): Plumb through "ok".
(WebCore::IDBLevelDBCoding::ObjectStoreDataKey::compare): Ditto.
(WebCore::IDBLevelDBCoding::ExistsEntryKey::compare): Ditto.
(WebCore::IDBLevelDBCoding::IndexDataKey::compare): Ditto.
* Modules/indexeddb/IDBLevelDBCoding.h: Updated method signatures.

Source/WebKit/chromium:

* tests/IDBLevelDBCodingTest.cpp: Update test with new method signatures.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@143347 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Save space on keys in the CodeCache
https://bugs.webkit.org/show_bug.cgi?id=110179

Reviewed by Oliver Hunt.

Share the SourceProvider's string instead of making our own copy. This
chops off 16MB - 32MB from the CodeCache's memory footprint when full.
(It's 16MB when the strings are LChar, and 32MB when they're UChar.)

* runtime/CodeCache.cpp:
(JSC::CodeCache::getFunctionExecutableFromGlobalCode):
* runtime/CodeCache.h: Removed a defunct enum value.

(JSC::SourceCodeKey::SourceCodeKey):
(JSC::SourceCodeKey::isHashTableDeletedValue):
(SourceCodeKey):
(JSC::SourceCodeKey::hash):
(JSC::SourceCodeKey::length):
(JSC::SourceCodeKey::isNull):
(JSC::SourceCodeKey::string):
(JSC::SourceCodeKey::operator==): Store a SourceCode instead of a String
so we can share our string with our SourceProvider. Cache our hash so
we don't have to re-decode our string just to re-hash the table.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@143348 268f45cc-cd09-0410-ab3c-d52691b4dbfc