blob: 0e30b315173f879a91d87a9a42d163402cbaf40b [file] [log] [blame]
Leon Clarke4515c472010-02-03 11:58:03 +00001// Copyright 2010 the V8 project authors. All rights reserved.
2// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#include "v8.h"
29
30#include "data-flow.h"
31
32namespace v8 {
33namespace internal {
34
35
36void AstLabeler::Label(FunctionLiteral* fun) {
37 VisitStatements(fun->body());
38}
39
40
41void AstLabeler::VisitStatements(ZoneList<Statement*>* stmts) {
42 for (int i = 0, len = stmts->length(); i < len; i++) {
43 Visit(stmts->at(i));
44 }
45}
46
47
48void AstLabeler::VisitDeclarations(ZoneList<Declaration*>* decls) {
49 UNREACHABLE();
50}
51
52
53void AstLabeler::VisitBlock(Block* stmt) {
54 VisitStatements(stmt->statements());
55}
56
57
58void AstLabeler::VisitExpressionStatement(
59 ExpressionStatement* stmt) {
60 Visit(stmt->expression());
61}
62
63
64void AstLabeler::VisitEmptyStatement(EmptyStatement* stmt) {
65 // Do nothing.
66}
67
68
69void AstLabeler::VisitIfStatement(IfStatement* stmt) {
70 UNREACHABLE();
71}
72
73
74void AstLabeler::VisitContinueStatement(ContinueStatement* stmt) {
75 UNREACHABLE();
76}
77
78
79void AstLabeler::VisitBreakStatement(BreakStatement* stmt) {
80 UNREACHABLE();
81}
82
83
84void AstLabeler::VisitReturnStatement(ReturnStatement* stmt) {
85 UNREACHABLE();
86}
87
88
89void AstLabeler::VisitWithEnterStatement(
90 WithEnterStatement* stmt) {
91 UNREACHABLE();
92}
93
94
95void AstLabeler::VisitWithExitStatement(WithExitStatement* stmt) {
96 UNREACHABLE();
97}
98
99
100void AstLabeler::VisitSwitchStatement(SwitchStatement* stmt) {
101 UNREACHABLE();
102}
103
104
105void AstLabeler::VisitDoWhileStatement(DoWhileStatement* stmt) {
106 UNREACHABLE();
107}
108
109
110void AstLabeler::VisitWhileStatement(WhileStatement* stmt) {
111 UNREACHABLE();
112}
113
114
115void AstLabeler::VisitForStatement(ForStatement* stmt) {
116 UNREACHABLE();
117}
118
119
120void AstLabeler::VisitForInStatement(ForInStatement* stmt) {
121 UNREACHABLE();
122}
123
124
125void AstLabeler::VisitTryCatchStatement(TryCatchStatement* stmt) {
126 UNREACHABLE();
127}
128
129
130void AstLabeler::VisitTryFinallyStatement(
131 TryFinallyStatement* stmt) {
132 UNREACHABLE();
133}
134
135
136void AstLabeler::VisitDebuggerStatement(
137 DebuggerStatement* stmt) {
138 UNREACHABLE();
139}
140
141
142void AstLabeler::VisitFunctionLiteral(FunctionLiteral* expr) {
143 UNREACHABLE();
144}
145
146
147void AstLabeler::VisitFunctionBoilerplateLiteral(
148 FunctionBoilerplateLiteral* expr) {
149 UNREACHABLE();
150}
151
152
153void AstLabeler::VisitConditional(Conditional* expr) {
154 UNREACHABLE();
155}
156
157
158void AstLabeler::VisitSlot(Slot* expr) {
159 UNREACHABLE();
160}
161
162
163void AstLabeler::VisitVariableProxy(VariableProxy* expr) {
164 expr->set_num(next_number_++);
165}
166
167
168void AstLabeler::VisitLiteral(Literal* expr) {
169 UNREACHABLE();
170}
171
172
173void AstLabeler::VisitRegExpLiteral(RegExpLiteral* expr) {
174 UNREACHABLE();
175}
176
177
178void AstLabeler::VisitObjectLiteral(ObjectLiteral* expr) {
179 UNREACHABLE();
180}
181
182
183void AstLabeler::VisitArrayLiteral(ArrayLiteral* expr) {
184 UNREACHABLE();
185}
186
187
188void AstLabeler::VisitCatchExtensionObject(
189 CatchExtensionObject* expr) {
190 UNREACHABLE();
191}
192
193
194void AstLabeler::VisitAssignment(Assignment* expr) {
195 Property* prop = expr->target()->AsProperty();
196 ASSERT(prop != NULL);
197 if (prop != NULL) {
198 ASSERT(prop->key()->IsPropertyName());
199 VariableProxy* proxy = prop->obj()->AsVariableProxy();
200 if (proxy != NULL && proxy->var()->is_this()) {
201 has_this_properties_ = true;
202 } else {
203 Visit(prop->obj());
204 }
205 }
206 Visit(expr->value());
207 expr->set_num(next_number_++);
208}
209
210
211void AstLabeler::VisitThrow(Throw* expr) {
212 UNREACHABLE();
213}
214
215
216void AstLabeler::VisitProperty(Property* expr) {
217 UNREACHABLE();
218}
219
220
221void AstLabeler::VisitCall(Call* expr) {
222 UNREACHABLE();
223}
224
225
226void AstLabeler::VisitCallNew(CallNew* expr) {
227 UNREACHABLE();
228}
229
230
231void AstLabeler::VisitCallRuntime(CallRuntime* expr) {
232 UNREACHABLE();
233}
234
235
236void AstLabeler::VisitUnaryOperation(UnaryOperation* expr) {
237 UNREACHABLE();
238}
239
240
241void AstLabeler::VisitCountOperation(CountOperation* expr) {
242 UNREACHABLE();
243}
244
245
246void AstLabeler::VisitBinaryOperation(BinaryOperation* expr) {
247 Visit(expr->left());
248 Visit(expr->right());
249 expr->set_num(next_number_++);
250}
251
252
253void AstLabeler::VisitCompareOperation(CompareOperation* expr) {
254 UNREACHABLE();
255}
256
257
258void AstLabeler::VisitThisFunction(ThisFunction* expr) {
259 UNREACHABLE();
260}
261
262
263void AstLabeler::VisitDeclaration(Declaration* decl) {
264 UNREACHABLE();
265}
266
267} } // namespace v8::internal