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

Unified Diff: src/ast.h

Issue 546006: Some cleanup of the toplevel code generator:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 months 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
Index: src/ast.h
===================================================================
--- src/ast.h (revision 3576)
+++ src/ast.h (working copy)
@@ -187,6 +187,11 @@
virtual bool IsValidJSON() { return false; }
virtual bool IsValidLeftHandSide() { return false; }
+ // Symbols that cannot be parsed as array indices are considered property
+ // names. We do not treat symbols that can be array indexes as property
+ // names because [] for string objects is handled only by keyed ICs.
+ virtual bool IsPropertyName() { return false; }
+
// Mark the expression as being compiled as an expression
// statement. This is used to transform postfix increments to
// (faster) prefix increments.
@@ -707,6 +712,14 @@
virtual bool IsValidJSON() { return true; }
+ virtual bool IsPropertyName() {
+ if (handle_->IsSymbol()) {
+ uint32_t ignored;
+ return !String::cast(*handle_)->AsArrayIndex(&ignored);
+ }
+ return false;
+ }
+
// Identity testers.
bool IsNull() const { return handle_.is_identical_to(Factory::null_value()); }
bool IsTrue() const { return handle_.is_identical_to(Factory::true_value()); }

Powered by Google App Engine
This is Rietveld 408576698