| 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 3513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3524 // never return a constant/immutable object. | 3524 // never return a constant/immutable object. |
| 3525 OverwriteMode overwrite_mode = NO_OVERWRITE; | 3525 OverwriteMode overwrite_mode = NO_OVERWRITE; |
| 3526 if (node->left()->AsBinaryOperation() != NULL && | 3526 if (node->left()->AsBinaryOperation() != NULL && |
| 3527 node->left()->AsBinaryOperation()->ResultOverwriteAllowed()) { | 3527 node->left()->AsBinaryOperation()->ResultOverwriteAllowed()) { |
| 3528 overwrite_mode = OVERWRITE_LEFT; | 3528 overwrite_mode = OVERWRITE_LEFT; |
| 3529 } else if (node->right()->AsBinaryOperation() != NULL && | 3529 } else if (node->right()->AsBinaryOperation() != NULL && |
| 3530 node->right()->AsBinaryOperation()->ResultOverwriteAllowed()) { | 3530 node->right()->AsBinaryOperation()->ResultOverwriteAllowed()) { |
| 3531 overwrite_mode = OVERWRITE_RIGHT; | 3531 overwrite_mode = OVERWRITE_RIGHT; |
| 3532 } | 3532 } |
| 3533 | 3533 |
| 3534 Load(node->left()); | 3534 if (node->left()->IsTrivial()) { |
| 3535 Load(node->right()); | 3535 Load(node->right()); |
| 3536 Result right = frame_->Pop(); |
| 3537 frame_->Push(node->left()); |
| 3538 frame_->Push(&right); |
| 3539 } else { |
| 3540 Load(node->left()); |
| 3541 Load(node->right()); |
| 3542 } |
| 3536 GenericBinaryOperation(node->op(), node->type(), overwrite_mode); | 3543 GenericBinaryOperation(node->op(), node->type(), overwrite_mode); |
| 3537 } | 3544 } |
| 3538 } | 3545 } |
| 3539 | 3546 |
| 3540 | 3547 |
| 3541 | 3548 |
| 3542 void CodeGenerator::VisitCompareOperation(CompareOperation* node) { | 3549 void CodeGenerator::VisitCompareOperation(CompareOperation* node) { |
| 3543 Comment cmnt(masm_, "[ CompareOperation"); | 3550 Comment cmnt(masm_, "[ CompareOperation"); |
| 3544 | 3551 |
| 3545 // Get the expressions from the node. | 3552 // Get the expressions from the node. |
| (...skipping 7380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10926 // Call the function from C++. | 10933 // Call the function from C++. |
| 10927 return FUNCTION_CAST<ModuloFunction>(buffer); | 10934 return FUNCTION_CAST<ModuloFunction>(buffer); |
| 10928 } | 10935 } |
| 10929 | 10936 |
| 10930 #endif | 10937 #endif |
| 10931 | 10938 |
| 10932 | 10939 |
| 10933 #undef __ | 10940 #undef __ |
| 10934 | 10941 |
| 10935 } } // namespace v8::internal | 10942 } } // namespace v8::internal |
| OLD | NEW |