Ignore:
Timestamp:
Jun 25, 2010, 5:41:49 PM (15 years ago)
Author:
[email protected]
Message:

2010-06-25 Renata Hodovan <[email protected]>

Reviewed by Geoffrey Garen.

Merge RegExp constructor and RegExp::create methods into one.
Both of function are called with tree parameters and check whether
flags (the third param) is given or not.
Simplify hash lookups in RegExpCache::create with giving them an extra
iterator parameter.
https://bugs.webkit.org/show_bug.cgi?id=41055

  • runtime/RegExp.cpp: (JSC::RegExp::RegExp):
  • runtime/RegExp.h:
  • runtime/RegExpCache.cpp: (JSC::RegExpCache::lookupOrCreate): (JSC::RegExpCache::create):
  • runtime/RegExpCache.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/RegExpCache.cpp

    r61845 r61924  
    3838        if (!result.second)
    3939            return result.first->second;
     40        else
     41            return create(patternString, flags, result.first);
    4042    }
    41     return create(patternString, flags);
     43    return create(patternString, flags, m_cacheMap.end());
    4244}
    4345
    44 PassRefPtr<RegExp> RegExpCache::create(const UString& patternString, const UString& flags)
     46PassRefPtr<RegExp> RegExpCache::create(const UString& patternString, const UString& flags, RegExpCacheMap::iterator iterator)
    4547{
    46     RefPtr<RegExp> regExp;
    47 
    48     if (!flags.isNull())
    49         regExp = RegExp::create(m_globalData, patternString, flags);
    50     else
    51         regExp = RegExp::create(m_globalData, patternString);
     48    RefPtr<RegExp> regExp = RegExp::create(m_globalData, patternString, flags);
    5249
    5350    if (patternString.size() >= maxCacheablePatternLength)
     
    6360
    6461    RegExpKey key = RegExpKey(flags, patternString);
    65     m_cacheMap.set(key, regExp);
     62    iterator->first = key;
     63    iterator->second = regExp;
    6664    patternKeyArray[m_nextKeyToEvict].flagsValue = key.flagsValue;
    6765    patternKeyArray[m_nextKeyToEvict].pattern = patternString.rep();
Note: See TracChangeset for help on using the changeset viewer.