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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 (var != NULL) { | 434 if (var != NULL) { |
435 Visit(expr->value()); | 435 Visit(expr->value()); |
436 Slot* slot = var->slot(); | 436 if (var->IsStackAllocated()) definitions_.Add(expr); |
437 if (slot != NULL && | |
438 (slot->type() == Slot::LOCAL || slot->type() == Slot::PARAMETER)) { | |
439 definitions_.Add(expr); | |
440 } | |
441 | 437 |
442 } else if (prop != NULL) { | 438 } else if (prop != NULL) { |
443 Visit(prop->obj()); | 439 Visit(prop->obj()); |
444 if (!prop->key()->IsPropertyName()) Visit(prop->key()); | 440 if (!prop->key()->IsPropertyName()) Visit(prop->key()); |
445 Visit(expr->value()); | 441 Visit(expr->value()); |
446 } | 442 } |
447 graph_.AppendInstruction(expr); | 443 graph_.AppendInstruction(expr); |
448 } | 444 } |
449 | 445 |
450 | 446 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 | 488 |
493 void FlowGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) { | 489 void FlowGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) { |
494 Visit(expr->expression()); | 490 Visit(expr->expression()); |
495 graph_.AppendInstruction(expr); | 491 graph_.AppendInstruction(expr); |
496 } | 492 } |
497 | 493 |
498 | 494 |
499 void FlowGraphBuilder::VisitCountOperation(CountOperation* expr) { | 495 void FlowGraphBuilder::VisitCountOperation(CountOperation* expr) { |
500 Visit(expr->expression()); | 496 Visit(expr->expression()); |
501 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); | 497 Variable* var = expr->expression()->AsVariableProxy()->AsVariable(); |
502 if (var != NULL) { | 498 if (var != NULL && var->IsStackAllocated()) { |
503 Slot* slot = var->slot(); | 499 definitions_.Add(expr); |
504 if (slot != NULL && | |
505 (slot->type() == Slot::LOCAL || slot->type() == Slot::PARAMETER)) { | |
506 definitions_.Add(expr); | |
507 } | |
508 } | 500 } |
509 graph_.AppendInstruction(expr); | 501 graph_.AppendInstruction(expr); |
510 } | 502 } |
511 | 503 |
512 | 504 |
513 void FlowGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) { | 505 void FlowGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) { |
514 Visit(expr->left()); | 506 Visit(expr->left()); |
515 | 507 |
516 switch (expr->op()) { | 508 switch (expr->op()) { |
517 case Token::COMMA: | 509 case Token::COMMA: |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 for (int i = postorder->length() - 1; i >= 0; i--) { | 1458 for (int i = postorder->length() - 1; i >= 0; i--) { |
1467 postorder->at(i)->PrintText(); | 1459 postorder->at(i)->PrintText(); |
1468 } | 1460 } |
1469 } | 1461 } |
1470 | 1462 |
1471 | 1463 |
1472 #endif // defined(DEBUG) | 1464 #endif // defined(DEBUG) |
1473 | 1465 |
1474 | 1466 |
1475 } } // namespace v8::internal | 1467 } } // namespace v8::internal |
OLD | NEW |