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

Unified Diff: src/ast/ast.cc

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/ast/ast.cc
diff --git a/src/ast/ast.cc b/src/ast/ast.cc
index c63f90ecf11f398ebfdecf5c6fd25356dd934f83..173d4059e94ef6f56051ee390ef4ec76714febad 100644
--- a/src/ast/ast.cc
+++ b/src/ast/ast.cc
@@ -582,9 +582,10 @@ void ObjectLiteral::InitDepthAndFlags() {
void ObjectLiteral::BuildConstantProperties(Isolate* isolate) {
if (!constant_properties_.is_null()) return;
- // Allocate a fixed array to hold all the constant properties.
- Handle<FixedArray> constant_properties =
- isolate->factory()->NewFixedArray(boilerplate_properties_ * 2, TENURED);
+ // Allocate a fixed array to hold all the constant properties and the number
+ // of total properties.
+ Handle<FixedArray> constant_properties = isolate->factory()->NewFixedArray(
+ boilerplate_properties_ * 2 + 1, TENURED);
int position = 0;
for (int i = 0; i < properties()->length(); i++) {
@@ -622,6 +623,10 @@ void ObjectLiteral::BuildConstantProperties(Isolate* isolate) {
constant_properties->set(position++, *value);
}
+ Handle<Object> total_properties = isolate->factory()->NewNumberFromInt(
+ properties()->length() - (has_seen_proto() ? 1 : 0));
+ constant_properties->set(position, *total_properties);
+
constant_properties_ = constant_properties;
}
« no previous file with comments | « src/ast/ast.h ('k') | src/compiler/access-info.cc » ('j') | src/runtime/runtime-literals.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698