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

Side by Side Diff: src/objects-inl.h

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 desc->GetKey()); 2103 desc->GetKey());
2104 NoIncrementalWriteBarrierSet(this, 2104 NoIncrementalWriteBarrierSet(this,
2105 ToValueIndex(descriptor_number), 2105 ToValueIndex(descriptor_number),
2106 desc->GetValue()); 2106 desc->GetValue());
2107 NoIncrementalWriteBarrierSet(this, 2107 NoIncrementalWriteBarrierSet(this,
2108 ToDetailsIndex(descriptor_number), 2108 ToDetailsIndex(descriptor_number),
2109 desc->GetDetails().AsSmi()); 2109 desc->GetDetails().AsSmi());
2110 } 2110 }
2111 2111
2112 2112
2113 void DescriptorArray::Append(Descriptor* desc, 2113 int DescriptorArray::Append(Descriptor* desc,
2114 const WhitenessWitness& witness) { 2114 const WhitenessWitness& witness,
2115 int descriptor_number = NumberOfSetDescriptors(); 2115 int number_of_set_descriptors) {
2116 int descriptor_number = number_of_set_descriptors;
2116 int enumeration_index = descriptor_number + 1; 2117 int enumeration_index = descriptor_number + 1;
2117 desc->SetEnumerationIndex(enumeration_index); 2118 desc->SetEnumerationIndex(enumeration_index);
2118 2119
2119 uint32_t hash = desc->GetKey()->Hash(); 2120 uint32_t hash = desc->GetKey()->Hash();
2120 2121
2121 for (; descriptor_number > 0; --descriptor_number) { 2122 for (; descriptor_number > 0; --descriptor_number) {
2122 String* key = GetKey(descriptor_number - 1); 2123 String* key = GetKey(descriptor_number - 1);
2123 if (key->Hash() <= hash) break; 2124 if (key->Hash() <= hash) break;
2124 Object* value = GetValue(descriptor_number - 1); 2125 Object* value = GetValue(descriptor_number - 1);
2125 PropertyDetails details = GetDetails(descriptor_number - 1); 2126 PropertyDetails details = GetDetails(descriptor_number - 1);
2126 Descriptor moved_descriptor(key, value, details); 2127 Descriptor moved_descriptor(key, value, details);
2127 Set(descriptor_number, &moved_descriptor, witness); 2128 Set(descriptor_number, &moved_descriptor, witness);
2128 } 2129 }
2129 2130
2130 Set(descriptor_number, desc, witness); 2131 Set(descriptor_number, desc, witness);
2131 SetLastAdded(descriptor_number); 2132 return descriptor_number;
2132 } 2133 }
2133 2134
2134 2135
2135 void DescriptorArray::NoIncrementalWriteBarrierSwapDescriptors( 2136 void DescriptorArray::NoIncrementalWriteBarrierSwapDescriptors(
2136 int first, int second) { 2137 int first, int second) {
2137 NoIncrementalWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second)); 2138 NoIncrementalWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second));
2138 NoIncrementalWriteBarrierSwap(this, 2139 NoIncrementalWriteBarrierSwap(this,
2139 ToValueIndex(first), 2140 ToValueIndex(first),
2140 ToValueIndex(second)); 2141 ToValueIndex(second));
2141 NoIncrementalWriteBarrierSwap(this, 2142 NoIncrementalWriteBarrierSwap(this,
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
3547 } else { 3548 } else {
3548 ASSERT(object->IsMap() || object->IsUndefined()); 3549 ASSERT(object->IsMap() || object->IsUndefined());
3549 } 3550 }
3550 #endif 3551 #endif
3551 WRITE_FIELD(this, kInstanceDescriptorsOrBackPointerOffset, back_pointer); 3552 WRITE_FIELD(this, kInstanceDescriptorsOrBackPointerOffset, back_pointer);
3552 CONDITIONAL_WRITE_BARRIER( 3553 CONDITIONAL_WRITE_BARRIER(
3553 heap, this, kInstanceDescriptorsOrBackPointerOffset, back_pointer, mode); 3554 heap, this, kInstanceDescriptorsOrBackPointerOffset, back_pointer, mode);
3554 } 3555 }
3555 3556
3556 3557
3558 void Map::AppendDescriptor(Descriptor* desc,
3559 const DescriptorArray::WhitenessWitness& witness) {
3560 DescriptorArray* descriptors = instance_descriptors();
3561 int set_descriptors = descriptors->NumberOfSetDescriptors();
3562 int new_last_added = descriptors->Append(desc, witness, set_descriptors);
3563 descriptors->SetLastAdded(new_last_added);
3564 }
3565
3557 3566
3558 Object* Map::GetBackPointer() { 3567 Object* Map::GetBackPointer() {
3559 Object* object = READ_FIELD(this, kInstanceDescriptorsOrBackPointerOffset); 3568 Object* object = READ_FIELD(this, kInstanceDescriptorsOrBackPointerOffset);
3560 if (object->IsDescriptorArray()) { 3569 if (object->IsDescriptorArray()) {
3561 return DescriptorArray::cast(object)->back_pointer_storage(); 3570 return DescriptorArray::cast(object)->back_pointer_storage();
3562 } else { 3571 } else {
3563 ASSERT(object->IsMap() || object->IsUndefined()); 3572 ASSERT(object->IsMap() || object->IsUndefined());
3564 return object; 3573 return object;
3565 } 3574 }
3566 } 3575 }
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after
5369 #undef WRITE_UINT32_FIELD 5378 #undef WRITE_UINT32_FIELD
5370 #undef READ_SHORT_FIELD 5379 #undef READ_SHORT_FIELD
5371 #undef WRITE_SHORT_FIELD 5380 #undef WRITE_SHORT_FIELD
5372 #undef READ_BYTE_FIELD 5381 #undef READ_BYTE_FIELD
5373 #undef WRITE_BYTE_FIELD 5382 #undef WRITE_BYTE_FIELD
5374 5383
5375 5384
5376 } } // namespace v8::internal 5385 } } // namespace v8::internal
5377 5386
5378 #endif // V8_OBJECTS_INL_H_ 5387 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698