Reduce memory allocation during bytecode generation

* ByteCodeBlock does not hold location data info anymore
* location data of each bytecode is manually allocated only for stack-tracing or debugger mode
* duplicated String allocation for source code is removed

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
HyukWoo Park 2020-08-03 17:19:29 +09:00 committed by Boram Bae
commit f56a557ff5
22 changed files with 277 additions and 186 deletions

View file

@ -563,13 +563,13 @@ public:
}
};
static bool evalScript(ContextRef* context, StringRef* str, StringRef* srcName, bool shouldPrintScriptResult, bool isModule)
static bool evalScript(ContextRef* context, StringRef* source, StringRef* srcName, bool shouldPrintScriptResult, bool isModule)
{
if (stringEndsWith(srcName->toStdUTF8String(), "mjs")) {
isModule = isModule || true;
}
auto scriptInitializeResult = context->scriptParser()->initializeScript(str, srcName, isModule);
auto scriptInitializeResult = context->scriptParser()->initializeScript(source, srcName, isModule);
if (!scriptInitializeResult.script) {
fprintf(stderr, "Script parsing error: ");
switch (scriptInitializeResult.parseErrorCode) {