Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(902)

Side by Side Diff: src/compiler.cc

Issue 342073: Refactor the somewhat complicated code generation for assignments into... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/fast-codegen-arm.cc ('k') | src/fast-codegen.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 BAILOUT("initialization block start"); 729 BAILOUT("initialization block start");
730 } 730 }
731 731
732 Token::Value op = expr->op(); 732 Token::Value op = expr->op();
733 if (op == Token::INIT_CONST) BAILOUT("initialize constant"); 733 if (op == Token::INIT_CONST) BAILOUT("initialize constant");
734 if (op != Token::ASSIGN && op != Token::INIT_VAR) { 734 if (op != Token::ASSIGN && op != Token::INIT_VAR) {
735 BAILOUT("compound assignment"); 735 BAILOUT("compound assignment");
736 } 736 }
737 737
738 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); 738 Variable* var = expr->target()->AsVariableProxy()->AsVariable();
739 if (var == NULL) { 739 Property* prop = expr->target()->AsProperty();
740 Property* prop = expr->target()->AsProperty(); 740 if (var != NULL) {
741 if (prop == NULL) BAILOUT("non-variable, non-property assignment"); 741 // All global variables are supported.
742 if (!var->is_global()) {
743 if (var->slot() == NULL) {
744 // This is a parameter that has rewritten to an arguments access.
745 BAILOUT("non-global/non-slot assignment");
746 }
747 Slot::Type type = var->slot()->type();
748 if (type != Slot::PARAMETER && type != Slot::LOCAL) {
749 BAILOUT("non-parameter/non-local slot assignment");
750 }
751 }
752 } else if (prop != NULL) {
742 ProcessExpression(prop->obj(), Expression::kValue); 753 ProcessExpression(prop->obj(), Expression::kValue);
743 CHECK_BAILOUT; 754 CHECK_BAILOUT;
744 ProcessExpression(prop->key(), Expression::kValue); 755 // We will only visit the key during code generation for keyed property
745 } else if (!var->is_global()) { 756 // stores. Leave its expression context uninitialized for named
746 if (var->slot() == NULL) BAILOUT("Assigment with an unsupported LHS."); 757 // property stores.
747 Slot::Type type = var->slot()->type(); 758 Literal* lit = prop->key()->AsLiteral();
748 if (type != Slot::PARAMETER && type != Slot::LOCAL) { 759 uint32_t ignored;
749 BAILOUT("non-parameter/non-local slot assignment"); 760 if (lit == NULL ||
761 !lit->handle()->IsSymbol() ||
762 String::cast(*(lit->handle()))->AsArrayIndex(&ignored)) {
763 ProcessExpression(prop->key(), Expression::kValue);
764 CHECK_BAILOUT;
750 } 765 }
766 } else {
767 // This is a throw reference error.
768 BAILOUT("non-variable/non-property assignment");
751 } 769 }
752 770
753 ProcessExpression(expr->value(), Expression::kValue); 771 ProcessExpression(expr->value(), Expression::kValue);
754 } 772 }
755 773
756 774
757 void CodeGenSelector::VisitThrow(Throw* expr) { 775 void CodeGenSelector::VisitThrow(Throw* expr) {
758 BAILOUT("Throw"); 776 BAILOUT("Throw");
759 } 777 }
760 778
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 947
930 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) { 948 void CodeGenSelector::VisitThisFunction(ThisFunction* expr) {
931 BAILOUT("ThisFunction"); 949 BAILOUT("ThisFunction");
932 } 950 }
933 951
934 #undef BAILOUT 952 #undef BAILOUT
935 #undef CHECK_BAILOUT 953 #undef CHECK_BAILOUT
936 954
937 955
938 } } // namespace v8::internal 956 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/fast-codegen-arm.cc ('k') | src/fast-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698