Commit 82631263 authored by franzih's avatar franzih Committed by Commit bot

[ast] Simplify NewBoilerplateDescription.

The property backing store size depends on the number of
index keys. Pass index keys to the factory function instead
calculating the size outside.

R=verwaest@chromium.org

BUG=v8:5625

Review-Url: https://codereview.chromium.org/2651533002
Cr-Commit-Position: refs/heads/master@{#42637}
parent 77705776
......@@ -604,9 +604,9 @@ void ObjectLiteral::BuildConstantProperties(Isolate* isolate) {
}
Handle<BoilerplateDescription> constant_properties =
isolate->factory()->NewBoilerplateDescription(
boilerplate_properties_, properties()->length() - index_keys,
has_seen_proto);
isolate->factory()->NewBoilerplateDescription(boilerplate_properties_,
properties()->length(),
index_keys, has_seen_proto);
int position = 0;
for (int i = 0; i < properties()->length(); i++) {
......
......@@ -186,10 +186,13 @@ Handle<FixedArray> Factory::NewUninitializedFixedArray(int size) {
}
Handle<BoilerplateDescription> Factory::NewBoilerplateDescription(
int boilerplate, int all_properties, bool has_seen_proto) {
DCHECK_GE(all_properties, 0);
int boilerplate, int all_properties, int index_keys, bool has_seen_proto) {
DCHECK_GE(boilerplate, 0);
DCHECK_GE(all_properties, index_keys);
DCHECK_GE(index_keys, 0);
int backing_store_size = all_properties - (has_seen_proto ? 1 : 0);
int backing_store_size =
all_properties - index_keys - (has_seen_proto ? 1 : 0);
DCHECK_GE(backing_store_size, 0);
bool has_different_size_backing_store = boilerplate != backing_store_size;
......@@ -205,7 +208,7 @@ Handle<BoilerplateDescription> Factory::NewBoilerplateDescription(
Handle<BoilerplateDescription>::cast(NewFixedArray(size, TENURED));
if (has_different_size_backing_store) {
DCHECK((boilerplate != all_properties) || has_seen_proto);
DCHECK((boilerplate != (all_properties - index_keys)) || has_seen_proto);
description->set_backing_store_size(isolate(), backing_store_size);
}
return description;
......
......@@ -52,6 +52,7 @@ class V8_EXPORT_PRIVATE Factory final {
// calculates the number of properties we need to store in the backing store.
Handle<BoilerplateDescription> NewBoilerplateDescription(int boilerplate,
int all_properties,
int index_keys,
bool has_seen_proto);
// Allocate a new uninitialized fixed double array.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment