Fix a bug in smi loop analysis.

Add a missing null check that can hit when the for-loop index is
not a variable.

Review URL: http://codereview.chromium.org/840002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4101 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ef371f3f
...@@ -1058,7 +1058,7 @@ Variable* AssignedVariablesAnalyzer::FindSmiLoopVariable(ForStatement* stmt) { ...@@ -1058,7 +1058,7 @@ Variable* AssignedVariablesAnalyzer::FindSmiLoopVariable(ForStatement* stmt) {
// We only deal with local variables. // We only deal with local variables.
Variable* loop_var = init->target()->AsVariableProxy()->AsVariable(); Variable* loop_var = init->target()->AsVariableProxy()->AsVariable();
if (!loop_var->IsStackAllocated()) return NULL; if (loop_var == NULL || !loop_var->IsStackAllocated()) return NULL;
// The initial value has to be a smi. // The initial value has to be a smi.
Literal* init_lit = init->value()->AsLiteral(); Literal* init_lit = init->value()->AsLiteral();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment