Update function name & init member variables in debug mode

Signed-off-by: Seonghyun Kim <sh8281.kim@samsung.com>
This commit is contained in:
Seonghyun Kim 2022-04-29 12:52:46 +09:00 committed by Boram Bae
commit 3d7bbe9c6a
3 changed files with 15 additions and 8 deletions

View file

@ -506,18 +506,18 @@ void RegExpObject::pushBackToRegExpMatchedArray(ExecutionState& state, ArrayObje
}
}
bool RegExpObject::isRegExpObjectDontHaveAnyOwnPropertyWhichHasDefinedFromRegExpPrototype(ExecutionState& state, Object* obj)
bool RegExpObject::hasOwnRegExpProperty(ExecutionState& state, Object* obj)
{
if (obj->isRegExpObject() && !obj->asRegExpObject()->m_hasOwnPropertyWhichHasDefinedFromRegExpPrototype
&& obj->getPrototypeObject(state) && obj->getPrototypeObject(state)->isRegExpPrototypeObject()) {
return true;
return false;
}
return false;
return true;
}
String* RegExpObject::regexpSourceValue(ExecutionState& state, Object* obj)
{
if (isRegExpObjectDontHaveAnyOwnPropertyWhichHasDefinedFromRegExpPrototype(state, obj)) {
if (!hasOwnRegExpProperty(state, obj)) {
return obj->asRegExpObject()->source();
} else {
return obj->get(state, state.context()->staticStrings().source).value(state, obj).toString(state);
@ -526,7 +526,7 @@ String* RegExpObject::regexpSourceValue(ExecutionState& state, Object* obj)
Value RegExpObject::regexpFlagsValue(ExecutionState& state, Object* obj)
{
if (isRegExpObjectDontHaveAnyOwnPropertyWhichHasDefinedFromRegExpPrototype(state, obj)) {
if (!hasOwnRegExpProperty(state, obj)) {
return computeRegExpOptionString(state, obj);
} else {
return obj->get(state, state.context()->staticStrings().flags).value(state, obj);
@ -539,7 +539,7 @@ String* RegExpObject::computeRegExpOptionString(ExecutionState& state, Object* o
size_t flagsIdx = 0;
size_t cacheIndex = 0;
if (isRegExpObjectDontHaveAnyOwnPropertyWhichHasDefinedFromRegExpPrototype(state, obj)) {
if (!hasOwnRegExpProperty(state, obj)) {
auto opt = obj->asRegExpObject()->option();
if (opt & RegExpObject::Option::Global) {
flags[flagsIdx++] = 'g';

View file

@ -184,7 +184,9 @@ private:
void internalInit(ExecutionState& state, String* source, Option option = None);
static RegExpCacheEntry& getCacheEntryAndCompileIfNeeded(ExecutionState& state, String* source, const Option& option);
static bool isRegExpObjectDontHaveAnyOwnPropertyWhichHasDefinedFromRegExpPrototype(ExecutionState& state, Object* obj);
// has source, option...
static bool hasOwnRegExpProperty(ExecutionState& state, Object* obj);
Option parseOption(ExecutionState& state, String* optionString);

View file

@ -137,8 +137,13 @@ public:
struct DisjunctionContext {
DisjunctionContext()
#ifndef NDEBUG
: term(reinterpret_cast<ByteTerm*>(-1))
, matchBegin(-1)
, matchEnd(-1)
#endif
{
// member variables are inited later
// member variables will be inited in interpreter
}
void* operator new(size_t, void* where)