Changeset 67146 in webkit for trunk/JavaScriptCore/runtime/RegExp.cpp
- Timestamp:
- Sep 9, 2010, 7:10:37 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/RegExp.cpp
r66936 r67146 69 69 , m_constructionError(0) 70 70 , m_numSubpatterns(0) 71 #if ENABLE(REGEXP_TRACING) 72 , m_rtMatchCallCount(0) 73 , m_rtMatchFoundCount(0) 74 #endif 71 75 , m_representation(adoptPtr(new RegExpRepresentation)) 72 76 { … … 90 94 PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& pattern, const UString& flags) 91 95 { 92 return adoptRef(new RegExp(globalData, pattern, flags)); 96 RefPtr<RegExp> res = adoptRef(new RegExp(globalData, pattern, flags)); 97 #if ENABLE(REGEXP_TRACING) 98 globalData->addRegExpToTrace(res); 99 #endif 100 return res.release(); 93 101 } 94 102 … … 110 118 if (ovector) 111 119 ovector->resize(0); 120 121 #if ENABLE(REGEXP_TRACING) 122 m_rtMatchCallCount++; 123 #endif 112 124 113 125 if (static_cast<unsigned>(startOffset) > s.length() || s.isNull()) … … 150 162 } 151 163 164 #if ENABLE(REGEXP_TRACING) 165 if (result != -1) 166 m_rtMatchFoundCount++; 167 #endif 168 152 169 return result; 153 170 } … … 168 185 int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector) 169 186 { 187 #if ENABLE(REGEXP_TRACING) 188 m_rtMatchCallCount++; 189 #endif 190 170 191 if (startOffset < 0) 171 192 startOffset = 0; … … 203 224 } 204 225 226 #if ENABLE(REGEXP_TRACING) 227 m_rtMatchFoundCount++; 228 #endif 229 205 230 return offsetVector[0]; 206 231 } … … 208 233 return -1; 209 234 } 210 211 #endif 212 235 236 #endif 237 238 #if ENABLE(REGEXP_TRACING) 239 void RegExp::printTraceData() 240 { 241 char formattedPattern[41]; 242 char rawPattern[41]; 243 244 strncpy(rawPattern, m_pattern.utf8().data(), 40); 245 rawPattern[40]= '\0'; 246 247 int pattLen = strlen(rawPattern); 248 249 snprintf(formattedPattern, 41, (pattLen <= 38) ? "/%.38s/" : "/%.36s...", rawPattern); 250 251 #if ENABLE(YARR_JIT) 252 Yarr::RegexCodeBlock& codeBlock = m_representation->m_regExpJITCode; 253 254 char jitAddr[20]; 255 if (codeBlock.getFallback()) 256 sprintf(jitAddr, "fallback"); 257 else 258 sprintf(jitAddr, "0x%014lx", (uintptr_t)codeBlock.getAddr()); 259 #else 260 const char* jitAddr = "JIT Off"; 261 #endif 262 263 printf("%-40.40s %16.16s %10d %10d\n", formattedPattern, jitAddr, m_rtMatchCallCount, m_rtMatchFoundCount); 264 } 265 #endif 266 213 267 } // namespace JSC
Note:
See TracChangeset
for help on using the changeset viewer.