OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 expr->set_location(location_); | 734 expr->set_location(location_); |
735 } | 735 } |
736 | 736 |
737 | 737 |
738 void CodeGenSelector::VisitCatchExtensionObject(CatchExtensionObject* expr) { | 738 void CodeGenSelector::VisitCatchExtensionObject(CatchExtensionObject* expr) { |
739 BAILOUT("CatchExtensionObject"); | 739 BAILOUT("CatchExtensionObject"); |
740 } | 740 } |
741 | 741 |
742 | 742 |
743 void CodeGenSelector::VisitAssignment(Assignment* expr) { | 743 void CodeGenSelector::VisitAssignment(Assignment* expr) { |
744 // We support plain non-compound assignments to parameters and | 744 // We support plain non-compound assignments to properties, parameters and |
745 // non-context (stack-allocated) locals. | 745 // non-context (stack-allocated) locals, and global variables. |
746 if (expr->starts_initialization_block() || | 746 if (expr->starts_initialization_block() || |
747 expr->ends_initialization_block()) { | 747 expr->ends_initialization_block()) { |
748 BAILOUT("initialization block start"); | 748 BAILOUT("initialization block start"); |
749 } | 749 } |
750 | 750 |
751 Token::Value op = expr->op(); | 751 Token::Value op = expr->op(); |
752 if (op == Token::INIT_CONST) BAILOUT("initialize constant"); | 752 if (op == Token::INIT_CONST) BAILOUT("initialize constant"); |
753 if (op != Token::ASSIGN && op != Token::INIT_VAR) { | 753 if (op != Token::ASSIGN && op != Token::INIT_VAR) { |
754 BAILOUT("compound assignment"); | 754 BAILOUT("compound assignment"); |
755 } | 755 } |
756 | 756 |
757 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); | 757 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); |
758 if (var == NULL) BAILOUT("non-variable assignment"); | 758 if (var == NULL) { |
759 | 759 Property* prop = expr->target()->AsProperty(); |
760 if (!var->is_global()) { | 760 if (prop == NULL) BAILOUT("non-variable, non-property assignment"); |
761 ASSERT(var->slot() != NULL); | 761 VisitAsValue(prop->obj()); |
| 762 CHECK_BAILOUT; |
| 763 VisitAsValue(prop->key()); |
| 764 } else if (!var->is_global()) { |
| 765 if (var->slot() == NULL) BAILOUT("Assigment with an unsupported LHS."); |
762 Slot::Type type = var->slot()->type(); | 766 Slot::Type type = var->slot()->type(); |
763 if (type != Slot::PARAMETER && type != Slot::LOCAL) { | 767 if (type != Slot::PARAMETER && type != Slot::LOCAL) { |
764 BAILOUT("non-parameter/non-local slot assignment"); | 768 BAILOUT("non-parameter/non-local slot assignment"); |
765 } | 769 } |
766 } | 770 } |
767 | 771 |
768 VisitAsValue(expr->value()); | 772 VisitAsValue(expr->value()); |
769 expr->set_location(location_); | 773 expr->set_location(location_); |
770 } | 774 } |
771 | 775 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 | 897 |
894 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { | 898 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { |
895 BAILOUT("ThisFunction"); | 899 BAILOUT("ThisFunction"); |
896 } | 900 } |
897 | 901 |
898 #undef BAILOUT | 902 #undef BAILOUT |
899 #undef CHECK_BAILOUT | 903 #undef CHECK_BAILOUT |
900 | 904 |
901 | 905 |
902 } } // namespace v8::internal | 906 } } // namespace v8::internal |
OLD | NEW |