| 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/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
| 6 #include "src/compiler.h" | 6 #include "src/compiler.h" |
| 7 #include "src/compiler/ast-loop-assignment-analyzer.h" | 7 #include "src/compiler/ast-loop-assignment-analyzer.h" |
| 8 #include "src/parsing/parse-info.h" | 8 #include "src/parsing/parse-info.h" |
| 9 #include "src/parsing/parser.h" | 9 #include "src/parsing/parser.h" |
| 10 #include "src/parsing/rewriter.h" | 10 #include "src/parsing/rewriter.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 function = Handle<JSFunction>::cast(obj); | 30 function = Handle<JSFunction>::cast(obj); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void CheckLoopAssignedCount(int expected, const char* var_name) { | 33 void CheckLoopAssignedCount(int expected, const char* var_name) { |
| 34 // TODO(titzer): don't scope analyze every single time. | 34 // TODO(titzer): don't scope analyze every single time. |
| 35 ParseInfo parse_info(main_zone(), function); | 35 ParseInfo parse_info(main_zone(), function); |
| 36 CompilationInfo info(&parse_info, function); | 36 CompilationInfo info(&parse_info, function); |
| 37 | 37 |
| 38 CHECK(Parser::ParseStatic(&parse_info)); | 38 CHECK(Parser::ParseStatic(&parse_info)); |
| 39 CHECK(Rewriter::Rewrite(&parse_info)); | 39 CHECK(Rewriter::Rewrite(&parse_info)); |
| 40 Scope::Analyze(&parse_info); | 40 DeclarationScope::Analyze(&parse_info); |
| 41 | 41 |
| 42 DeclarationScope* scope = info.literal()->scope(); | 42 DeclarationScope* scope = info.literal()->scope(); |
| 43 AstValueFactory* factory = parse_info.ast_value_factory(); | 43 AstValueFactory* factory = parse_info.ast_value_factory(); |
| 44 CHECK(scope); | 44 CHECK(scope); |
| 45 | 45 |
| 46 if (result == NULL) { | 46 if (result == NULL) { |
| 47 AstLoopAssignmentAnalyzer analyzer(main_zone(), &info); | 47 AstLoopAssignmentAnalyzer analyzer(main_zone(), &info); |
| 48 result = analyzer.Analyze(); | 48 result = analyzer.Analyze(); |
| 49 CHECK(result); | 49 CHECK(result); |
| 50 } | 50 } |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 293 |
| 294 f.CheckLoopAssignedCount(1, "x"); | 294 f.CheckLoopAssignedCount(1, "x"); |
| 295 f.CheckLoopAssignedCount(3, "y"); | 295 f.CheckLoopAssignedCount(3, "y"); |
| 296 f.CheckLoopAssignedCount(5, "z"); | 296 f.CheckLoopAssignedCount(5, "z"); |
| 297 f.CheckLoopAssignedCount(0, "w"); | 297 f.CheckLoopAssignedCount(0, "w"); |
| 298 } | 298 } |
| 299 | 299 |
| 300 } // namespace compiler | 300 } // namespace compiler |
| 301 } // namespace internal | 301 } // namespace internal |
| 302 } // namespace v8 | 302 } // namespace v8 |
| OLD | NEW |