OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/ast-loop-assignment-analyzer.h" | 5 #include "src/compiler/ast-loop-assignment-analyzer.h" |
6 #include "src/parser.h" | 6 #include "src/parser.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace compiler { | 10 namespace compiler { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 // --------------------------------------------------------------------------- | 51 // --------------------------------------------------------------------------- |
52 // -- Leaf nodes ------------------------------------------------------------- | 52 // -- Leaf nodes ------------------------------------------------------------- |
53 // --------------------------------------------------------------------------- | 53 // --------------------------------------------------------------------------- |
54 | 54 |
55 void ALAA::VisitVariableDeclaration(VariableDeclaration* leaf) {} | 55 void ALAA::VisitVariableDeclaration(VariableDeclaration* leaf) {} |
56 void ALAA::VisitFunctionDeclaration(FunctionDeclaration* leaf) {} | 56 void ALAA::VisitFunctionDeclaration(FunctionDeclaration* leaf) {} |
57 void ALAA::VisitModuleDeclaration(ModuleDeclaration* leaf) {} | 57 void ALAA::VisitModuleDeclaration(ModuleDeclaration* leaf) {} |
58 void ALAA::VisitImportDeclaration(ImportDeclaration* leaf) {} | 58 void ALAA::VisitImportDeclaration(ImportDeclaration* leaf) {} |
59 void ALAA::VisitExportDeclaration(ExportDeclaration* leaf) {} | 59 void ALAA::VisitExportDeclaration(ExportDeclaration* leaf) {} |
60 void ALAA::VisitModuleVariable(ModuleVariable* leaf) {} | |
61 void ALAA::VisitModulePath(ModulePath* leaf) {} | 60 void ALAA::VisitModulePath(ModulePath* leaf) {} |
62 void ALAA::VisitModuleUrl(ModuleUrl* leaf) {} | 61 void ALAA::VisitModuleUrl(ModuleUrl* leaf) {} |
63 void ALAA::VisitEmptyStatement(EmptyStatement* leaf) {} | 62 void ALAA::VisitEmptyStatement(EmptyStatement* leaf) {} |
64 void ALAA::VisitContinueStatement(ContinueStatement* leaf) {} | 63 void ALAA::VisitContinueStatement(ContinueStatement* leaf) {} |
65 void ALAA::VisitBreakStatement(BreakStatement* leaf) {} | 64 void ALAA::VisitBreakStatement(BreakStatement* leaf) {} |
66 void ALAA::VisitDebuggerStatement(DebuggerStatement* leaf) {} | 65 void ALAA::VisitDebuggerStatement(DebuggerStatement* leaf) {} |
67 void ALAA::VisitFunctionLiteral(FunctionLiteral* leaf) {} | 66 void ALAA::VisitFunctionLiteral(FunctionLiteral* leaf) {} |
68 void ALAA::VisitNativeFunctionLiteral(NativeFunctionLiteral* leaf) {} | 67 void ALAA::VisitNativeFunctionLiteral(NativeFunctionLiteral* leaf) {} |
69 void ALAA::VisitVariableProxy(VariableProxy* leaf) {} | 68 void ALAA::VisitVariableProxy(VariableProxy* leaf) {} |
70 void ALAA::VisitLiteral(Literal* leaf) {} | 69 void ALAA::VisitLiteral(Literal* leaf) {} |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 void ALAA::VisitCaseClause(CaseClause* cc) { | 197 void ALAA::VisitCaseClause(CaseClause* cc) { |
199 if (!cc->is_default()) Visit(cc->label()); | 198 if (!cc->is_default()) Visit(cc->label()); |
200 VisitStatements(cc->statements()); | 199 VisitStatements(cc->statements()); |
201 } | 200 } |
202 | 201 |
203 | 202 |
204 // --------------------------------------------------------------------------- | 203 // --------------------------------------------------------------------------- |
205 // -- Interesting nodes------------------------------------------------------- | 204 // -- Interesting nodes------------------------------------------------------- |
206 // --------------------------------------------------------------------------- | 205 // --------------------------------------------------------------------------- |
207 void ALAA::VisitModuleStatement(ModuleStatement* stmt) { | 206 void ALAA::VisitModuleStatement(ModuleStatement* stmt) { |
| 207 // TODO(turbofan): can a module appear in a loop? |
208 Visit(stmt->body()); | 208 Visit(stmt->body()); |
209 // TODO(turbofan): can a module appear in a loop? | |
210 AnalyzeAssignment(stmt->proxy()->var()); | |
211 } | 209 } |
212 | 210 |
213 | 211 |
214 void ALAA::VisitTryCatchStatement(TryCatchStatement* stmt) { | 212 void ALAA::VisitTryCatchStatement(TryCatchStatement* stmt) { |
215 Visit(stmt->try_block()); | 213 Visit(stmt->try_block()); |
216 Visit(stmt->catch_block()); | 214 Visit(stmt->catch_block()); |
217 // TODO(turbofan): are catch variables well-scoped? | 215 // TODO(turbofan): are catch variables well-scoped? |
218 AnalyzeAssignment(stmt->variable()); | 216 AnalyzeAssignment(stmt->variable()); |
219 } | 217 } |
220 | 218 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 int count = 0; | 296 int count = 0; |
299 int var_index = AstLoopAssignmentAnalyzer::GetVariableIndex(scope, var); | 297 int var_index = AstLoopAssignmentAnalyzer::GetVariableIndex(scope, var); |
300 for (size_t i = 0; i < list_.size(); i++) { | 298 for (size_t i = 0; i < list_.size(); i++) { |
301 if (list_[i].second->Contains(var_index)) count++; | 299 if (list_[i].second->Contains(var_index)) count++; |
302 } | 300 } |
303 return count; | 301 return count; |
304 } | 302 } |
305 } | 303 } |
306 } | 304 } |
307 } // namespace v8::internal::compiler | 305 } // namespace v8::internal::compiler |
OLD | NEW |