Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 424 graph_.AppendInstruction(expr); | 424 graph_.AppendInstruction(expr); |
| 425 } | 425 } |
| 426 | 426 |
| 427 | 427 |
| 428 void FlowGraphBuilder::VisitAssignment(Assignment* expr) { | 428 void FlowGraphBuilder::VisitAssignment(Assignment* expr) { |
| 429 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); | 429 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); |
| 430 Property* prop = expr->target()->AsProperty(); | 430 Property* prop = expr->target()->AsProperty(); |
| 431 // Left-hand side can be a variable or property (or reference error) but | 431 // Left-hand side can be a variable or property (or reference error) but |
| 432 // not both. | 432 // not both. |
| 433 ASSERT(var == NULL || prop == NULL); | 433 ASSERT(var == NULL || prop == NULL); |
| 434 if (prop != NULL) { | 434 if (var != NULL) { |
| 435 Visit(expr->value()); | |
| 436 Slot* slot = var->slot(); | |
| 437 if (slot != NULL && | |
|
fschneider
2010/03/09 09:23:05
I'm also checking for stack locals and parameters
| |
| 438 (slot->type() == Slot::LOCAL || slot->type() == Slot::PARAMETER)) { | |
| 439 definitions_.Add(expr); | |
| 440 } | |
| 441 | |
| 442 } else if (prop != NULL) { | |
| 435 Visit(prop->obj()); | 443 Visit(prop->obj()); |
| 436 if (!prop->key()->IsPropertyName()) Visit(prop->key()); | 444 if (!prop->key()->IsPropertyName()) Visit(prop->key()); |
| 437 } | |
| 438 if (var != NULL || prop != NULL) { | |
| 439 Visit(expr->value()); | 445 Visit(expr->value()); |
| 440 } | 446 } |
| 441 graph_.AppendInstruction(expr); | 447 graph_.AppendInstruction(expr); |
| 442 } | 448 } |
| 443 | 449 |
| 444 | 450 |
| 445 void FlowGraphBuilder::VisitThrow(Throw* expr) { | 451 void FlowGraphBuilder::VisitThrow(Throw* expr) { |
| 446 Visit(expr->exception()); | 452 Visit(expr->exception()); |
| 447 graph_.AppendInstruction(expr); | 453 graph_.AppendInstruction(expr); |
| 448 } | 454 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 | 491 |
| 486 | 492 |
| 487 void FlowGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) { | 493 void FlowGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) { |
| 488 Visit(expr->expression()); | 494 Visit(expr->expression()); |
| 489 graph_.AppendInstruction(expr); | 495 graph_.AppendInstruction(expr); |
| 490 } | 496 } |
| 491 | 497 |
| 492 | 498 |
| 493 void FlowGraphBuilder::VisitCountOperation(CountOperation* expr) { | 499 void FlowGraphBuilder::VisitCountOperation(CountOperation* expr) { |
| 494 Visit(expr->expression()); | 500 Visit(expr->expression()); |
| 501 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); | |
|
fschneider
2010/03/09 09:23:05
Sometimes we use
...->AsVariableProxy()->var()
| |
| 502 if (var != NULL) { | |
| 503 Slot* slot = var->slot(); | |
| 504 if (slot != NULL && | |
| 505 (slot->type() == Slot::LOCAL || slot->type() == Slot::PARAMETER)) { | |
| 506 definitions_.Add(expr); | |
| 507 } | |
| 508 } | |
| 495 graph_.AppendInstruction(expr); | 509 graph_.AppendInstruction(expr); |
| 496 } | 510 } |
| 497 | 511 |
| 498 | 512 |
| 499 void FlowGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) { | 513 void FlowGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) { |
| 500 Visit(expr->left()); | 514 Visit(expr->left()); |
| 501 | 515 |
| 502 switch (expr->op()) { | 516 switch (expr->op()) { |
| 503 case Token::COMMA: | 517 case Token::COMMA: |
| 504 Visit(expr->right()); | 518 Visit(expr->right()); |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1452 for (int i = postorder->length() - 1; i >= 0; i--) { | 1466 for (int i = postorder->length() - 1; i >= 0; i--) { |
| 1453 postorder->at(i)->PrintText(); | 1467 postorder->at(i)->PrintText(); |
| 1454 } | 1468 } |
| 1455 } | 1469 } |
| 1456 | 1470 |
| 1457 | 1471 |
| 1458 #endif // defined(DEBUG) | 1472 #endif // defined(DEBUG) |
| 1459 | 1473 |
| 1460 | 1474 |
| 1461 } } // namespace v8::internal | 1475 } } // namespace v8::internal |
| OLD | NEW |