mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
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:
parent
47bf20782e
commit
caa0fbc3fe
32 changed files with 1020 additions and 394 deletions
|
|
@ -170,12 +170,19 @@ static OptionalRef<StringRef> builtinHelperFileRead(OptionalRef<ExecutionStateRe
|
|||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
#if defined(ENABLE_SOURCE_COMPRESSION)
|
||||
if (hasNonLatin1Content) {
|
||||
src = StringRef::createFromUTF8ToCompressibleString(utf8Str.data(), utf8Str.length());
|
||||
#if defined(ENABLE_COMPRESSIBLE_STRING)
|
||||
if (state) {
|
||||
if (hasNonLatin1Content) {
|
||||
src = StringRef::createFromUTF8ToCompressibleString(state->context(), utf8Str.data(), utf8Str.length());
|
||||
} else {
|
||||
src = StringRef::createFromLatin1ToCompressibleString(state->context(), str.data(), str.length());
|
||||
}
|
||||
} else {
|
||||
src = StringRef::createCompressibleString(str.data(), str.length());
|
||||
if (hasNonLatin1Content) {
|
||||
src = StringRef::createFromUTF8(utf8Str.data(), utf8Str.length());
|
||||
} else {
|
||||
src = StringRef::createFromLatin1(str.data(), str.length());
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (hasNonLatin1Content) {
|
||||
|
|
@ -543,6 +550,11 @@ int main(int argc, char* argv[])
|
|||
});
|
||||
PersistentRefHolder<ContextRef> context = createEscargotContext(instance.get());
|
||||
|
||||
if (getenv("GC_FREE_SPACE_DIVISOR") && strlen(getenv("GC_FREE_SPACE_DIVISOR"))) {
|
||||
int d = atoi(getenv("GC_FREE_SPACE_DIVISOR"));
|
||||
Memory::setGCFrequency(d);
|
||||
}
|
||||
|
||||
bool runShell = true;
|
||||
bool seenModule = false;
|
||||
for (int i = 1; i < argc; i++) {
|
||||
|
|
@ -579,7 +591,11 @@ int main(int argc, char* argv[])
|
|||
fclose(fp);
|
||||
runShell = false;
|
||||
|
||||
StringRef* src = builtinHelperFileRead(nullptr, argv[i], "read").get();
|
||||
StringRef* src = Evaluator::execute(context, [](ExecutionStateRef* state, char* c) -> ValueRef* {
|
||||
return builtinHelperFileRead(state, c, "read").get();
|
||||
},
|
||||
argv[i])
|
||||
.result->asString();
|
||||
|
||||
if (!evalScript(context, src, StringRef::createFromUTF8(argv[i], strlen(argv[i])), false, seenModule)) {
|
||||
return 3;
|
||||
|
|
@ -592,11 +608,6 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (getenv("GC_FREE_SPACE_DIVISOR") && strlen(getenv("GC_FREE_SPACE_DIVISOR"))) {
|
||||
int d = atoi(getenv("GC_FREE_SPACE_DIVISOR"));
|
||||
Memory::setGCFrequency(d);
|
||||
}
|
||||
|
||||
while (runShell) {
|
||||
static char buf[2048];
|
||||
printf("escargot> ");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue