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

Side by Side Diff: src/ast-this-access-visitor.cc

Issue 919643008: Remove --experimental-classes flag and related dead code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « src/ast-this-access-visitor.h ('k') | src/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/ast-this-access-visitor.h"
6 #include "src/parser.h"
7
8 namespace v8 {
9 namespace internal {
10
11 typedef class AstThisAccessVisitor ATAV; // for code shortitude.
12
13 ATAV::AstThisAccessVisitor(Isolate* isolate, Zone* zone) : uses_this_(false) {
14 InitializeAstVisitor(isolate, zone);
15 }
16
17
18 void ATAV::VisitVariableProxy(VariableProxy* proxy) {
19 if (proxy->is_this()) {
20 uses_this_ = true;
21 }
22 }
23
24
25 void ATAV::VisitSuperReference(SuperReference* leaf) {
26 // disallow super.method() and super(...).
27 uses_this_ = true;
28 }
29
30
31 void ATAV::VisitCallNew(CallNew* e) {
32 // new super(..) does not use 'this'.
33 if (!e->expression()->IsSuperReference()) {
34 Visit(e->expression());
35 }
36 VisitExpressions(e->arguments());
37 }
38
39
40 // ---------------------------------------------------------------------------
41 // -- Leaf nodes -------------------------------------------------------------
42 // ---------------------------------------------------------------------------
43
44 void ATAV::VisitVariableDeclaration(VariableDeclaration* leaf) {}
45 void ATAV::VisitFunctionDeclaration(FunctionDeclaration* leaf) {}
46 void ATAV::VisitModuleDeclaration(ModuleDeclaration* leaf) {}
47 void ATAV::VisitImportDeclaration(ImportDeclaration* leaf) {}
48 void ATAV::VisitExportDeclaration(ExportDeclaration* leaf) {}
49 void ATAV::VisitModuleVariable(ModuleVariable* leaf) {}
50 void ATAV::VisitModulePath(ModulePath* leaf) {}
51 void ATAV::VisitModuleUrl(ModuleUrl* leaf) {}
52 void ATAV::VisitEmptyStatement(EmptyStatement* leaf) {}
53 void ATAV::VisitContinueStatement(ContinueStatement* leaf) {}
54 void ATAV::VisitBreakStatement(BreakStatement* leaf) {}
55 void ATAV::VisitDebuggerStatement(DebuggerStatement* leaf) {}
56 void ATAV::VisitFunctionLiteral(FunctionLiteral* leaf) {}
57 void ATAV::VisitNativeFunctionLiteral(NativeFunctionLiteral* leaf) {}
58 void ATAV::VisitLiteral(Literal* leaf) {}
59 void ATAV::VisitRegExpLiteral(RegExpLiteral* leaf) {}
60 void ATAV::VisitThisFunction(ThisFunction* leaf) {}
61
62 // ---------------------------------------------------------------------------
63 // -- Pass-through nodes------------------------------------------------------
64 // ---------------------------------------------------------------------------
65 void ATAV::VisitModuleLiteral(ModuleLiteral* e) { Visit(e->body()); }
66
67
68 void ATAV::VisitBlock(Block* stmt) { VisitStatements(stmt->statements()); }
69
70
71 void ATAV::VisitExpressionStatement(ExpressionStatement* stmt) {
72 Visit(stmt->expression());
73 }
74
75
76 void ATAV::VisitIfStatement(IfStatement* stmt) {
77 Visit(stmt->condition());
78 Visit(stmt->then_statement());
79 Visit(stmt->else_statement());
80 }
81
82
83 void ATAV::VisitReturnStatement(ReturnStatement* stmt) {
84 Visit(stmt->expression());
85 }
86
87
88 void ATAV::VisitWithStatement(WithStatement* stmt) {
89 Visit(stmt->expression());
90 Visit(stmt->statement());
91 }
92
93
94 void ATAV::VisitSwitchStatement(SwitchStatement* stmt) {
95 Visit(stmt->tag());
96 ZoneList<CaseClause*>* clauses = stmt->cases();
97 for (int i = 0; i < clauses->length(); i++) {
98 Visit(clauses->at(i));
99 }
100 }
101
102
103 void ATAV::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
104 Visit(stmt->try_block());
105 Visit(stmt->finally_block());
106 }
107
108
109 void ATAV::VisitClassLiteral(ClassLiteral* e) {
110 VisitIfNotNull(e->extends());
111 Visit(e->constructor());
112 ZoneList<ObjectLiteralProperty*>* properties = e->properties();
113 for (int i = 0; i < properties->length(); i++) {
114 Visit(properties->at(i)->value());
115 }
116 }
117
118
119 void ATAV::VisitConditional(Conditional* e) {
120 Visit(e->condition());
121 Visit(e->then_expression());
122 Visit(e->else_expression());
123 }
124
125
126 void ATAV::VisitObjectLiteral(ObjectLiteral* e) {
127 ZoneList<ObjectLiteralProperty*>* properties = e->properties();
128 for (int i = 0; i < properties->length(); i++) {
129 Visit(properties->at(i)->value());
130 }
131 }
132
133
134 void ATAV::VisitArrayLiteral(ArrayLiteral* e) { VisitExpressions(e->values()); }
135
136
137 void ATAV::VisitYield(Yield* stmt) {
138 Visit(stmt->generator_object());
139 Visit(stmt->expression());
140 }
141
142
143 void ATAV::VisitThrow(Throw* stmt) { Visit(stmt->exception()); }
144
145
146 void ATAV::VisitProperty(Property* e) {
147 Visit(e->obj());
148 Visit(e->key());
149 }
150
151
152 void ATAV::VisitCall(Call* e) {
153 Visit(e->expression());
154 VisitExpressions(e->arguments());
155 }
156
157
158 void ATAV::VisitCallRuntime(CallRuntime* e) {
159 VisitExpressions(e->arguments());
160 }
161
162
163 void ATAV::VisitUnaryOperation(UnaryOperation* e) { Visit(e->expression()); }
164
165
166 void ATAV::VisitBinaryOperation(BinaryOperation* e) {
167 Visit(e->left());
168 Visit(e->right());
169 }
170
171
172 void ATAV::VisitCompareOperation(CompareOperation* e) {
173 Visit(e->left());
174 Visit(e->right());
175 }
176
177
178 void ATAV::VisitCaseClause(CaseClause* cc) {
179 if (!cc->is_default()) Visit(cc->label());
180 VisitStatements(cc->statements());
181 }
182
183
184 void ATAV::VisitModuleStatement(ModuleStatement* stmt) { Visit(stmt->body()); }
185
186
187 void ATAV::VisitTryCatchStatement(TryCatchStatement* stmt) {
188 Visit(stmt->try_block());
189 Visit(stmt->catch_block());
190 }
191
192
193 void ATAV::VisitDoWhileStatement(DoWhileStatement* loop) {
194 Visit(loop->body());
195 Visit(loop->cond());
196 }
197
198
199 void ATAV::VisitWhileStatement(WhileStatement* loop) {
200 Visit(loop->cond());
201 Visit(loop->body());
202 }
203
204
205 void ATAV::VisitForStatement(ForStatement* loop) {
206 VisitIfNotNull(loop->init());
207 VisitIfNotNull(loop->cond());
208 Visit(loop->body());
209 VisitIfNotNull(loop->next());
210 }
211
212
213 void ATAV::VisitForInStatement(ForInStatement* loop) {
214 Visit(loop->each());
215 Visit(loop->subject());
216 Visit(loop->body());
217 }
218
219
220 void ATAV::VisitForOfStatement(ForOfStatement* loop) {
221 Visit(loop->each());
222 Visit(loop->subject());
223 Visit(loop->body());
224 }
225
226
227 void ATAV::VisitAssignment(Assignment* stmt) {
228 Expression* l = stmt->target();
229 Visit(l);
230 Visit(stmt->value());
231 }
232
233
234 void ATAV::VisitCountOperation(CountOperation* e) {
235 Expression* l = e->expression();
236 Visit(l);
237 }
238 }
239 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast-this-access-visitor.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698