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

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

Issue 2632503003: [runtime] Allocate space for computed property names (Closed)
Patch Set: Fix some variable names. 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 5ce82407ca79bd54b3e7219c97b3062e2c017117..033fe40fbf7dd46b53453b5a98502e814c21ac69 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -2528,6 +2528,8 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseObjectLiteral(
typename Types::ObjectPropertyList properties =
impl()->NewObjectPropertyList(4);
int number_of_boilerplate_properties = 0;
+ int number_of_total_properties = 0;
+
bool has_computed_names = false;
ObjectLiteralChecker checker(this);
@@ -2544,9 +2546,13 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseObjectLiteral(
has_computed_names = true;
}
- // Count CONSTANT or COMPUTED properties to maintain the enumeration order.
- if (!has_computed_names && impl()->IsBoilerplateProperty(property)) {
- number_of_boilerplate_properties++;
+ if (impl()->IsBoilerplateProperty(property)) {
+ number_of_total_properties++;
Toon Verwaest 2017/01/18 08:49:53 So this isn't needed given we do properties->Add a
Franzi 2017/01/18 14:23:10 Deleted.
+ // Count CONSTANT or COMPUTED properties to maintain the enumeration
+ // order.
+ if (!has_computed_names) {
+ number_of_boilerplate_properties++;
+ }
}
properties->Add(property, zone());
@@ -2562,10 +2568,9 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseObjectLiteral(
// Computation of literal_index must happen before pre parse bailout.
int literal_index = function_state_->NextMaterializedLiteralIndex();
- return factory()->NewObjectLiteral(properties,
- literal_index,
+ return factory()->NewObjectLiteral(properties, literal_index,
number_of_boilerplate_properties,
- pos);
+ number_of_total_properties, pos);
}
template <typename Impl>
« src/objects.cc ('K') | « src/objects-inl.h ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698