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

@ -0,0 +1,51 @@
/*
* Copyright (c) 2019-present Samsung Electronics Co., Ltd
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*/
#ifndef __EscargotScriptClassMethodFunctionObject__
#define __EscargotScriptClassMethodFunctionObject__
#include "runtime/ScriptFunctionObject.h"
namespace Escargot {
// {method, get, set} of object literal also uses this class
class ScriptClassMethodFunctionObject : public ScriptFunctionObject {
public:
ScriptClassMethodFunctionObject(ExecutionState& state, CodeBlock* codeBlock, LexicalEnvironment* outerEnvironment, Object* homeObject)
: ScriptFunctionObject(state, codeBlock, outerEnvironment, false, codeBlock->isGenerator())
, m_homeObject(homeObject)
{
}
bool isConstructor() const
{
return false;
}
virtual Object* homeObject() override
{
return m_homeObject;
}
private:
Object* m_homeObject;
};
}
#endif