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

Unified Diff: src/typing.cc

Issue 332443002: Add support for computed property names in object literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Dynamic part of object literal initialized with PutOwnProperty Created 6 years, 6 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/typing.cc
diff --git a/src/typing.cc b/src/typing.cc
index 7762624b0739c542f4fc64da1ce46af1b388d8a8..2bcca833009bf9cfea74789975f555353355c4d5 100644
--- a/src/typing.cc
+++ b/src/typing.cc
@@ -400,12 +400,26 @@ void AstTyper::VisitObjectLiteral(ObjectLiteral* expr) {
ObjectLiteral::Property* prop = properties->at(i);
// Collect type feedback.
- if ((prop->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL &&
- !CompileTimeValue::IsCompileTimeValue(prop->value())) ||
- prop->kind() == ObjectLiteral::Property::COMPUTED) {
- if (prop->key()->value()->IsInternalizedString() && prop->emit_store()) {
- prop->RecordTypeFeedback(oracle());
- }
+ switch (prop->kind()) {
+ case ObjectLiteral::Property::MATERIALIZED_LITERAL:
+ if (CompileTimeValue::IsCompileTimeValue(prop->value())) break;
+ // Fall through.
+ case ObjectLiteral::Property::COMPUTED:
+ if (prop->key()->AsLiteral()->value()->IsInternalizedString() &&
+ prop->emit_store()) {
+ prop->RecordTypeFeedback(oracle());
+ }
+ break;
+
+ case ObjectLiteral::Property::COMPUTED_NAME:
+ RECURSE(Visit(prop->key()));
+ break;
+
+ case ObjectLiteral::Property::CONSTANT:
+ case ObjectLiteral::Property::PROTOTYPE:
+ case ObjectLiteral::Property::GETTER:
+ case ObjectLiteral::Property::SETTER:
+ break;
}
RECURSE(Visit(prop->value()));

Powered by Google App Engine
This is Rietveld 408576698