| Index: src/factory.cc
|
| diff --git a/src/factory.cc b/src/factory.cc
|
| index 462af590d2f02ab592062ffe5f943e2cf31fc812..a2bb9391ee64fb2bf8fe7332c39353d8fef19999 100644
|
| --- a/src/factory.cc
|
| +++ b/src/factory.cc
|
| @@ -112,10 +112,11 @@ Handle<ObjectHashTable> Factory::NewObjectHashTable(int at_least_space_for) {
|
| }
|
|
|
|
|
| -Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors) {
|
| +Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors,
|
| + int slack) {
|
| ASSERT(0 <= number_of_descriptors);
|
| CALL_HEAP_FUNCTION(isolate(),
|
| - DescriptorArray::Allocate(number_of_descriptors),
|
| + DescriptorArray::Allocate(number_of_descriptors, slack),
|
| DescriptorArray);
|
| }
|
|
|
| @@ -1284,10 +1285,26 @@ Handle<JSFunction> Factory::CreateApiFunction(
|
| result->shared()->DontAdaptArguments();
|
|
|
| // Recursively copy parent templates' accessors, 'data' may be modified.
|
| + int max_number_of_additional_properties = 0;
|
| + FunctionTemplateInfo* info = *obj;
|
| + while (true) {
|
| + Object* props = info->property_accessors();
|
| + if (!props->IsUndefined()) {
|
| + Handle<Object> props_handle(props);
|
| + NeanderArray props_array(props_handle);
|
| + max_number_of_additional_properties += props_array.length();
|
| + }
|
| + Object* parent = info->parent_template();
|
| + if (parent->IsUndefined()) break;
|
| + info = FunctionTemplateInfo::cast(parent);
|
| + }
|
| +
|
| + Map::EnsureDescriptorSlack(map, max_number_of_additional_properties);
|
| +
|
| while (true) {
|
| Handle<Object> props = Handle<Object>(obj->property_accessors());
|
| if (!props->IsUndefined()) {
|
| - Map::CopyAppendCallbackDescriptors(map, props);
|
| + Map::AppendCallbackDescriptors(map, props);
|
| }
|
| Handle<Object> parent = Handle<Object>(obj->parent_template());
|
| if (parent->IsUndefined()) break;
|
|
|