Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: test/cctest/test-typing-reset.cc

Issue 1318823010: Eliminate use of CompilationInfo in several AstVisitor descendants. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: revised Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/test-ast-expression-visitor.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/ast-expression-visitor.h" 10 #include "src/ast-expression-visitor.h"
11 #include "src/parser.h" 11 #include "src/parser.h"
12 #include "src/rewriter.h" 12 #include "src/rewriter.h"
13 #include "src/scopes.h" 13 #include "src/scopes.h"
14 #include "src/typing-reset.h" 14 #include "src/typing-reset.h"
15 #include "test/cctest/cctest.h" 15 #include "test/cctest/cctest.h"
16 #include "test/cctest/compiler/function-tester.h" 16 #include "test/cctest/compiler/function-tester.h"
17 #include "test/cctest/expression-type-collector.h" 17 #include "test/cctest/expression-type-collector.h"
18 #include "test/cctest/expression-type-collector-macros.h" 18 #include "test/cctest/expression-type-collector-macros.h"
19 19
20 #define INT32_TYPE Bounds(Type::Signed32(), Type::Signed32()) 20 #define INT32_TYPE Bounds(Type::Signed32(), Type::Signed32())
21 21
22 using namespace v8::internal; 22 using namespace v8::internal;
23 23
24 namespace { 24 namespace {
25 25
26 class TypeSetter : public AstExpressionVisitor { 26 class TypeSetter : public AstExpressionVisitor {
27 public: 27 public:
28 explicit TypeSetter(CompilationInfo* info) : AstExpressionVisitor(info) {} 28 TypeSetter(Isolate* isolate, Zone* zone, FunctionLiteral* root)
29 : AstExpressionVisitor(isolate, zone, root) {}
29 30
30 protected: 31 protected:
31 void VisitExpression(Expression* expression) { 32 void VisitExpression(Expression* expression) {
32 expression->set_bounds(INT32_TYPE); 33 expression->set_bounds(INT32_TYPE);
33 } 34 }
34 }; 35 };
35 36
36 37
37 void CheckAllSame(ZoneVector<ExpressionTypeEntry>& types, 38 void CheckAllSame(ZoneVector<ExpressionTypeEntry>& types,
38 Bounds expected_type) { 39 Bounds expected_type) {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 270
270 i::ParseInfo info(handles.main_zone(), script); 271 i::ParseInfo info(handles.main_zone(), script);
271 i::Parser parser(&info); 272 i::Parser parser(&info);
272 parser.set_allow_harmony_arrow_functions(true); 273 parser.set_allow_harmony_arrow_functions(true);
273 parser.set_allow_harmony_sloppy(true); 274 parser.set_allow_harmony_sloppy(true);
274 info.set_global(); 275 info.set_global();
275 info.set_lazy(false); 276 info.set_lazy(false);
276 info.set_allow_lazy_parsing(false); 277 info.set_allow_lazy_parsing(false);
277 info.set_toplevel(true); 278 info.set_toplevel(true);
278 279
279 i::CompilationInfo compilation_info(&info);
280 CHECK(i::Compiler::ParseAndAnalyze(&info)); 280 CHECK(i::Compiler::ParseAndAnalyze(&info));
281 info.set_literal( 281 FunctionLiteral* root =
282 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun()); 282 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun();
283 283
284 // Core of the test. 284 // Core of the test.
285 ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); 285 ZoneVector<ExpressionTypeEntry> types(handles.main_zone());
286 ExpressionTypeCollector(&compilation_info, &types).Run(); 286 ExpressionTypeCollector(isolate, handles.main_zone(), root, &types).Run();
287 CheckAllSame(types, Bounds::Unbounded()); 287 CheckAllSame(types, Bounds::Unbounded());
288 288
289 TypeSetter(&compilation_info).Run(); 289 TypeSetter(isolate, handles.main_zone(), root).Run();
290 290
291 ExpressionTypeCollector(&compilation_info, &types).Run(); 291 ExpressionTypeCollector(isolate, handles.main_zone(), root, &types).Run();
292 CheckAllSame(types, INT32_TYPE); 292 CheckAllSame(types, INT32_TYPE);
293 293
294 TypingReseter(&compilation_info).Run(); 294 TypingReseter(isolate, handles.main_zone(), root).Run();
295 295
296 ExpressionTypeCollector(&compilation_info, &types).Run(); 296 ExpressionTypeCollector(isolate, handles.main_zone(), root, &types).Run();
297 CheckAllSame(types, Bounds::Unbounded()); 297 CheckAllSame(types, Bounds::Unbounded());
298 } 298 }
OLDNEW
« no previous file with comments | « test/cctest/test-ast-expression-visitor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698