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

Unified Diff: src/objects-inl.h

Issue 10575032: In-place shrinking of descriptor arrays with non-live transitions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing comments Created 8 years, 6 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
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 2cdfad6fb2c1b4f7d2bf4c024781aac82dedb31c..abb2060bc72229f2c6b72b849186490bff5a91dc 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1863,7 +1863,7 @@ void FixedArray::set_unchecked(Heap* heap,
void FixedArray::set_null_unchecked(Heap* heap, int index) {
ASSERT(index >= 0 && index < this->length());
- ASSERT(!HEAP->InNewSpace(heap->null_value()));
+ ASSERT(!heap->InNewSpace(heap->null_value()));
WRITE_FIELD(this, kHeaderSize + index * kPointerSize, heap->null_value());
}
@@ -1976,6 +1976,17 @@ String* DescriptorArray::GetKey(int descriptor_number) {
}
+void DescriptorArray::SetKeyUnchecked(Heap* heap,
+ int descriptor_number,
+ String* key) {
+ ASSERT(descriptor_number < number_of_descriptors());
+ set_unchecked(heap,
+ ToKeyIndex(descriptor_number),
+ key,
+ UPDATE_WRITE_BARRIER);
+}
+
+
Object** DescriptorArray::GetValueSlot(int descriptor_number) {
ASSERT(descriptor_number < number_of_descriptors());
return HeapObject::RawField(
@@ -1990,12 +2001,24 @@ Object* DescriptorArray::GetValue(int descriptor_number) {
}
-void DescriptorArray::SetNullValueUnchecked(int descriptor_number, Heap* heap) {
+void DescriptorArray::SetNullValueUnchecked(Heap* heap, int descriptor_number) {
ASSERT(descriptor_number < number_of_descriptors());
set_null_unchecked(heap, ToValueIndex(descriptor_number));
}
+
+void DescriptorArray::SetValueUnchecked(Heap* heap,
+ int descriptor_number,
+ Object* value) {
+ ASSERT(descriptor_number < number_of_descriptors());
+ set_unchecked(heap,
+ ToValueIndex(descriptor_number),
+ value,
+ UPDATE_WRITE_BARRIER);
+}
+
+
PropertyDetails DescriptorArray::GetDetails(int descriptor_number) {
ASSERT(descriptor_number < number_of_descriptors());
Object* details = get(ToDetailsIndex(descriptor_number));
@@ -2059,19 +2082,16 @@ bool DescriptorArray::IsTransitionOnly(int descriptor_number) {
case CONSTANT_FUNCTION:
case HANDLER:
case INTERCEPTOR:
- case NULL_DESCRIPTOR:
return false;
+ case NONEXISTENT:
+ UNREACHABLE();
+ break;
}
UNREACHABLE(); // Keep the compiler happy.
return false;
}
-bool DescriptorArray::IsNullDescriptor(int descriptor_number) {
- return GetType(descriptor_number) == NULL_DESCRIPTOR;
-}
-
-
void DescriptorArray::Get(int descriptor_number, Descriptor* desc) {
desc->Init(GetKey(descriptor_number),
GetValue(descriptor_number),
@@ -3464,10 +3484,23 @@ int Map::bit_field3() {
}
+void Map::ClearDescriptorArray() {
+ int bitfield3 = bit_field3();
+#ifdef DEBUG
+ Object* object = READ_FIELD(this, kInstanceDescriptorsOrBitField3Offset);
+ if (!object->IsSmi()) {
+ ZapInstanceDescriptors();
+ }
+#endif
+ WRITE_FIELD(this,
+ kInstanceDescriptorsOrBitField3Offset,
+ Smi::FromInt(bitfield3));
+}
+
+
void Map::set_bit_field3(int value) {
ASSERT(Smi::IsValid(value));
- Object* object = READ_FIELD(this,
- kInstanceDescriptorsOrBitField3Offset);
+ Object* object = READ_FIELD(this, kInstanceDescriptorsOrBitField3Offset);
if (object->IsSmi()) {
WRITE_FIELD(this,
kInstanceDescriptorsOrBitField3Offset,
« src/objects.cc ('K') | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698