Unreviewed, rolling out r143348.

http://trac.webkit.org/changeset/143348
https://bugs.webkit.org/show_bug.cgi?id=110242

"Caused a deleted value sentinel crash on the layout tests"
(Requested by ggaren on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2013-02-19

* runtime/CodeCache.cpp:
(JSC::CodeCache::getFunctionExecutableFromGlobalCode):
* runtime/CodeCache.h:
(JSC::SourceCodeKey::SourceCodeKey):
(JSC::SourceCodeKey::isHashTableDeletedValue):
(JSC::SourceCodeKey::hash):
(JSC::SourceCodeKey::length):
(JSC::SourceCodeKey::isNull):
(JSC::SourceCodeKey::operator==):
(SourceCodeKey):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@143366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 981fb1d8
2013-02-19 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r143348.
http://trac.webkit.org/changeset/143348
https://bugs.webkit.org/show_bug.cgi?id=110242
"Caused a deleted value sentinel crash on the layout tests"
(Requested by ggaren on #webkit).
* runtime/CodeCache.cpp:
(JSC::CodeCache::getFunctionExecutableFromGlobalCode):
* runtime/CodeCache.h:
(JSC::SourceCodeKey::SourceCodeKey):
(JSC::SourceCodeKey::isHashTableDeletedValue):
(JSC::SourceCodeKey::hash):
(JSC::SourceCodeKey::length):
(JSC::SourceCodeKey::isNull):
(JSC::SourceCodeKey::operator==):
(SourceCodeKey):
2013-02-19 Mark Hahnenberg <mhahnenberg@apple.com>
HeapBlock::destroy should issue warning if result is unused
......
......@@ -105,7 +105,7 @@ UnlinkedEvalCodeBlock* CodeCache::getEvalCodeBlock(JSGlobalData& globalData, Eva
UnlinkedFunctionExecutable* CodeCache::getFunctionExecutableFromGlobalCode(JSGlobalData& globalData, const Identifier& name, const SourceCode& source, ParserError& error)
{
SourceCodeKey key = SourceCodeKey(source, name.string(), SourceCodeKey::FunctionType, JSParseNormal);
SourceCodeKey key = SourceCodeKey(source, name.string(), SourceCodeKey::FunctionCallType, JSParseNormal);
const Strong<JSCell>* result = m_sourceCode.find(key);
if (result)
return jsCast<UnlinkedFunctionExecutable*>(result->get());
......
......@@ -55,51 +55,44 @@ class SourceProvider;
class SourceCodeKey {
public:
enum CodeType { EvalType, ProgramType, FunctionType };
enum CodeType { EvalType, ProgramType, FunctionCallType, FunctionConstructType };
SourceCodeKey()
: m_flags(0)
{
}
SourceCodeKey(const SourceCode& sourceCode, const String& name, CodeType codeType, JSParserStrictness jsParserStrictness)
: m_sourceCode(sourceCode)
: m_sourceString(sourceCode.toString())
, m_name(name)
, m_flags((codeType << 1) | jsParserStrictness)
, m_hash(string().impl()->hash())
{
}
SourceCodeKey(WTF::HashTableDeletedValueType)
: m_name(WTF::HashTableDeletedValue)
: m_sourceString(WTF::HashTableDeletedValue)
{
}
bool isHashTableDeletedValue() const { return m_name.isHashTableDeletedValue(); }
bool isHashTableDeletedValue() const { return m_sourceString.isHashTableDeletedValue(); }
unsigned hash() const { return m_hash; }
unsigned hash() const { return m_sourceString.impl()->hash(); }
size_t length() const { return m_sourceCode.length(); }
size_t length() const { return m_sourceString.length(); }
bool isNull() const { return m_sourceCode.isNull(); }
// To save memory, we compute our string on demand. It's expected that source
// providers cache their strings to make this efficient.
String string() const { return m_sourceCode.toString(); }
bool isNull() const { return m_sourceString.isNull(); }
bool operator==(const SourceCodeKey& other) const
{
return m_hash == other.m_hash
&& length() == other.length()
&& m_flags == other.m_flags
return m_flags == other.m_flags
&& m_name == other.m_name
&& string() == other.string();
&& m_sourceString == other.m_sourceString;
}
private:
SourceCode m_sourceCode;
String m_sourceString;
String m_name;
unsigned m_flags;
unsigned m_hash;
};
struct SourceCodeKeyHash {
......
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