| 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/compiler.h" | 6 #include "src/compiler.h" |
| 7 #include "src/parser.h" | 7 #include "src/parser.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 std::pair<IterationStatement*, BitVector*>(loop, bits)); | 48 std::pair<IterationStatement*, BitVector*>(loop, bits)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 // --------------------------------------------------------------------------- | 52 // --------------------------------------------------------------------------- |
| 53 // -- Leaf nodes ------------------------------------------------------------- | 53 // -- Leaf nodes ------------------------------------------------------------- |
| 54 // --------------------------------------------------------------------------- | 54 // --------------------------------------------------------------------------- |
| 55 | 55 |
| 56 void ALAA::VisitVariableDeclaration(VariableDeclaration* leaf) {} | 56 void ALAA::VisitVariableDeclaration(VariableDeclaration* leaf) {} |
| 57 void ALAA::VisitFunctionDeclaration(FunctionDeclaration* leaf) {} | 57 void ALAA::VisitFunctionDeclaration(FunctionDeclaration* leaf) {} |
| 58 void ALAA::VisitModuleDeclaration(ModuleDeclaration* leaf) {} | |
| 59 void ALAA::VisitImportDeclaration(ImportDeclaration* leaf) {} | 58 void ALAA::VisitImportDeclaration(ImportDeclaration* leaf) {} |
| 60 void ALAA::VisitExportDeclaration(ExportDeclaration* leaf) {} | 59 void ALAA::VisitExportDeclaration(ExportDeclaration* leaf) {} |
| 61 void ALAA::VisitModulePath(ModulePath* leaf) {} | |
| 62 void ALAA::VisitModuleUrl(ModuleUrl* leaf) {} | |
| 63 void ALAA::VisitEmptyStatement(EmptyStatement* leaf) {} | 60 void ALAA::VisitEmptyStatement(EmptyStatement* leaf) {} |
| 64 void ALAA::VisitContinueStatement(ContinueStatement* leaf) {} | 61 void ALAA::VisitContinueStatement(ContinueStatement* leaf) {} |
| 65 void ALAA::VisitBreakStatement(BreakStatement* leaf) {} | 62 void ALAA::VisitBreakStatement(BreakStatement* leaf) {} |
| 66 void ALAA::VisitDebuggerStatement(DebuggerStatement* leaf) {} | 63 void ALAA::VisitDebuggerStatement(DebuggerStatement* leaf) {} |
| 67 void ALAA::VisitFunctionLiteral(FunctionLiteral* leaf) {} | 64 void ALAA::VisitFunctionLiteral(FunctionLiteral* leaf) {} |
| 68 void ALAA::VisitNativeFunctionLiteral(NativeFunctionLiteral* leaf) {} | 65 void ALAA::VisitNativeFunctionLiteral(NativeFunctionLiteral* leaf) {} |
| 69 void ALAA::VisitVariableProxy(VariableProxy* leaf) {} | 66 void ALAA::VisitVariableProxy(VariableProxy* leaf) {} |
| 70 void ALAA::VisitLiteral(Literal* leaf) {} | 67 void ALAA::VisitLiteral(Literal* leaf) {} |
| 71 void ALAA::VisitRegExpLiteral(RegExpLiteral* leaf) {} | 68 void ALAA::VisitRegExpLiteral(RegExpLiteral* leaf) {} |
| 72 void ALAA::VisitThisFunction(ThisFunction* leaf) {} | 69 void ALAA::VisitThisFunction(ThisFunction* leaf) {} |
| 73 void ALAA::VisitSuperReference(SuperReference* leaf) {} | 70 void ALAA::VisitSuperReference(SuperReference* leaf) {} |
| 74 | 71 |
| 75 | 72 |
| 76 // --------------------------------------------------------------------------- | 73 // --------------------------------------------------------------------------- |
| 77 // -- Pass-through nodes------------------------------------------------------ | 74 // -- Pass-through nodes------------------------------------------------------ |
| 78 // --------------------------------------------------------------------------- | 75 // --------------------------------------------------------------------------- |
| 79 void ALAA::VisitModuleLiteral(ModuleLiteral* e) { Visit(e->body()); } | |
| 80 | |
| 81 | |
| 82 void ALAA::VisitBlock(Block* stmt) { VisitStatements(stmt->statements()); } | 76 void ALAA::VisitBlock(Block* stmt) { VisitStatements(stmt->statements()); } |
| 83 | 77 |
| 84 | 78 |
| 85 void ALAA::VisitExpressionStatement(ExpressionStatement* stmt) { | 79 void ALAA::VisitExpressionStatement(ExpressionStatement* stmt) { |
| 86 Visit(stmt->expression()); | 80 Visit(stmt->expression()); |
| 87 } | 81 } |
| 88 | 82 |
| 89 | 83 |
| 90 void ALAA::VisitIfStatement(IfStatement* stmt) { | 84 void ALAA::VisitIfStatement(IfStatement* stmt) { |
| 91 Visit(stmt->condition()); | 85 Visit(stmt->condition()); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 194 |
| 201 void ALAA::VisitCaseClause(CaseClause* cc) { | 195 void ALAA::VisitCaseClause(CaseClause* cc) { |
| 202 if (!cc->is_default()) Visit(cc->label()); | 196 if (!cc->is_default()) Visit(cc->label()); |
| 203 VisitStatements(cc->statements()); | 197 VisitStatements(cc->statements()); |
| 204 } | 198 } |
| 205 | 199 |
| 206 | 200 |
| 207 // --------------------------------------------------------------------------- | 201 // --------------------------------------------------------------------------- |
| 208 // -- Interesting nodes------------------------------------------------------- | 202 // -- Interesting nodes------------------------------------------------------- |
| 209 // --------------------------------------------------------------------------- | 203 // --------------------------------------------------------------------------- |
| 210 void ALAA::VisitModuleStatement(ModuleStatement* stmt) { | |
| 211 // TODO(turbofan): can a module appear in a loop? | |
| 212 Visit(stmt->body()); | |
| 213 } | |
| 214 | |
| 215 | |
| 216 void ALAA::VisitTryCatchStatement(TryCatchStatement* stmt) { | 204 void ALAA::VisitTryCatchStatement(TryCatchStatement* stmt) { |
| 217 Visit(stmt->try_block()); | 205 Visit(stmt->try_block()); |
| 218 Visit(stmt->catch_block()); | 206 Visit(stmt->catch_block()); |
| 219 // TODO(turbofan): are catch variables well-scoped? | 207 // TODO(turbofan): are catch variables well-scoped? |
| 220 AnalyzeAssignment(stmt->variable()); | 208 AnalyzeAssignment(stmt->variable()); |
| 221 } | 209 } |
| 222 | 210 |
| 223 | 211 |
| 224 void ALAA::VisitDoWhileStatement(DoWhileStatement* loop) { | 212 void ALAA::VisitDoWhileStatement(DoWhileStatement* loop) { |
| 225 Enter(loop); | 213 Enter(loop); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 int count = 0; | 288 int count = 0; |
| 301 int var_index = AstLoopAssignmentAnalyzer::GetVariableIndex(scope, var); | 289 int var_index = AstLoopAssignmentAnalyzer::GetVariableIndex(scope, var); |
| 302 for (size_t i = 0; i < list_.size(); i++) { | 290 for (size_t i = 0; i < list_.size(); i++) { |
| 303 if (list_[i].second->Contains(var_index)) count++; | 291 if (list_[i].second->Contains(var_index)) count++; |
| 304 } | 292 } |
| 305 return count; | 293 return count; |
| 306 } | 294 } |
| 307 } | 295 } |
| 308 } | 296 } |
| 309 } // namespace v8::internal::compiler | 297 } // namespace v8::internal::compiler |
| OLD | NEW |