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

Unified Diff: src/factory.cc

Issue 2632503003: [runtime] Allocate space for computed property names (Closed)
Patch Set: Comments and reorder. 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
« no previous file with comments | « src/factory.h ('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 47f965be7daf1555eb25b1cd1f34971626a9d705..8e8c45170fb06f56e0542733a8caef5e28cdbad2 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -185,6 +185,31 @@ Handle<FixedArray> Factory::NewUninitializedFixedArray(int size) {
FixedArray);
}
+Handle<BoilerplateDescription> Factory::NewBoilerplateDescription(
+ int boilerplate, int all_properties, bool has_seen_proto) {
+ DCHECK_GE(all_properties, boilerplate);
+
+ int backing_store_size = all_properties - (has_seen_proto ? 1 : 0);
+ DCHECK_GE(backing_store_size, 0);
+ bool has_different_size_backing_store = boilerplate != backing_store_size;
+
+ // Space for name and value for every boilerplate property.
+ int size = 2 * boilerplate;
+
+ if (has_different_size_backing_store) {
+ // An extra entry for the backing store size.
+ size++;
+ }
+
+ Handle<BoilerplateDescription> description =
+ Handle<BoilerplateDescription>::cast(NewFixedArray(size, TENURED));
+
+ if (has_different_size_backing_store) {
+ DCHECK((boilerplate != all_properties) || has_seen_proto);
+ description->set_backing_store_size(isolate(), backing_store_size);
+ }
+ return description;
+}
Handle<FixedArrayBase> Factory::NewFixedDoubleArray(int size,
PretenureFlag pretenure) {
« no previous file with comments | « src/factory.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698