| OLD | NEW |
| 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 7426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7437 case INTERCEPTOR: | 7437 case INTERCEPTOR: |
| 7438 return false; | 7438 return false; |
| 7439 case NONEXISTENT: | 7439 case NONEXISTENT: |
| 7440 break; | 7440 break; |
| 7441 } | 7441 } |
| 7442 UNREACHABLE(); | 7442 UNREACHABLE(); |
| 7443 return true; | 7443 return true; |
| 7444 } | 7444 } |
| 7445 | 7445 |
| 7446 | 7446 |
| 7447 // TODO(mstarzinger): This method should be moved into MarkCompactCollector, |
| 7448 // because it cannot be called from outside the GC and we already have methods |
| 7449 // depending on the transitions layout in the GC anyways. |
| 7447 void Map::ClearNonLiveTransitions(Heap* heap) { | 7450 void Map::ClearNonLiveTransitions(Heap* heap) { |
| 7448 Object* array = *RawField(this, Map::kInstanceDescriptorsOrBitField3Offset); | 7451 Object* array = *RawField(this, Map::kInstanceDescriptorsOrBitField3Offset); |
| 7449 // If there are no descriptors to be cleared, return. | 7452 // If there are no descriptors to be cleared, return. |
| 7450 // TODO(verwaest) Should be an assert, otherwise back pointers are not | 7453 // TODO(verwaest) Should be an assert, otherwise back pointers are not |
| 7451 // properly cleared. | 7454 // properly cleared. |
| 7452 if (array->IsSmi()) return; | 7455 if (array->IsSmi()) return; |
| 7453 DescriptorArray* d = DescriptorArray::cast(array); | 7456 DescriptorArray* d = DescriptorArray::cast(array); |
| 7454 | 7457 |
| 7455 int descriptor_index = 0; | 7458 int descriptor_index = 0; |
| 7456 // Compact all live descriptors to the left. | 7459 // Compact all live descriptors to the left. |
| 7457 for (int i = 0; i < d->number_of_descriptors(); ++i) { | 7460 for (int i = 0; i < d->number_of_descriptors(); ++i) { |
| 7458 if (!ClearNonLiveTransitionsFromDescriptor(heap, d, i)) { | 7461 if (!ClearNonLiveTransitionsFromDescriptor(heap, d, i)) { |
| 7459 if (i != descriptor_index) { | 7462 if (i != descriptor_index) { |
| 7460 d->SetKeyUnchecked(heap, descriptor_index, d->GetKey(i)); | 7463 String* key = d->GetKey(i); |
| 7464 Object* value = d->GetValue(i); |
| 7465 d->SetKeyUnchecked(heap, descriptor_index, key); |
| 7461 d->SetDetailsUnchecked(descriptor_index, d->GetDetails(i).AsSmi()); | 7466 d->SetDetailsUnchecked(descriptor_index, d->GetDetails(i).AsSmi()); |
| 7462 d->SetValueUnchecked(heap, descriptor_index, d->GetValue(i)); | 7467 d->SetValueUnchecked(heap, descriptor_index, value); |
| 7468 MarkCompactCollector* collector = heap->mark_compact_collector(); |
| 7469 Object** key_slot = d->GetKeySlot(descriptor_index); |
| 7470 collector->RecordSlot(key_slot, key_slot, key); |
| 7471 if (value->IsHeapObject()) { |
| 7472 Object** value_slot = d->GetValueSlot(descriptor_index); |
| 7473 collector->RecordSlot(value_slot, value_slot, value); |
| 7474 } |
| 7463 } | 7475 } |
| 7464 descriptor_index++; | 7476 descriptor_index++; |
| 7465 } | 7477 } |
| 7466 } | 7478 } |
| 7467 | 7479 |
| 7468 Map* elements_transition = d->elements_transition_map(); | 7480 Map* elements_transition = d->elements_transition_map(); |
| 7469 if (elements_transition != NULL && | 7481 if (elements_transition != NULL && |
| 7470 ClearBackPointer(heap, elements_transition)) { | 7482 ClearBackPointer(heap, elements_transition)) { |
| 7471 elements_transition = NULL; | 7483 elements_transition = NULL; |
| 7472 d->ClearElementsTransition(); | 7484 d->ClearElementsTransition(); |
| (...skipping 5892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13365 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13377 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
| 13366 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13378 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
| 13367 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13379 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
| 13368 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13380 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
| 13369 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13381 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
| 13370 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13382 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
| 13371 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13383 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
| 13372 } | 13384 } |
| 13373 | 13385 |
| 13374 } } // namespace v8::internal | 13386 } } // namespace v8::internal |
| OLD | NEW |