1. give limit to variable count & register count

2. expand register limit to uint16_t
3. introduce skip copying from stack allocated local variable to interpreter register file

Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
seonghyun kim 2017-02-18 00:52:48 +09:00
commit 76a249913a
68 changed files with 714 additions and 274 deletions

View file

@ -150,6 +150,14 @@ void ScriptParser::generateCodeBlockTreeFromASTWalkerPostProcess(CodeBlock* cb)
generateCodeBlockTreeFromASTWalkerPostProcess(cb->m_childBlocks[i]);
}
cb->computeVariables();
if (cb->m_identifierOnStackCount > VARIABLE_LIMIT) {
auto err = new esprima::Error(new ASCIIString("variable limit exceeded"));
err->errorCode = ErrorObject::SyntaxError;
err->lineNumber = cb->m_sourceElementStart.line;
err->column = cb->m_sourceElementStart.column;
err->index = cb->m_sourceElementStart.index;
throw err;
}
}
ScriptParser::ScriptParserResult ScriptParser::parse(StringView scriptSource, String* fileName, CodeBlock* parentCodeBlock, bool strictFromOutside)