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

Side by Side Diff: test/cctest/expression-type-collector.cc

Issue 1968383002: Remove Expression::bounds_, in order to conserve memory during parsing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove Expression::bounds_ Created 4 years, 7 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
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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "test/cctest/expression-type-collector.h" 7 #include "test/cctest/expression-type-collector.h"
8 8
9 #include "src/ast/ast-type-bounds.h"
9 #include "src/ast/ast.h" 10 #include "src/ast/ast.h"
10 #include "src/ast/scopes.h" 11 #include "src/ast/scopes.h"
11 #include "src/codegen.h" 12 #include "src/codegen.h"
12 13
13 namespace v8 { 14 namespace v8 {
14 namespace internal { 15 namespace internal {
15 namespace { 16 namespace {
16 17
17 struct { 18 struct {
18 AstNode::NodeType type; 19 AstNode::NodeType type;
19 const char* name; 20 const char* name;
20 } NodeTypeNameList[] = { 21 } NodeTypeNameList[] = {
21 #define DECLARE_VISIT(type) \ 22 #define DECLARE_VISIT(type) \
22 { AstNode::k##type, #type } \ 23 { AstNode::k##type, #type } \
23 , 24 ,
24 AST_NODE_LIST(DECLARE_VISIT) 25 AST_NODE_LIST(DECLARE_VISIT)
25 #undef DECLARE_VISIT 26 #undef DECLARE_VISIT
26 }; 27 };
27 28
28 } // namespace 29 } // namespace
29 30
30
31 ExpressionTypeCollector::ExpressionTypeCollector( 31 ExpressionTypeCollector::ExpressionTypeCollector(
32 Isolate* isolate, FunctionLiteral* root, 32 Isolate* isolate, FunctionLiteral* root, const AstTypeBounds* bounds,
33 ZoneVector<ExpressionTypeEntry>* dst) 33 ZoneVector<ExpressionTypeEntry>* dst)
34 : AstExpressionVisitor(isolate, root), result_(dst) {} 34 : AstExpressionVisitor(isolate, root), bounds_(bounds), result_(dst) {}
35
36 35
37 void ExpressionTypeCollector::Run() { 36 void ExpressionTypeCollector::Run() {
38 result_->clear(); 37 result_->clear();
39 AstExpressionVisitor::Run(); 38 AstExpressionVisitor::Run();
40 } 39 }
41 40
42 41
43 void ExpressionTypeCollector::VisitExpression(Expression* expression) { 42 void ExpressionTypeCollector::VisitExpression(Expression* expression) {
44 ExpressionTypeEntry e; 43 ExpressionTypeEntry e;
45 e.depth = depth(); 44 e.depth = depth();
46 VariableProxy* proxy = expression->AsVariableProxy(); 45 VariableProxy* proxy = expression->AsVariableProxy();
47 if (proxy) { 46 if (proxy) {
48 e.name = proxy->raw_name(); 47 e.name = proxy->raw_name();
49 } 48 }
50 e.bounds = expression->bounds(); 49 e.bounds = bounds_->get(expression);
51 AstNode::NodeType type = expression->node_type(); 50 AstNode::NodeType type = expression->node_type();
52 e.kind = "unknown"; 51 e.kind = "unknown";
53 for (size_t i = 0; i < arraysize(NodeTypeNameList); ++i) { 52 for (size_t i = 0; i < arraysize(NodeTypeNameList); ++i) {
54 if (NodeTypeNameList[i].type == type) { 53 if (NodeTypeNameList[i].type == type) {
55 e.kind = NodeTypeNameList[i].name; 54 e.kind = NodeTypeNameList[i].name;
56 break; 55 break;
57 } 56 }
58 } 57 }
59 result_->push_back(e); 58 result_->push_back(e);
60 } 59 }
61 60
62 } // namespace internal 61 } // namespace internal
63 } // namespace v8 62 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698