|
Lines 327-332
RegExpPrivate::create(JSContext *cx, JSString *source, RegExpFlag flags, TokenSt
Link Here
|
| 327 |
return RetType(self); |
327 |
return RetType(self); |
| 328 |
} |
328 |
} |
| 329 |
|
329 |
|
|
|
330 |
#if ENABLE_YARR_JIT |
| 330 |
/* This function should be deleted once bad Android platforms phase out. See bug 604774. */ |
331 |
/* This function should be deleted once bad Android platforms phase out. See bug 604774. */ |
| 331 |
inline bool |
332 |
inline bool |
| 332 |
RegExpPrivateCode::isJITRuntimeEnabled(JSContext *cx) |
333 |
RegExpPrivateCode::isJITRuntimeEnabled(JSContext *cx) |
|
Lines 337-348
RegExpPrivateCode::isJITRuntimeEnabled(JSContext *cx)
Link Here
|
| 337 |
return true; |
338 |
return true; |
| 338 |
#endif |
339 |
#endif |
| 339 |
} |
340 |
} |
|
|
341 |
#endif |
| 340 |
|
342 |
|
| 341 |
inline bool |
343 |
inline bool |
| 342 |
RegExpPrivateCode::compile(JSContext *cx, JSLinearString &pattern, TokenStream *ts, |
344 |
RegExpPrivateCode::compile(JSContext *cx, JSLinearString &pattern, TokenStream *ts, |
| 343 |
uintN *parenCount, RegExpFlag flags) |
345 |
uintN *parenCount, RegExpFlag flags) |
| 344 |
{ |
346 |
{ |
| 345 |
#if ENABLE_YARR_JIT |
|
|
| 346 |
/* Parse the pattern. */ |
347 |
/* Parse the pattern. */ |
| 347 |
ErrorCode yarrError; |
348 |
ErrorCode yarrError; |
| 348 |
YarrPattern yarrPattern(pattern, bool(flags & IgnoreCaseFlag), bool(flags & MultilineFlag), |
349 |
YarrPattern yarrPattern(pattern, bool(flags & IgnoreCaseFlag), bool(flags & MultilineFlag), |
|
Lines 359-365
RegExpPrivateCode::compile(JSContext *cx, JSLinearString &pattern, TokenStream *
Link Here
|
| 359 |
* case we have to bytecode compile it. |
360 |
* case we have to bytecode compile it. |
| 360 |
*/ |
361 |
*/ |
| 361 |
|
362 |
|
| 362 |
#ifdef JS_METHODJIT |
363 |
#if ENABLE_YARR_JIT && defined(JS_METHODJIT) |
| 363 |
if (isJITRuntimeEnabled(cx) && !yarrPattern.m_containsBackreferences) { |
364 |
if (isJITRuntimeEnabled(cx) && !yarrPattern.m_containsBackreferences) { |
| 364 |
if (!cx->compartment->ensureJaegerCompartmentExists(cx)) |
365 |
if (!cx->compartment->ensureJaegerCompartmentExists(cx)) |
| 365 |
return false; |
366 |
return false; |
|
Lines 371-391
RegExpPrivateCode::compile(JSContext *cx, JSLinearString &pattern, TokenStream *
Link Here
|
| 371 |
} |
372 |
} |
| 372 |
#endif |
373 |
#endif |
| 373 |
|
374 |
|
|
|
375 |
#if ENABLE_YARR_JIT |
| 374 |
codeBlock.setFallBack(true); |
376 |
codeBlock.setFallBack(true); |
|
|
377 |
#endif |
| 375 |
byteCode = byteCompile(yarrPattern, cx->compartment->regExpAllocator).get(); |
378 |
byteCode = byteCompile(yarrPattern, cx->compartment->regExpAllocator).get(); |
| 376 |
return true; |
379 |
return true; |
| 377 |
#else /* !defined(ENABLE_YARR_JIT) */ |
|
|
| 378 |
int error = 0; |
| 379 |
compiled = jsRegExpCompile(pattern.chars(), pattern.length(), |
| 380 |
ignoreCase() ? JSRegExpIgnoreCase : JSRegExpDoNotIgnoreCase, |
| 381 |
multiline() ? JSRegExpMultiline : JSRegExpSingleLine, |
| 382 |
parenCount, &error); |
| 383 |
if (error) { |
| 384 |
reportPCREError(cx, error); |
| 385 |
return false; |
| 386 |
} |
| 387 |
return true; |
| 388 |
#endif |
| 389 |
} |
380 |
} |
| 390 |
|
381 |
|
| 391 |
inline bool |
382 |
inline bool |
|
Lines 431-449
RegExpPrivateCode::execute(JSContext *cx, const jschar *chars, size_t start, siz
Link Here
|
| 431 |
else |
422 |
else |
| 432 |
result = JSC::Yarr::execute(codeBlock, chars, start, length, output); |
423 |
result = JSC::Yarr::execute(codeBlock, chars, start, length, output); |
| 433 |
#else |
424 |
#else |
| 434 |
result = jsRegExpExecute(cx, compiled, chars, length, start, output, outputCount); |
425 |
result = JSC::Yarr::interpret(byteCode, chars, start, length, output); |
| 435 |
#endif |
426 |
#endif |
| 436 |
|
427 |
|
| 437 |
if (result == -1) |
428 |
if (result == -1) |
| 438 |
return Success_NotFound; |
429 |
return Success_NotFound; |
| 439 |
|
430 |
|
| 440 |
#if !ENABLE_YARR_JIT |
|
|
| 441 |
if (result < 0) { |
| 442 |
reportPCREError(cx, result); |
| 443 |
return Error; |
| 444 |
} |
| 445 |
#endif |
| 446 |
|
| 447 |
JS_ASSERT(result >= 0); |
431 |
JS_ASSERT(result >= 0); |
| 448 |
return Success; |
432 |
return Success; |
| 449 |
} |
433 |
} |