blob: 44a10506bce0a242da739ca72f0fcec6e7ab991b [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"
Steve Block6ded16b2010-05-10 14:33:55 +010031#include "scopes.h"
Leon Clarke4515c472010-02-03 11:58:03 +000032
33namespace v8 {
34namespace internal {
35
36
Steve Block6ded16b2010-05-10 14:33:55 +010037#ifdef DEBUG
38void BitVector::Print() {
39 bool first = true;
40 PrintF("{");
41 for (int i = 0; i < length(); i++) {
42 if (Contains(i)) {
43 if (!first) PrintF(",");
44 first = false;
45 PrintF("%d");
46 }
47 }
48 PrintF("}");
49}
50#endif
51
52
Kristian Monsen80d68ea2010-09-08 11:05:35 +010053bool AssignedVariablesAnalyzer::Analyze() {
54 Scope* scope = fun_->scope();
55 int variables = scope->num_parameters() + scope->num_stack_slots();
56 if (variables == 0) return true;
57 av_.ExpandTo(variables);
Steve Block6ded16b2010-05-10 14:33:55 +010058 VisitStatements(fun_->body());
Kristian Monsen80d68ea2010-09-08 11:05:35 +010059 return !HasStackOverflow();
Andrei Popescu402d9372010-02-26 13:31:12 +000060}
61
62
Steve Block6ded16b2010-05-10 14:33:55 +010063Variable* AssignedVariablesAnalyzer::FindSmiLoopVariable(ForStatement* stmt) {
64 // The loop must have all necessary parts.
65 if (stmt->init() == NULL || stmt->cond() == NULL || stmt->next() == NULL) {
66 return NULL;
67 }
68 // The initialization statement has to be a simple assignment.
69 Assignment* init = stmt->init()->StatementAsSimpleAssignment();
70 if (init == NULL) return NULL;
Andrei Popescu402d9372010-02-26 13:31:12 +000071
Steve Block6ded16b2010-05-10 14:33:55 +010072 // We only deal with local variables.
73 Variable* loop_var = init->target()->AsVariableProxy()->AsVariable();
74 if (loop_var == NULL || !loop_var->IsStackAllocated()) return NULL;
75
Ben Murdoch7f4d5bd2010-06-15 11:15:29 +010076 // Don't try to get clever with const or dynamic variables.
77 if (loop_var->mode() != Variable::VAR) return NULL;
78
Steve Block6ded16b2010-05-10 14:33:55 +010079 // The initial value has to be a smi.
80 Literal* init_lit = init->value()->AsLiteral();
81 if (init_lit == NULL || !init_lit->handle()->IsSmi()) return NULL;
82 int init_value = Smi::cast(*init_lit->handle())->value();
83
84 // The condition must be a compare of variable with <, <=, >, or >=.
85 CompareOperation* cond = stmt->cond()->AsCompareOperation();
86 if (cond == NULL) return NULL;
87 if (cond->op() != Token::LT
88 && cond->op() != Token::LTE
89 && cond->op() != Token::GT
90 && cond->op() != Token::GTE) return NULL;
91
92 // The lhs must be the same variable as in the init expression.
93 if (cond->left()->AsVariableProxy()->AsVariable() != loop_var) return NULL;
94
95 // The rhs must be a smi.
96 Literal* term_lit = cond->right()->AsLiteral();
97 if (term_lit == NULL || !term_lit->handle()->IsSmi()) return NULL;
98 int term_value = Smi::cast(*term_lit->handle())->value();
99
100 // The count operation updates the same variable as in the init expression.
101 CountOperation* update = stmt->next()->StatementAsCountOperation();
102 if (update == NULL) return NULL;
103 if (update->expression()->AsVariableProxy()->AsVariable() != loop_var) {
104 return NULL;
105 }
106
107 // The direction of the count operation must agree with the start and the end
108 // value. We currently do not allow the initial value to be the same as the
109 // terminal value. This _would_ be ok as long as the loop body never executes
110 // or executes exactly one time.
111 if (init_value == term_value) return NULL;
112 if (init_value < term_value && update->op() != Token::INC) return NULL;
113 if (init_value > term_value && update->op() != Token::DEC) return NULL;
114
115 // Check that the update operation cannot overflow the smi range. This can
116 // occur in the two cases where the loop bound is equal to the largest or
117 // smallest smi.
118 if (update->op() == Token::INC && term_value == Smi::kMaxValue) return NULL;
119 if (update->op() == Token::DEC && term_value == Smi::kMinValue) return NULL;
120
121 // Found a smi loop variable.
122 return loop_var;
123}
124
125int AssignedVariablesAnalyzer::BitIndex(Variable* var) {
126 ASSERT(var != NULL);
127 ASSERT(var->IsStackAllocated());
Kristian Monsen0d5e1162010-09-30 15:31:59 +0100128 Slot* slot = var->AsSlot();
Steve Block6ded16b2010-05-10 14:33:55 +0100129 if (slot->type() == Slot::PARAMETER) {
130 return slot->index();
131 } else {
132 return fun_->scope()->num_parameters() + slot->index();
Andrei Popescu402d9372010-02-26 13:31:12 +0000133 }
134}
135
136
Steve Block6ded16b2010-05-10 14:33:55 +0100137void AssignedVariablesAnalyzer::RecordAssignedVar(Variable* var) {
138 ASSERT(var != NULL);
139 if (var->IsStackAllocated()) {
140 av_.Add(BitIndex(var));
Andrei Popescu402d9372010-02-26 13:31:12 +0000141 }
142}
143
144
Steve Block6ded16b2010-05-10 14:33:55 +0100145void AssignedVariablesAnalyzer::MarkIfTrivial(Expression* expr) {
146 Variable* var = expr->AsVariableProxy()->AsVariable();
147 if (var != NULL &&
148 var->IsStackAllocated() &&
149 !var->is_arguments() &&
150 var->mode() != Variable::CONST &&
151 (var->is_this() || !av_.Contains(BitIndex(var)))) {
Kristian Monsen80d68ea2010-09-08 11:05:35 +0100152 expr->AsVariableProxy()->MarkAsTrivial();
Andrei Popescu402d9372010-02-26 13:31:12 +0000153 }
154}
155
156
Steve Block6ded16b2010-05-10 14:33:55 +0100157void AssignedVariablesAnalyzer::ProcessExpression(Expression* expr) {
158 BitVector saved_av(av_);
159 av_.Clear();
160 Visit(expr);
161 av_.Union(saved_av);
Andrei Popescu402d9372010-02-26 13:31:12 +0000162}
163
Steve Block6ded16b2010-05-10 14:33:55 +0100164void AssignedVariablesAnalyzer::VisitBlock(Block* stmt) {
Andrei Popescu402d9372010-02-26 13:31:12 +0000165 VisitStatements(stmt->statements());
166}
167
168
Steve Block6ded16b2010-05-10 14:33:55 +0100169void AssignedVariablesAnalyzer::VisitExpressionStatement(
Andrei Popescu402d9372010-02-26 13:31:12 +0000170 ExpressionStatement* stmt) {
Steve Block6ded16b2010-05-10 14:33:55 +0100171 ProcessExpression(stmt->expression());
Andrei Popescu402d9372010-02-26 13:31:12 +0000172}
173
174
Steve Block6ded16b2010-05-10 14:33:55 +0100175void AssignedVariablesAnalyzer::VisitEmptyStatement(EmptyStatement* stmt) {
Andrei Popescu402d9372010-02-26 13:31:12 +0000176 // Do nothing.
177}
178
179
Steve Block6ded16b2010-05-10 14:33:55 +0100180void AssignedVariablesAnalyzer::VisitIfStatement(IfStatement* stmt) {
181 ProcessExpression(stmt->condition());
182 Visit(stmt->then_statement());
183 Visit(stmt->else_statement());
Andrei Popescu402d9372010-02-26 13:31:12 +0000184}
185
186
Steve Block6ded16b2010-05-10 14:33:55 +0100187void AssignedVariablesAnalyzer::VisitContinueStatement(
188 ContinueStatement* stmt) {
189 // Nothing to do.
Andrei Popescu402d9372010-02-26 13:31:12 +0000190}
191
192
Steve Block6ded16b2010-05-10 14:33:55 +0100193void AssignedVariablesAnalyzer::VisitBreakStatement(BreakStatement* stmt) {
194 // Nothing to do.
Andrei Popescu402d9372010-02-26 13:31:12 +0000195}
196
197
Steve Block6ded16b2010-05-10 14:33:55 +0100198void AssignedVariablesAnalyzer::VisitReturnStatement(ReturnStatement* stmt) {
199 ProcessExpression(stmt->expression());
Andrei Popescu402d9372010-02-26 13:31:12 +0000200}
201
202
Steve Block6ded16b2010-05-10 14:33:55 +0100203void AssignedVariablesAnalyzer::VisitWithEnterStatement(
Andrei Popescu402d9372010-02-26 13:31:12 +0000204 WithEnterStatement* stmt) {
Steve Block6ded16b2010-05-10 14:33:55 +0100205 ProcessExpression(stmt->expression());
Andrei Popescu402d9372010-02-26 13:31:12 +0000206}
207
208
Steve Block6ded16b2010-05-10 14:33:55 +0100209void AssignedVariablesAnalyzer::VisitWithExitStatement(
210 WithExitStatement* stmt) {
211 // Nothing to do.
Andrei Popescu402d9372010-02-26 13:31:12 +0000212}
213
214
Steve Block6ded16b2010-05-10 14:33:55 +0100215void AssignedVariablesAnalyzer::VisitSwitchStatement(SwitchStatement* stmt) {
216 BitVector result(av_);
217 av_.Clear();
218 Visit(stmt->tag());
219 result.Union(av_);
220 for (int i = 0; i < stmt->cases()->length(); i++) {
221 CaseClause* clause = stmt->cases()->at(i);
222 if (!clause->is_default()) {
223 av_.Clear();
224 Visit(clause->label());
225 result.Union(av_);
226 }
227 VisitStatements(clause->statements());
228 }
229 av_.Union(result);
Andrei Popescu402d9372010-02-26 13:31:12 +0000230}
231
232
Steve Block6ded16b2010-05-10 14:33:55 +0100233void AssignedVariablesAnalyzer::VisitDoWhileStatement(DoWhileStatement* stmt) {
234 ProcessExpression(stmt->cond());
235 Visit(stmt->body());
Andrei Popescu402d9372010-02-26 13:31:12 +0000236}
237
238
Steve Block6ded16b2010-05-10 14:33:55 +0100239void AssignedVariablesAnalyzer::VisitWhileStatement(WhileStatement* stmt) {
240 ProcessExpression(stmt->cond());
241 Visit(stmt->body());
Andrei Popescu402d9372010-02-26 13:31:12 +0000242}
243
244
Steve Block6ded16b2010-05-10 14:33:55 +0100245void AssignedVariablesAnalyzer::VisitForStatement(ForStatement* stmt) {
246 if (stmt->init() != NULL) Visit(stmt->init());
Steve Block6ded16b2010-05-10 14:33:55 +0100247 if (stmt->cond() != NULL) ProcessExpression(stmt->cond());
Steve Block6ded16b2010-05-10 14:33:55 +0100248 if (stmt->next() != NULL) Visit(stmt->next());
249
250 // Process loop body. After visiting the loop body av_ contains
251 // the assigned variables of the loop body.
252 BitVector saved_av(av_);
253 av_.Clear();
254 Visit(stmt->body());
255
256 Variable* var = FindSmiLoopVariable(stmt);
257 if (var != NULL && !av_.Contains(BitIndex(var))) {
258 stmt->set_loop_variable(var);
259 }
Steve Block6ded16b2010-05-10 14:33:55 +0100260 av_.Union(saved_av);
Andrei Popescu402d9372010-02-26 13:31:12 +0000261}
262
263
Steve Block6ded16b2010-05-10 14:33:55 +0100264void AssignedVariablesAnalyzer::VisitForInStatement(ForInStatement* stmt) {
265 ProcessExpression(stmt->each());
266 ProcessExpression(stmt->enumerable());
267 Visit(stmt->body());
Andrei Popescu402d9372010-02-26 13:31:12 +0000268}
269
270
Steve Block6ded16b2010-05-10 14:33:55 +0100271void AssignedVariablesAnalyzer::VisitTryCatchStatement(
272 TryCatchStatement* stmt) {
273 Visit(stmt->try_block());
274 Visit(stmt->catch_block());
Andrei Popescu402d9372010-02-26 13:31:12 +0000275}
276
277
Steve Block6ded16b2010-05-10 14:33:55 +0100278void AssignedVariablesAnalyzer::VisitTryFinallyStatement(
Andrei Popescu402d9372010-02-26 13:31:12 +0000279 TryFinallyStatement* stmt) {
Steve Block6ded16b2010-05-10 14:33:55 +0100280 Visit(stmt->try_block());
281 Visit(stmt->finally_block());
Andrei Popescu402d9372010-02-26 13:31:12 +0000282}
283
284
Steve Block6ded16b2010-05-10 14:33:55 +0100285void AssignedVariablesAnalyzer::VisitDebuggerStatement(
Andrei Popescu402d9372010-02-26 13:31:12 +0000286 DebuggerStatement* stmt) {
Steve Block6ded16b2010-05-10 14:33:55 +0100287 // Nothing to do.
288}
289
290
291void AssignedVariablesAnalyzer::VisitFunctionLiteral(FunctionLiteral* expr) {
292 // Nothing to do.
293 ASSERT(av_.IsEmpty());
294}
295
296
297void AssignedVariablesAnalyzer::VisitSharedFunctionInfoLiteral(
298 SharedFunctionInfoLiteral* expr) {
299 // Nothing to do.
300 ASSERT(av_.IsEmpty());
301}
302
303
304void AssignedVariablesAnalyzer::VisitConditional(Conditional* expr) {
305 ASSERT(av_.IsEmpty());
306
307 Visit(expr->condition());
308
309 BitVector result(av_);
310 av_.Clear();
311 Visit(expr->then_expression());
312 result.Union(av_);
313
314 av_.Clear();
315 Visit(expr->else_expression());
316 av_.Union(result);
317}
318
319
320void AssignedVariablesAnalyzer::VisitSlot(Slot* expr) {
Andrei Popescu402d9372010-02-26 13:31:12 +0000321 UNREACHABLE();
322}
323
324
Steve Block6ded16b2010-05-10 14:33:55 +0100325void AssignedVariablesAnalyzer::VisitVariableProxy(VariableProxy* expr) {
326 // Nothing to do.
327 ASSERT(av_.IsEmpty());
Andrei Popescu402d9372010-02-26 13:31:12 +0000328}
329
330
Steve Block6ded16b2010-05-10 14:33:55 +0100331void AssignedVariablesAnalyzer::VisitLiteral(Literal* expr) {
332 // Nothing to do.
333 ASSERT(av_.IsEmpty());
Andrei Popescu402d9372010-02-26 13:31:12 +0000334}
335
336
Steve Block6ded16b2010-05-10 14:33:55 +0100337void AssignedVariablesAnalyzer::VisitRegExpLiteral(RegExpLiteral* expr) {
338 // Nothing to do.
339 ASSERT(av_.IsEmpty());
Andrei Popescu402d9372010-02-26 13:31:12 +0000340}
341
342
Steve Block6ded16b2010-05-10 14:33:55 +0100343void AssignedVariablesAnalyzer::VisitObjectLiteral(ObjectLiteral* expr) {
344 ASSERT(av_.IsEmpty());
345 BitVector result(av_.length());
346 for (int i = 0; i < expr->properties()->length(); i++) {
347 Visit(expr->properties()->at(i)->value());
348 result.Union(av_);
349 av_.Clear();
350 }
351 av_ = result;
Andrei Popescu402d9372010-02-26 13:31:12 +0000352}
353
354
Steve Block6ded16b2010-05-10 14:33:55 +0100355void AssignedVariablesAnalyzer::VisitArrayLiteral(ArrayLiteral* expr) {
356 ASSERT(av_.IsEmpty());
357 BitVector result(av_.length());
358 for (int i = 0; i < expr->values()->length(); i++) {
359 Visit(expr->values()->at(i));
360 result.Union(av_);
361 av_.Clear();
362 }
363 av_ = result;
Andrei Popescu402d9372010-02-26 13:31:12 +0000364}
365
366
Steve Block6ded16b2010-05-10 14:33:55 +0100367void AssignedVariablesAnalyzer::VisitCatchExtensionObject(
Andrei Popescu402d9372010-02-26 13:31:12 +0000368 CatchExtensionObject* expr) {
Steve Block6ded16b2010-05-10 14:33:55 +0100369 ASSERT(av_.IsEmpty());
370 Visit(expr->key());
371 ProcessExpression(expr->value());
Andrei Popescu402d9372010-02-26 13:31:12 +0000372}
373
374
Steve Block6ded16b2010-05-10 14:33:55 +0100375void AssignedVariablesAnalyzer::VisitAssignment(Assignment* expr) {
376 ASSERT(av_.IsEmpty());
377
378 // There are three kinds of assignments: variable assignments, property
379 // assignments, and reference errors (invalid left-hand sides).
380 Variable* var = expr->target()->AsVariableProxy()->AsVariable();
Andrei Popescu402d9372010-02-26 13:31:12 +0000381 Property* prop = expr->target()->AsProperty();
Steve Block6ded16b2010-05-10 14:33:55 +0100382 ASSERT(var == NULL || prop == NULL);
Andrei Popescu402d9372010-02-26 13:31:12 +0000383
Steve Block6ded16b2010-05-10 14:33:55 +0100384 if (var != NULL) {
385 MarkIfTrivial(expr->value());
386 Visit(expr->value());
387 if (expr->is_compound()) {
388 // Left-hand side occurs also as an rvalue.
389 MarkIfTrivial(expr->target());
390 ProcessExpression(expr->target());
391 }
392 RecordAssignedVar(var);
Andrei Popescu402d9372010-02-26 13:31:12 +0000393
Steve Block6ded16b2010-05-10 14:33:55 +0100394 } else if (prop != NULL) {
395 MarkIfTrivial(expr->value());
396 Visit(expr->value());
397 if (!prop->key()->IsPropertyName()) {
398 MarkIfTrivial(prop->key());
399 ProcessExpression(prop->key());
400 }
401 MarkIfTrivial(prop->obj());
402 ProcessExpression(prop->obj());
403
404 } else {
405 Visit(expr->target());
406 }
Andrei Popescu402d9372010-02-26 13:31:12 +0000407}
408
409
Steve Block6ded16b2010-05-10 14:33:55 +0100410void AssignedVariablesAnalyzer::VisitThrow(Throw* expr) {
411 ASSERT(av_.IsEmpty());
412 Visit(expr->exception());
Andrei Popescu402d9372010-02-26 13:31:12 +0000413}
414
415
Steve Block6ded16b2010-05-10 14:33:55 +0100416void AssignedVariablesAnalyzer::VisitProperty(Property* expr) {
417 ASSERT(av_.IsEmpty());
418 if (!expr->key()->IsPropertyName()) {
419 MarkIfTrivial(expr->key());
420 Visit(expr->key());
421 }
422 MarkIfTrivial(expr->obj());
423 ProcessExpression(expr->obj());
Andrei Popescu402d9372010-02-26 13:31:12 +0000424}
425
426
Steve Block6ded16b2010-05-10 14:33:55 +0100427void AssignedVariablesAnalyzer::VisitCall(Call* expr) {
428 ASSERT(av_.IsEmpty());
429 Visit(expr->expression());
430 BitVector result(av_);
431 for (int i = 0; i < expr->arguments()->length(); i++) {
432 av_.Clear();
433 Visit(expr->arguments()->at(i));
434 result.Union(av_);
435 }
436 av_ = result;
Andrei Popescu402d9372010-02-26 13:31:12 +0000437}
438
439
Steve Block6ded16b2010-05-10 14:33:55 +0100440void AssignedVariablesAnalyzer::VisitCallNew(CallNew* expr) {
441 ASSERT(av_.IsEmpty());
442 Visit(expr->expression());
443 BitVector result(av_);
444 for (int i = 0; i < expr->arguments()->length(); i++) {
445 av_.Clear();
446 Visit(expr->arguments()->at(i));
447 result.Union(av_);
448 }
449 av_ = result;
Andrei Popescu402d9372010-02-26 13:31:12 +0000450}
451
452
Steve Block6ded16b2010-05-10 14:33:55 +0100453void AssignedVariablesAnalyzer::VisitCallRuntime(CallRuntime* expr) {
454 ASSERT(av_.IsEmpty());
455 BitVector result(av_);
456 for (int i = 0; i < expr->arguments()->length(); i++) {
457 av_.Clear();
458 Visit(expr->arguments()->at(i));
459 result.Union(av_);
460 }
461 av_ = result;
Andrei Popescu402d9372010-02-26 13:31:12 +0000462}
463
464
Steve Block6ded16b2010-05-10 14:33:55 +0100465void AssignedVariablesAnalyzer::VisitUnaryOperation(UnaryOperation* expr) {
466 ASSERT(av_.IsEmpty());
Kristian Monsen80d68ea2010-09-08 11:05:35 +0100467 MarkIfTrivial(expr->expression());
Steve Block6ded16b2010-05-10 14:33:55 +0100468 Visit(expr->expression());
Andrei Popescu402d9372010-02-26 13:31:12 +0000469}
470
471
Kristian Monsen80d68ea2010-09-08 11:05:35 +0100472void AssignedVariablesAnalyzer::VisitIncrementOperation(
473 IncrementOperation* expr) {
474 UNREACHABLE();
475}
476
477
Steve Block6ded16b2010-05-10 14:33:55 +0100478void AssignedVariablesAnalyzer::VisitCountOperation(CountOperation* expr) {
479 ASSERT(av_.IsEmpty());
Kristian Monsen80d68ea2010-09-08 11:05:35 +0100480 if (expr->is_prefix()) MarkIfTrivial(expr->expression());
Steve Block6ded16b2010-05-10 14:33:55 +0100481 Visit(expr->expression());
482
483 Variable* var = expr->expression()->AsVariableProxy()->AsVariable();
484 if (var != NULL) RecordAssignedVar(var);
Andrei Popescu402d9372010-02-26 13:31:12 +0000485}
486
487
Steve Block6ded16b2010-05-10 14:33:55 +0100488void AssignedVariablesAnalyzer::VisitBinaryOperation(BinaryOperation* expr) {
489 ASSERT(av_.IsEmpty());
490 MarkIfTrivial(expr->right());
Andrei Popescu402d9372010-02-26 13:31:12 +0000491 Visit(expr->right());
Steve Block6ded16b2010-05-10 14:33:55 +0100492 MarkIfTrivial(expr->left());
493 ProcessExpression(expr->left());
Andrei Popescu402d9372010-02-26 13:31:12 +0000494}
495
496
Steve Block6ded16b2010-05-10 14:33:55 +0100497void AssignedVariablesAnalyzer::VisitCompareOperation(CompareOperation* expr) {
498 ASSERT(av_.IsEmpty());
499 MarkIfTrivial(expr->right());
500 Visit(expr->right());
501 MarkIfTrivial(expr->left());
502 ProcessExpression(expr->left());
Andrei Popescu402d9372010-02-26 13:31:12 +0000503}
504
505
Kristian Monsen80d68ea2010-09-08 11:05:35 +0100506void AssignedVariablesAnalyzer::VisitCompareToNull(CompareToNull* expr) {
507 ASSERT(av_.IsEmpty());
508 MarkIfTrivial(expr->expression());
509 Visit(expr->expression());
510}
511
512
Steve Block6ded16b2010-05-10 14:33:55 +0100513void AssignedVariablesAnalyzer::VisitThisFunction(ThisFunction* expr) {
514 // Nothing to do.
515 ASSERT(av_.IsEmpty());
516}
517
518
519void AssignedVariablesAnalyzer::VisitDeclaration(Declaration* decl) {
Andrei Popescu402d9372010-02-26 13:31:12 +0000520 UNREACHABLE();
521}
522
523
Leon Clarke4515c472010-02-03 11:58:03 +0000524} } // namespace v8::internal