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