JIT SSE2 optimization improvement.

This commit is contained in:
Zoltán Herczeg 2017-05-28 03:53:09 +00:00
parent c34544b11f
commit b317bdc184
1 changed files with 21 additions and 13 deletions

View File

@ -4839,7 +4839,7 @@ if (common->match_end_ptr != 0)
static BOOL check_fast_forward_char_pair_sse2(compiler_common *common, fast_forward_char_data *chars, int max) static BOOL check_fast_forward_char_pair_sse2(compiler_common *common, fast_forward_char_data *chars, int max)
{ {
sljit_s32 i, priority, left, count; sljit_s32 i, j, priority, count;
sljit_u32 priorities; sljit_u32 priorities;
PCRE2_UCHAR a1, a2, b1, b2; PCRE2_UCHAR a1, a2, b1, b2;
@ -4865,25 +4865,33 @@ for (priority = 7; priority > 2; priority--)
if ((priorities & (1 << priority)) == 0) if ((priorities & (1 << priority)) == 0)
continue; continue;
left = -1; for (i = max - 1; i >= 1; i--)
for (i = 0; i < max; i++)
if (chars[i].last_count >= priority) if (chars[i].last_count >= priority)
{ {
SLJIT_ASSERT(chars[i].count <= 2 && chars[i].count >= 1); SLJIT_ASSERT(chars[i].count <= 2 && chars[i].count >= 1);
b1 = chars[i].chars[0]; a1 = chars[i].chars[0];
b2 = chars[i].chars[1]; a2 = chars[i].chars[1];
if (left >= 0 && i - left <= max_fast_forward_char_pair_sse2_offset() && a1 != b1 && a1 != b2 && a2 != b1 && a2 != b2) j = i - max_fast_forward_char_pair_sse2_offset();
if (j < 0)
j = 0;
while (j < i)
{ {
fast_forward_char_pair_sse2(common, i, b1, b2, left, a1, a2); if (chars[j].last_count >= priority)
return TRUE; {
} b1 = chars[j].chars[0];
b2 = chars[j].chars[1];
left = i; if (a1 != b1 && a1 != b2 && a2 != b1 && a2 != b2)
a1 = b1; {
a2 = b2; fast_forward_char_pair_sse2(common, i, a1, a2, j, b1, b2);
return TRUE;
}
}
j++;
}
} }
} }