Revise function call processes (#347)

* Revise [[call]], [[construct]] as described in spec
* Remove m_homeObject in FunctionObject.
* Implement ScriptClass{Constructor, Method}FunctionObject
    this subclass is used for saving [[homeObject]] and implement [[call]], [[consturct]]
* Add more(NewTargetBinder, ReturnValueBinder) into FunctionObjectProcessCallGenerator
* Remove feCounter in ByteCodeGenerationProcess. in ES6, function expression order & evaluation order can differ
* Add CallSuper ByteCode for interpret `super()` in class constructor
* Remove isOngoingSuperCall in ExecutionState
* Remove BuiltinFunctionObject. that was unnecessary

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
Patrick Kim 2019-08-06 09:58:06 +09:00 committed by Boram Bae
commit 43f442c560
71 changed files with 1371 additions and 948 deletions

View file

@ -72,7 +72,6 @@ InterpretedCodeBlock* ScriptParser::generateCodeBlockTreeFromASTWalker(Context*
}
AtomicString arguments = ctx->staticStrings().arguments;
AtomicString stringThis = ctx->staticStrings().stringThis;
for (size_t i = 0; i < scopeCtx->m_childBlockScopes.size(); i++) {
for (size_t j = 0; j < scopeCtx->m_childBlockScopes[i]->m_usingNames.size(); j++) {
@ -100,14 +99,6 @@ InterpretedCodeBlock* ScriptParser::generateCodeBlockTreeFromASTWalker(Context*
}
}
}
} else if (uname == stringThis) {
ASSERT(codeBlock->isArrowFunctionExpression());
if (!codeBlock->parentCodeBlock()->isGlobalScopeCodeBlock()) {
codeBlock->parentCodeBlock()->captureThis();
codeBlock->setNeedToLoadThisValue();
codeBlock->markHeapAllocatedEnvironmentFromHere();
}
continue;
}
bool usingNameIsResolvedOnCompileTime = false;
@ -196,6 +187,8 @@ void ScriptParser::generateProgramCodeBlock(ExecutionState& state, StringView sc
programNode->scopeContext()->m_hasYield = parentCodeBlock->hasYield();
programNode->scopeContext()->m_isClassConstructor = parentCodeBlock->isClassConstructor();
programNode->scopeContext()->m_isDerivedClassConstructor = parentCodeBlock->isDerivedClassConstructor();
programNode->scopeContext()->m_isClassMethod = parentCodeBlock->isClassMethod();
programNode->scopeContext()->m_isClassStaticMethod = parentCodeBlock->isClassStaticMethod();
topCodeBlock = generateCodeBlockTreeFromASTWalker(m_context, scriptSource, script, programNode->scopeContext(), parentCodeBlock, isEvalMode, isEvalCodeInFunction);
} else {
topCodeBlock = generateCodeBlockTreeFromAST(m_context, scriptSource, script, programNode.get(), isEvalMode, isEvalCodeInFunction);