Implement compress CompressibleStrings on GC reclaim end event

* Compress CompressibleStrings on GC reclaim end event
  - if there is reference about data of CompressibleString on stack, we should give up compressing.
    we don't need to search heap space because I redesigned StringView
    (we should not store string buffer data on heap without owner)
* Redesign StringView
  - Don't save string buffer address as its member. because buffer of CompressibleString can be deleted
  - If we don't save string buffer address on StringView, parser performance may dropped.
    becuase parser access string data a lot.
    so I introduce ParserStringView. it saves buffer address. we should ParserStringView on parser only.
    we can save string buffer address while parsing. because GC is disabled while parsing.

* Enable CompressibleString always
* Implement cache of RegExpOptionStrings
* Implement finding system locale function on RuntimeICUBinder avoiding call uloc_getDefault.

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
Seonghyun Kim 2019-12-26 10:20:10 +09:00 committed by Hyukwoo Park
commit caa0fbc3fe
32 changed files with 1020 additions and 394 deletions

View file

@ -404,13 +404,21 @@ bool ArrayObject::setArrayLength(ExecutionState& state, const uint32_t newLength
rd->m_arrayObjectFastModeBufferCapacity = 0;
}
} else {
const size_t minExpandCountForUsingLog2Function = 3;
auto rd = rareData();
size_t oldCapacity = rd ? (size_t)rd->m_arrayObjectFastModeBufferCapacity : oldLength;
if (newLength) {
rd = ensureObjectRareData();
if (newLength > oldCapacity) {
ComputeReservedCapacityFunctionWithPercent<133> f;
size_t newCapacity = f(newLength);
size_t newCapacity;
if (rd->m_arrayObjectFastModeBufferExpandCount >= minExpandCountForUsingLog2Function) {
ComputeReservedCapacityFunctionWithLog2<> f;
newCapacity = f(newLength);
} else {
ComputeReservedCapacityFunctionWithPercent<130> f;
newCapacity = f(newLength);
}
auto newFastModeData = (SmallValue*)GC_MALLOC(sizeof(SmallValue) * newCapacity);
memcpy(newFastModeData, m_fastModeData, sizeof(SmallValue) * oldLength);
GC_FREE(m_fastModeData);
@ -420,12 +428,15 @@ bool ArrayObject::setArrayLength(ExecutionState& state, const uint32_t newLength
m_fastModeData[i] = SmallValue(SmallValue::EmptyValue);
}
ensureObjectRareData()->m_arrayObjectFastModeBufferCapacity = newCapacity;
rd->m_arrayObjectFastModeBufferCapacity = newCapacity;
if (rd->m_arrayObjectFastModeBufferExpandCount < minExpandCountForUsingLog2Function) {
rd->m_arrayObjectFastModeBufferExpandCount++;
}
} else {
for (size_t i = oldLength; i < newLength; i++) {
m_fastModeData[i] = SmallValue(SmallValue::EmptyValue);
}
ensureObjectRareData()->m_arrayObjectFastModeBufferCapacity = oldCapacity;
rd->m_arrayObjectFastModeBufferCapacity = oldCapacity;
}
} else {
GC_FREE(m_fastModeData);