mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
1. do not ASTScopeContext explicitly. it is used by ByteCode-genaration
2. alloc esprima::Error as Non-GC type. - it can be thrown. but, bdwgc can not see try-catch variable area. 3. Use own context when eval, function are invoked. 4. implement fake-Realm class for v8 vender test Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
34dad07c79
commit
5d56fd2bb4
14 changed files with 77 additions and 25 deletions
|
|
@ -138,9 +138,21 @@ static Value builtinGc(ExecutionState& state, Value thisValue, size_t argc, Valu
|
|||
return Value();
|
||||
}
|
||||
|
||||
class EvalFunctionObject : public FunctionObject {
|
||||
public:
|
||||
EvalFunctionObject(ExecutionState& state, NativeFunctionInfo info)
|
||||
: FunctionObject(state, info)
|
||||
{
|
||||
m_globalObject = state.context()->globalObject();
|
||||
}
|
||||
|
||||
GlobalObject* m_globalObject;
|
||||
};
|
||||
|
||||
static Value builtinEval(ExecutionState& state, Value thisValue, size_t argc, Value* argv, bool isNewExpression)
|
||||
{
|
||||
return state.context()->globalObject()->eval(state, argv[0]);
|
||||
EvalFunctionObject* fn = (EvalFunctionObject*)state.executionContext()->resolveCallee();
|
||||
return fn->m_globalObject->eval(state, argv[0]);
|
||||
}
|
||||
|
||||
Value GlobalObject::eval(ExecutionState& state, const Value& arg)
|
||||
|
|
@ -165,7 +177,8 @@ Value GlobalObject::eval(ExecutionState& state, const Value& arg)
|
|||
}
|
||||
bool needNewEnv = parserResult.m_script->topCodeBlock()->isStrict();
|
||||
// In case of indirect call, use global execution context
|
||||
return parserResult.m_script->execute(state, true, needNewEnv, true);
|
||||
ExecutionState stateForNewGlobal(m_context);
|
||||
return parserResult.m_script->execute(stateForNewGlobal, true, needNewEnv, true);
|
||||
}
|
||||
return arg;
|
||||
}
|
||||
|
|
@ -804,8 +817,8 @@ void GlobalObject::installOthers(ExecutionState& state)
|
|||
defineOwnProperty(state, strings->undefined, ObjectPropertyDescriptor(Value(), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::ValuePresent)));
|
||||
|
||||
// $18.2.1 eval (x)
|
||||
m_eval = new FunctionObject(state,
|
||||
NativeFunctionInfo(strings->eval, builtinEval, 1, nullptr, NativeFunctionInfo::Strict));
|
||||
m_eval = new EvalFunctionObject(state,
|
||||
NativeFunctionInfo(strings->eval, builtinEval, 1, nullptr, NativeFunctionInfo::Strict));
|
||||
defineOwnProperty(state, ObjectPropertyName(strings->eval),
|
||||
ObjectPropertyDescriptor(m_eval, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent)));
|
||||
// $18.2.2 isFinite(number)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue