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; |
} |