| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 break; | 275 break; |
| 276 } | 276 } |
| 277 | 277 |
| 278 Visit(node->target()); | 278 Visit(node->target()); |
| 279 Visit(node->value()); | 279 Visit(node->value()); |
| 280 | 280 |
| 281 switch (node->op()) { | 281 switch (node->op()) { |
| 282 case Token::INIT_VAR: | 282 case Token::INIT_VAR: |
| 283 case Token::INIT_CONST: | 283 case Token::INIT_CONST: |
| 284 case Token::ASSIGN: | 284 case Token::ASSIGN: |
| 285 // Pure assigment copies the type from the value. | 285 // Pure assignment copies the type from the value. |
| 286 node->type()->CopyFrom(node->value()->type()); | 286 node->type()->CopyFrom(node->value()->type()); |
| 287 break; | 287 break; |
| 288 case Token::ASSIGN_BIT_OR: | 288 case Token::ASSIGN_BIT_OR: |
| 289 case Token::ASSIGN_BIT_XOR: | 289 case Token::ASSIGN_BIT_XOR: |
| 290 case Token::ASSIGN_BIT_AND: | 290 case Token::ASSIGN_BIT_AND: |
| 291 case Token::ASSIGN_SHL: | 291 case Token::ASSIGN_SHL: |
| 292 case Token::ASSIGN_SAR: | 292 case Token::ASSIGN_SAR: |
| 293 case Token::ASSIGN_SHR: | 293 case Token::ASSIGN_SHR: |
| 294 // Should have been setup above already. | 294 // Should have been setup above already. |
| 295 break; | 295 break; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 // After visiting the operand nodes we have to check if this node's type | 413 // After visiting the operand nodes we have to check if this node's type |
| 414 // can be updated. If it does, then we can push that information down | 414 // can be updated. If it does, then we can push that information down |
| 415 // towards the leafs again if the new information is an upgrade over the | 415 // towards the leafs again if the new information is an upgrade over the |
| 416 // previous type of the operand nodes. | 416 // previous type of the operand nodes. |
| 417 if (node->type()->IsUnknown()) { | 417 if (node->type()->IsUnknown()) { |
| 418 if (node->left()->type()->IsLikelySmi() || | 418 if (node->left()->type()->IsLikelySmi() || |
| 419 node->right()->type()->IsLikelySmi()) { | 419 node->right()->type()->IsLikelySmi()) { |
| 420 node->type()->SetAsLikelySmi(); | 420 node->type()->SetAsLikelySmi(); |
| 421 } | 421 } |
| 422 if (node->type()->IsLikelySmi()) { | 422 if (node->type()->IsLikelySmi()) { |
| 423 // The type of this node changed to LIKELY_SMI. Propagate this knowlege | 423 // The type of this node changed to LIKELY_SMI. Propagate this knowledge |
| 424 // down through the nodes. | 424 // down through the nodes. |
| 425 if (node->left()->type()->IsUnknown()) { | 425 if (node->left()->type()->IsUnknown()) { |
| 426 node->left()->type()->SetAsLikelySmi(); | 426 node->left()->type()->SetAsLikelySmi(); |
| 427 Visit(node->left()); | 427 Visit(node->left()); |
| 428 } | 428 } |
| 429 if (node->right()->type()->IsUnknown()) { | 429 if (node->right()->type()->IsUnknown()) { |
| 430 node->right()->type()->SetAsLikelySmi(); | 430 node->right()->type()->SetAsLikelySmi(); |
| 431 Visit(node->right()); | 431 Visit(node->right()); |
| 432 } | 432 } |
| 433 } | 433 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 448 // After visiting the operand nodes we have to check if this node's type | 448 // After visiting the operand nodes we have to check if this node's type |
| 449 // can be updated. If it does, then we can push that information down | 449 // can be updated. If it does, then we can push that information down |
| 450 // towards the leafs again if the new information is an upgrade over the | 450 // towards the leafs again if the new information is an upgrade over the |
| 451 // previous type of the operand nodes. | 451 // previous type of the operand nodes. |
| 452 if (node->type()->IsUnknown()) { | 452 if (node->type()->IsUnknown()) { |
| 453 if (node->left()->type()->IsLikelySmi() || | 453 if (node->left()->type()->IsLikelySmi() || |
| 454 node->right()->type()->IsLikelySmi()) { | 454 node->right()->type()->IsLikelySmi()) { |
| 455 node->type()->SetAsLikelySmi(); | 455 node->type()->SetAsLikelySmi(); |
| 456 } | 456 } |
| 457 if (node->type()->IsLikelySmi()) { | 457 if (node->type()->IsLikelySmi()) { |
| 458 // The type of this node changed to LIKELY_SMI. Propagate this knowlege | 458 // The type of this node changed to LIKELY_SMI. Propagate this knowledge |
| 459 // down through the nodes. | 459 // down through the nodes. |
| 460 if (node->left()->type()->IsUnknown()) { | 460 if (node->left()->type()->IsUnknown()) { |
| 461 node->left()->type()->SetAsLikelySmi(); | 461 node->left()->type()->SetAsLikelySmi(); |
| 462 Visit(node->left()); | 462 Visit(node->left()); |
| 463 } | 463 } |
| 464 if (node->right()->type()->IsUnknown()) { | 464 if (node->right()->type()->IsUnknown()) { |
| 465 node->right()->type()->SetAsLikelySmi(); | 465 node->right()->type()->SetAsLikelySmi(); |
| 466 Visit(node->right()); | 466 Visit(node->right()); |
| 467 } | 467 } |
| 468 } | 468 } |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 if (optimizer.HasStackOverflow()) { | 784 if (optimizer.HasStackOverflow()) { |
| 785 return false; | 785 return false; |
| 786 } | 786 } |
| 787 } | 787 } |
| 788 } | 788 } |
| 789 return true; | 789 return true; |
| 790 } | 790 } |
| 791 | 791 |
| 792 | 792 |
| 793 } } // namespace v8::internal | 793 } } // namespace v8::internal |
| OLD | NEW |