OLD | NEW |
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 // TODO(mythria): Remove this define after this flag is turned on globally | 5 // TODO(mythria): Remove this define after this flag is turned on globally |
6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
7 | 7 |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "test/cctest/expression-type-collector-macros.h" | 21 #include "test/cctest/expression-type-collector-macros.h" |
22 | 22 |
23 #define INT32_TYPE Bounds(Type::Signed32(), Type::Signed32()) | 23 #define INT32_TYPE Bounds(Type::Signed32(), Type::Signed32()) |
24 | 24 |
25 using namespace v8::internal; | 25 using namespace v8::internal; |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 class TypeSetter : public AstExpressionVisitor { | 29 class TypeSetter : public AstExpressionVisitor { |
30 public: | 30 public: |
31 TypeSetter(Isolate* isolate, Zone* zone, FunctionLiteral* root) | 31 TypeSetter(Isolate* isolate, FunctionLiteral* root) |
32 : AstExpressionVisitor(isolate, zone, root) {} | 32 : AstExpressionVisitor(isolate, root) {} |
33 | 33 |
34 protected: | 34 protected: |
35 void VisitExpression(Expression* expression) { | 35 void VisitExpression(Expression* expression) { |
36 expression->set_bounds(INT32_TYPE); | 36 expression->set_bounds(INT32_TYPE); |
37 } | 37 } |
38 }; | 38 }; |
39 | 39 |
40 | 40 |
41 void CheckAllSame(ZoneVector<ExpressionTypeEntry>& types, | 41 void CheckAllSame(ZoneVector<ExpressionTypeEntry>& types, |
42 Bounds expected_type) { | 42 Bounds expected_type) { |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 info.set_lazy(false); | 279 info.set_lazy(false); |
280 info.set_allow_lazy_parsing(false); | 280 info.set_allow_lazy_parsing(false); |
281 info.set_toplevel(true); | 281 info.set_toplevel(true); |
282 | 282 |
283 CHECK(i::Compiler::ParseAndAnalyze(&info)); | 283 CHECK(i::Compiler::ParseAndAnalyze(&info)); |
284 FunctionLiteral* root = | 284 FunctionLiteral* root = |
285 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); | 285 info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); |
286 | 286 |
287 // Core of the test. | 287 // Core of the test. |
288 ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); | 288 ZoneVector<ExpressionTypeEntry> types(handles.main_zone()); |
289 ExpressionTypeCollector(isolate, handles.main_zone(), root, &types).Run(); | 289 ExpressionTypeCollector(isolate, root, &types).Run(); |
290 CheckAllSame(types, Bounds::Unbounded()); | 290 CheckAllSame(types, Bounds::Unbounded()); |
291 | 291 |
292 TypeSetter(isolate, handles.main_zone(), root).Run(); | 292 TypeSetter(isolate, root).Run(); |
293 | 293 |
294 ExpressionTypeCollector(isolate, handles.main_zone(), root, &types).Run(); | 294 ExpressionTypeCollector(isolate, root, &types).Run(); |
295 CheckAllSame(types, INT32_TYPE); | 295 CheckAllSame(types, INT32_TYPE); |
296 | 296 |
297 TypingReseter(isolate, handles.main_zone(), root).Run(); | 297 TypingReseter(isolate, root).Run(); |
298 | 298 |
299 ExpressionTypeCollector(isolate, handles.main_zone(), root, &types).Run(); | 299 ExpressionTypeCollector(isolate, root, &types).Run(); |
300 CheckAllSame(types, Bounds::Unbounded()); | 300 CheckAllSame(types, Bounds::Unbounded()); |
301 } | 301 } |
OLD | NEW |