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

Unified Diff: src/transitions.cc

Issue 10909007: Sharing of descriptor arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 8 years, 3 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/transitions.h ('k') | src/transitions-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/transitions.cc
diff --git a/src/transitions.cc b/src/transitions.cc
index 6f8b2fec5a9583a3785587c12f0a46ee5a3ab645..0ea58c7d5f530164611c5292658ac6a91d275bc0 100644
--- a/src/transitions.cc
+++ b/src/transitions.cc
@@ -35,14 +35,23 @@ namespace v8 {
namespace internal {
-MaybeObject* TransitionArray::Allocate(int number_of_transitions) {
+MaybeObject* TransitionArray::Allocate(int number_of_transitions,
+ JSGlobalPropertyCell* descriptors_cell) {
Heap* heap = Isolate::Current()->heap();
+
+ if (descriptors_cell == NULL) {
+ MaybeObject* maybe_cell =
+ heap->AllocateJSGlobalPropertyCell(heap->empty_descriptor_array());
+ if (!maybe_cell->To(&descriptors_cell)) return maybe_cell;
+ }
+
// Use FixedArray to not use DescriptorArray::cast on incomplete object.
FixedArray* array;
MaybeObject* maybe_array =
heap->AllocateFixedArray(ToKeyIndex(number_of_transitions));
if (!maybe_array->To(&array)) return maybe_array;
+ array->set(kDescriptorsPointerIndex, descriptors_cell);
array->set(kElementsTransitionIndex, Smi::FromInt(0));
array->set(kPrototypeTransitionsIndex, Smi::FromInt(0));
return array;
@@ -65,15 +74,20 @@ static bool InsertionPointFound(String* key1, String* key2) {
}
-MaybeObject* TransitionArray::NewWith(String* name, Map* target) {
+MaybeObject* TransitionArray::NewWith(
+ String* name,
+ Map* target,
+ JSGlobalPropertyCell* descriptors_pointer,
+ Object* back_pointer) {
TransitionArray* result;
- MaybeObject* maybe_array = TransitionArray::Allocate(1);
+ MaybeObject* maybe_array = TransitionArray::Allocate(1, descriptors_pointer);
if (!maybe_array->To(&result)) return maybe_array;
FixedArray::WhitenessWitness witness(result);
result->Set(0, name, target, witness);
+ result->set_back_pointer_storage(back_pointer);
return result;
}
@@ -88,7 +102,7 @@ MaybeObject* TransitionArray::CopyInsert(String* name, Map* target) {
if (insertion_index == kNotFound) ++new_size;
MaybeObject* maybe_array;
- maybe_array = TransitionArray::Allocate(new_size);
+ maybe_array = TransitionArray::Allocate(new_size, descriptors_pointer());
if (!maybe_array->To(&result)) return maybe_array;
if (HasElementsTransition()) {
@@ -121,6 +135,7 @@ MaybeObject* TransitionArray::CopyInsert(String* name, Map* target) {
result->CopyFrom(this, insertion_index, insertion_index + 1, witness);
}
+ result->set_back_pointer_storage(back_pointer_storage());
return result;
}
« no previous file with comments | « src/transitions.h ('k') | src/transitions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698