Changeset 143384 in webkit
- Timestamp:
- Feb 19, 2013 2:29:03 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r143381 r143384 1 2013-02-18 Geoffrey Garen <ggaren@apple.com> 2 3 Unreviewed, rolling in r143348. 4 http://trac.webkit.org/changeset/143348 5 https://bugs.webkit.org/show_bug.cgi?id=110242 6 7 The bug was that isEmptyValue() was returning true for the deleted value. 8 Fixed this and simplified things further by delegating to m_sourceCode 9 for both isNull() and isHashTableDeletedValue(), so they can't be out of 10 sync. 11 12 * runtime/CodeCache.cpp: 13 (JSC::CodeCache::getFunctionExecutableFromGlobalCode): 14 * runtime/CodeCache.h: 15 (JSC::SourceCodeKey::SourceCodeKey): 16 (JSC::SourceCodeKey::isHashTableDeletedValue): 17 (JSC::SourceCodeKey::hash): 18 (JSC::SourceCodeKey::length): 19 (JSC::SourceCodeKey::isNull): 20 (JSC::SourceCodeKey::operator==): 21 (SourceCodeKey): 22 1 23 2013-02-15 Martin Robinson <mrobinson@igalia.com> 2 24 -
trunk/Source/JavaScriptCore/parser/SourceCode.h
r128542 r143384 45 45 } 46 46 47 SourceCode(WTF::HashTableDeletedValueType) 48 : m_provider(WTF::HashTableDeletedValue) 49 { 50 } 51 47 52 SourceCode(PassRefPtr<SourceProvider> provider, int firstLine = 1) 48 53 : m_provider(provider) … … 60 65 { 61 66 } 67 68 bool isHashTableDeletedValue() const { return m_provider.isHashTableDeletedValue(); } 62 69 63 70 String toString() const -
trunk/Source/JavaScriptCore/runtime/CodeCache.cpp
r143366 r143384 106 106 UnlinkedFunctionExecutable* CodeCache::getFunctionExecutableFromGlobalCode(JSGlobalData& globalData, const Identifier& name, const SourceCode& source, ParserError& error) 107 107 { 108 SourceCodeKey key = SourceCodeKey(source, name.string(), SourceCodeKey::Function CallType, JSParseNormal);108 SourceCodeKey key = SourceCodeKey(source, name.string(), SourceCodeKey::FunctionType, JSParseNormal); 109 109 const Strong<JSCell>* result = m_sourceCode.find(key); 110 110 if (result) -
trunk/Source/JavaScriptCore/runtime/CodeCache.h
r143366 r143384 56 56 class SourceCodeKey { 57 57 public: 58 enum CodeType { EvalType, ProgramType, Function CallType, FunctionConstructType };58 enum CodeType { EvalType, ProgramType, FunctionType }; 59 59 60 60 SourceCodeKey() 61 : m_flags(0)62 61 { 63 62 } 64 63 65 64 SourceCodeKey(const SourceCode& sourceCode, const String& name, CodeType codeType, JSParserStrictness jsParserStrictness) 66 : m_source String(sourceCode.toString())65 : m_sourceCode(sourceCode) 67 66 , m_name(name) 68 67 , m_flags((codeType << 1) | jsParserStrictness) 68 , m_hash(string().impl()->hash()) 69 69 { 70 70 } 71 71 72 72 SourceCodeKey(WTF::HashTableDeletedValueType) 73 : m_source String(WTF::HashTableDeletedValue)73 : m_sourceCode(WTF::HashTableDeletedValue) 74 74 { 75 75 } 76 76 77 bool isHashTableDeletedValue() const { return m_source String.isHashTableDeletedValue(); }77 bool isHashTableDeletedValue() const { return m_sourceCode.isHashTableDeletedValue(); } 78 78 79 unsigned hash() const { return m_ sourceString.impl()->hash(); }79 unsigned hash() const { return m_hash; } 80 80 81 size_t length() const { return m_source String.length(); }81 size_t length() const { return m_sourceCode.length(); } 82 82 83 bool isNull() const { return m_sourceString.isNull(); } 83 bool isNull() const { return m_sourceCode.isNull(); } 84 85 // To save memory, we compute our string on demand. It's expected that source 86 // providers cache their strings to make this efficient. 87 String string() const { return m_sourceCode.toString(); } 84 88 85 89 bool operator==(const SourceCodeKey& other) const 86 90 { 87 return m_flags == other.m_flags 91 return m_hash == other.m_hash 92 && length() == other.length() 93 && m_flags == other.m_flags 88 94 && m_name == other.m_name 89 && m_sourceString == other.m_sourceString;95 && string() == other.string(); 90 96 } 91 97 92 98 private: 93 S tring m_sourceString;99 SourceCode m_sourceCode; 94 100 String m_name; 95 101 unsigned m_flags; 102 unsigned m_hash; 96 103 }; 97 104
Note: See TracChangeset
for help on using the changeset viewer.