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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/fast-codegen-arm.cc ('k') | src/fast-codegen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
===================================================================
--- src/compiler.cc (revision 3192)
+++ src/compiler.cc (working copy)
@@ -736,18 +736,36 @@
}
Variable* var = expr->target()->AsVariableProxy()->AsVariable();
- if (var == NULL) {
- Property* prop = expr->target()->AsProperty();
- if (prop == NULL) BAILOUT("non-variable, non-property assignment");
+ Property* prop = expr->target()->AsProperty();
+ if (var != NULL) {
+ // All global variables are supported.
+ if (!var->is_global()) {
+ if (var->slot() == NULL) {
+ // This is a parameter that has rewritten to an arguments access.
+ BAILOUT("non-global/non-slot assignment");
+ }
+ Slot::Type type = var->slot()->type();
+ if (type != Slot::PARAMETER && type != Slot::LOCAL) {
+ BAILOUT("non-parameter/non-local slot assignment");
+ }
+ }
+ } else if (prop != NULL) {
ProcessExpression(prop->obj(), Expression::kValue);
CHECK_BAILOUT;
- ProcessExpression(prop->key(), Expression::kValue);
- } else if (!var->is_global()) {
- if (var->slot() == NULL) BAILOUT("Assigment with an unsupported LHS.");
- Slot::Type type = var->slot()->type();
- if (type != Slot::PARAMETER && type != Slot::LOCAL) {
- BAILOUT("non-parameter/non-local slot assignment");
+ // We will only visit the key during code generation for keyed property
+ // stores. Leave its expression context uninitialized for named
+ // property stores.
+ Literal* lit = prop->key()->AsLiteral();
+ uint32_t ignored;
+ if (lit == NULL ||
+ !lit->handle()->IsSymbol() ||
+ String::cast(*(lit->handle()))->AsArrayIndex(&ignored)) {
+ ProcessExpression(prop->key(), Expression::kValue);
+ CHECK_BAILOUT;
}
+ } else {
+ // This is a throw reference error.
+ BAILOUT("non-variable/non-property assignment");
}
ProcessExpression(expr->value(), Expression::kValue);
« 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