mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
Optimize ScriptParser more (#70)
* Diet ScannerResult * Use SourceStringView if possible for reducing memory usage Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
8b72e1eb37
commit
ef57dc3400
13 changed files with 399 additions and 117 deletions
|
|
@ -415,7 +415,7 @@ ArrayObject* RegExpObject::createMatchedArray(ExecutionState& state, String* str
|
|||
size_t len = result.m_matchResults.size();
|
||||
ret->setThrowsException(state, state.context()->staticStrings().length, Value(len), ret);
|
||||
for (size_t idx = 0; idx < len; idx++) {
|
||||
ret->defineOwnProperty(state, ObjectPropertyName(state, Value(idx)), ObjectPropertyDescriptor(Value(StringView::createStringView(str, result.m_matchResults[idx][0].m_start, result.m_matchResults[idx][0].m_end)), ObjectPropertyDescriptor::AllPresent));
|
||||
ret->defineOwnProperty(state, ObjectPropertyName(state, Value(idx)), ObjectPropertyDescriptor(Value(new StringView(str, result.m_matchResults[idx][0].m_start, result.m_matchResults[idx][0].m_end)), ObjectPropertyDescriptor::AllPresent));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -433,7 +433,7 @@ ArrayObject* RegExpObject::createRegExpMatchedArray(ExecutionState& state, const
|
|||
if (result.m_matchResults[i][j].m_start == std::numeric_limits<unsigned>::max()) {
|
||||
arr->defineOwnPropertyThrowsException(state, ObjectPropertyName(state, Value(idx++)), ObjectPropertyDescriptor(Value(), ObjectPropertyDescriptor::AllPresent));
|
||||
} else {
|
||||
arr->defineOwnPropertyThrowsException(state, ObjectPropertyName(state, Value(idx++)), ObjectPropertyDescriptor(Value(StringView::createStringView(input, result.m_matchResults[i][j].m_start, result.m_matchResults[i][j].m_end)), ObjectPropertyDescriptor::AllPresent));
|
||||
arr->defineOwnPropertyThrowsException(state, ObjectPropertyName(state, Value(idx++)), ObjectPropertyDescriptor(Value(new StringView(input, result.m_matchResults[i][j].m_start, result.m_matchResults[i][j].m_end)), ObjectPropertyDescriptor::AllPresent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue