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

Unified Diff: src/objects-inl.h

Issue 7033024: Add bit_field3 to Map objects (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 years, 7 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/objects-debug.cc ('k') | src/profile-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 841fcbc0f335d12d4f97d0cd45cd0c2673acf59a..3828db82f01bcb022cade9e25a56607b4b6e8068 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1674,9 +1674,21 @@ Object** FixedArray::data_start() {
bool DescriptorArray::IsEmpty() {
- ASSERT(this->length() > kFirstIndex ||
+ ASSERT(this->IsSmi() ||
+ this->length() > kFirstIndex ||
this == HEAP->empty_descriptor_array());
- return length() <= kFirstIndex;
+ return this->IsSmi() || length() <= kFirstIndex;
+}
+
+
+int DescriptorArray::bit_field3_storage() {
+ Object* storage = READ_FIELD(this, kBitField3StorageOffset);
+ return Smi::cast(storage)->value();
+}
+
+void DescriptorArray::set_bit_field3_storage(int value) {
+ ASSERT(!IsEmpty());
+ WRITE_FIELD(this, kBitField3StorageOffset, Smi::FromInt(value));
}
@@ -2967,8 +2979,82 @@ MaybeObject* Map::GetSlowElementsMap() {
}
-ACCESSORS(Map, instance_descriptors, DescriptorArray,
- kInstanceDescriptorsOffset)
+DescriptorArray* Map::instance_descriptors() {
+ Object* object = READ_FIELD(this, kInstanceDescriptorsOrBitField3Offset);
+ if (object->IsSmi()) {
+ return HEAP->empty_descriptor_array();
+ } else {
+ return DescriptorArray::cast(object);
+ }
+}
+
+
+void Map::init_instance_descriptors() {
+ WRITE_FIELD(this, kInstanceDescriptorsOrBitField3Offset, Smi::FromInt(0));
+}
+
+
+void Map::clear_instance_descriptors() {
+ Object* object = READ_FIELD(this,
+ kInstanceDescriptorsOrBitField3Offset);
+ if (!object->IsSmi()) {
+ WRITE_FIELD(
+ this,
+ kInstanceDescriptorsOrBitField3Offset,
+ Smi::FromInt(DescriptorArray::cast(object)->bit_field3_storage()));
+ }
+}
+
+
+void Map::set_instance_descriptors(DescriptorArray* value,
+ WriteBarrierMode mode) {
+ Object* object = READ_FIELD(this,
+ kInstanceDescriptorsOrBitField3Offset);
+ if (value == isolate()->heap()->empty_descriptor_array()) {
+ clear_instance_descriptors();
+ return;
+ } else {
+ if (object->IsSmi()) {
+ value->set_bit_field3_storage(Smi::cast(object)->value());
+ } else {
+ value->set_bit_field3_storage(
+ DescriptorArray::cast(object)->bit_field3_storage());
+ }
+ }
+ ASSERT(!is_shared());
+ WRITE_FIELD(this, kInstanceDescriptorsOrBitField3Offset, value);
+ CONDITIONAL_WRITE_BARRIER(GetHeap(),
+ this,
+ kInstanceDescriptorsOrBitField3Offset,
+ mode);
+}
+
+
+int Map::bit_field3() {
+ Object* object = READ_FIELD(this,
+ kInstanceDescriptorsOrBitField3Offset);
+ if (object->IsSmi()) {
+ return Smi::cast(object)->value();
+ } else {
+ return DescriptorArray::cast(object)->bit_field3_storage();
+ }
+}
+
+
+void Map::set_bit_field3(int value) {
+ ASSERT(Smi::IsValid(value));
+ Object* object = READ_FIELD(this,
+ kInstanceDescriptorsOrBitField3Offset);
+ if (object->IsSmi()) {
+ WRITE_FIELD(this,
+ kInstanceDescriptorsOrBitField3Offset,
+ Smi::FromInt(value));
+ } else {
+ DescriptorArray::cast(object)->set_bit_field3_storage(value);
+ }
+}
+
+
ACCESSORS(Map, code_cache, Object, kCodeCacheOffset)
ACCESSORS(Map, prototype_transitions, FixedArray, kPrototypeTransitionsOffset)
ACCESSORS(Map, constructor, Object, kConstructorOffset)
« no previous file with comments | « src/objects-debug.cc ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698