mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Refactoring source code (#356)
* Remove some unused function, variables * Remove LexicalEnvironment from NativeFunctionObject * Don't save stack-allocated LexicalEnvironment on ScriptFunctionObject. it may cause memory leak from stack * Don't store newTarget, ThisBinded value on FunctionEnvironmentRecord if possible(we don't need these values except class functions) Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
b516156eb7
commit
864973236d
28 changed files with 496 additions and 405 deletions
|
|
@ -122,10 +122,6 @@ Value NativeFunctionObject::processNativeFunctionCall(ExecutionState& state, con
|
|||
|
||||
CallNativeFunctionData* code = m_codeBlock->nativeFunctionData();
|
||||
|
||||
// TODO don't make LexicalEnvironment if possiable
|
||||
FunctionEnvironmentRecordSimple record(this, 0, nullptr);
|
||||
LexicalEnvironment env(&record, nullptr);
|
||||
|
||||
size_t len = m_codeBlock->parameterCount();
|
||||
if (argc < len) {
|
||||
Value* newArgv = (Value*)alloca(sizeof(Value) * len);
|
||||
|
|
@ -139,7 +135,7 @@ Value NativeFunctionObject::processNativeFunctionCall(ExecutionState& state, con
|
|||
}
|
||||
|
||||
Value receiver = receiverSrc;
|
||||
ExecutionState newState(ctx, &state, &env, isStrict, &receiver);
|
||||
ExecutionState newState(ctx, &state, nullptr, this, isStrict);
|
||||
|
||||
if (!isConstruct) {
|
||||
// prepare receiver
|
||||
|
|
@ -179,7 +175,7 @@ Value NativeFunctionObject::processNativeFunctionCall(ExecutionState& state, con
|
|||
}
|
||||
return result;
|
||||
} catch (const Value& v) {
|
||||
ByteCodeInterpreter::processException(newState, v, SIZE_MAX);
|
||||
ByteCodeInterpreter::processException(newState, v, m_codeBlock, SIZE_MAX);
|
||||
return Value();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue