Update Stack Overflow checker and disabler

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
This commit is contained in:
HyukWoo Park 2023-04-08 14:57:23 +09:00 committed by Patrick Kim
commit c8cc70d83e
16 changed files with 160 additions and 83 deletions

View file

@ -44,13 +44,7 @@ protected:
virtual Value call(ExecutionState& state, const Value& thisValue, const size_t argc, Value* argv) override
{
#ifdef STACK_GROWS_DOWN
if (UNLIKELY(state.stackLimit() > (size_t)currentStackPointer())) {
#else
if (UNLIKELY(state.stackLimit() < (size_t)currentStackPointer())) {
#endif
ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, "Maximum call stack size exceeded");
}
CHECK_STACK_OVERFLOW(state);
ASSERT(codeBlock()->isInterpretedCodeBlock());
InterpretedCodeBlock* codeBlock = interpretedCodeBlock();
@ -114,13 +108,7 @@ protected:
// Let kind be Fs [[ConstructorKind]] internal slot.
ASSERT(constructorKind() == ConstructorKind::Base); // this is always `Base` because we define ScriptClassConsturctor::construct
#ifdef STACK_GROWS_DOWN
if (UNLIKELY(state.stackLimit() > (size_t)currentStackPointer())) {
#else
if (UNLIKELY(state.stackLimit() < (size_t)currentStackPointer())) {
#endif
ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, "Maximum call stack size exceeded");
}
CHECK_STACK_OVERFLOW(state);
// Let thisArgument be ? OrdinaryCreateFromConstructor(newTarget, "%ObjectPrototype%").
Object* proto = Object::getPrototypeFromConstructor(state, newTarget, [](ExecutionState& state, Context* constructorRealm) -> Object* {