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

Unified Diff: src/factory.cc

Issue 10800033: Append to descriptors over map. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 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
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index b0fa5f05454996ddda1d08250e01c5c301e2b0ac..5fefaae47d9ee842a1b96130fb8ffb553a94a0ea 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -912,6 +912,8 @@ void Factory::CopyAppendCallbackDescriptors(Handle<Map> map,
}
}
+ map->set_instance_descriptors(*result);
+
// Fill in new callback descriptors. Process the callbacks from
// back to front so that the last callback with a given name takes
// precedence over previously added callbacks with that name.
@@ -925,13 +927,16 @@ void Factory::CopyAppendCallbackDescriptors(Handle<Map> map,
if (LinearSearch(*result, *key, result->NumberOfSetDescriptors()) ==
DescriptorArray::kNotFound) {
CallbacksDescriptor desc(*key, *entry, entry->property_attributes());
- result->Append(&desc, witness);
+ map->AppendDescriptor(&desc, witness);
}
}
int new_number_of_descriptors = result->NumberOfSetDescriptors();
- // Don't replace the descriptor array if there were no new elements.
- if (new_number_of_descriptors == descriptor_count) return;
+ // Reinstall the original descriptor array if no new elements were added.
+ if (new_number_of_descriptors == descriptor_count) {
+ map->set_instance_descriptors(*array);
+ return;
+ }
// If duplicates were detected, allocate a result of the right size
// and transfer the elements.
@@ -942,10 +947,8 @@ void Factory::CopyAppendCallbackDescriptors(Handle<Map> map,
new_result->CopyFrom(i, *result, i, witness);
}
new_result->SetLastAdded(result->LastAdded());
- result = new_result;
+ map->set_instance_descriptors(*new_result);
}
-
- map->set_instance_descriptors(*result);
}
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698