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

Unified Diff: src/parsing/parser-base.h

Issue 2632503003: [runtime] Allocate space for computed property names (Closed)
Patch Set: Fix typo. Created 3 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/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index a10d1183dc2c32002877777d8cc79d96829e417d..01836946a763b2bc5d63fa75b665a0568fd05495 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -2540,6 +2540,8 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseObjectLiteral(
typename Types::ObjectPropertyList properties =
impl()->NewObjectPropertyList(4);
int number_of_boilerplate_properties = 0;
+ bool has_seen_proto = false;
+
bool has_computed_names = false;
bool has_rest_property = false;
ObjectLiteralChecker checker(this);
@@ -2562,10 +2564,14 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseObjectLiteral(
has_rest_property = true;
}
- // Count CONSTANT or COMPUTED properties to maintain the enumeration order.
- if (!has_computed_names && impl()->IsBoilerplateProperty(property)) {
+ if (!impl()->IsBoilerplateProperty(property)) {
+ has_seen_proto = true;
+ } else if (!has_computed_names) {
+ // Count CONSTANT or COMPUTED properties to maintain the enumeration
+ // order.
number_of_boilerplate_properties++;
}
+
properties->Add(property, zone());
if (peek() != Token::RBRACE) {
@@ -2581,8 +2587,8 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseObjectLiteral(
int literal_index = function_state_->NextMaterializedLiteralIndex();
return factory()->NewObjectLiteral(properties, literal_index,
- number_of_boilerplate_properties, pos,
- has_rest_property);
+ number_of_boilerplate_properties,
+ has_seen_proto, pos, has_rest_property);
}
template <typename Impl>
« no previous file with comments | « src/objects-inl.h ('k') | src/parsing/preparser.h » ('j') | src/runtime/runtime-literals.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698