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

Side by Side Diff: src/objects.cc

Issue 10387231: ClearNonLiveTransitions indepedent of ContentArray (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase 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 unified diff | Download patch | Annotate | Revision Log
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 7412 matching lines...) Expand 10 before | Expand all | Expand 10 after
7423 } 7423 }
7424 } 7424 }
7425 7425
7426 7426
7427 void Map::ClearNonLiveTransitions(Heap* heap) { 7427 void Map::ClearNonLiveTransitions(Heap* heap) {
7428 DescriptorArray* d = DescriptorArray::cast( 7428 DescriptorArray* d = DescriptorArray::cast(
7429 *RawField(this, Map::kInstanceDescriptorsOrBitField3Offset)); 7429 *RawField(this, Map::kInstanceDescriptorsOrBitField3Offset));
7430 if (d->IsEmpty()) return; 7430 if (d->IsEmpty()) return;
7431 Smi* NullDescriptorDetails = 7431 Smi* NullDescriptorDetails =
7432 PropertyDetails(NONE, NULL_DESCRIPTOR).AsSmi(); 7432 PropertyDetails(NONE, NULL_DESCRIPTOR).AsSmi();
7433 FixedArray* contents = FixedArray::cast( 7433 for (int i = 0; i < d->number_of_descriptors(); ++i) {
7434 d->get(DescriptorArray::kContentArrayIndex));
7435 ASSERT(contents->length() >= 2);
7436 for (int i = 0; i < contents->length(); i += 2) {
7437 // If the pair (value, details) is a map transition, check if the target is 7434 // If the pair (value, details) is a map transition, check if the target is
7438 // live. If not, null the descriptor. Also drop the back pointer for that 7435 // live. If not, null the descriptor. Also drop the back pointer for that
7439 // map transition, so that this map is not reached again by following a back 7436 // map transition, so that this map is not reached again by following a back
7440 // pointer from that non-live map. 7437 // pointer from that non-live map.
7441 bool keep_entry = false; 7438 bool keep_entry = false;
7442 PropertyDetails details(Smi::cast(contents->get(i + 1))); 7439 PropertyDetails details(d->GetDetails(i));
7443 switch (details.type()) { 7440 switch (details.type()) {
7444 case MAP_TRANSITION: 7441 case MAP_TRANSITION:
7445 case CONSTANT_TRANSITION: 7442 case CONSTANT_TRANSITION:
7446 ClearBackPointer(heap, contents->get(i), &keep_entry); 7443 ClearBackPointer(heap, d->GetValue(i), &keep_entry);
7447 break; 7444 break;
7448 case ELEMENTS_TRANSITION: { 7445 case ELEMENTS_TRANSITION: {
7449 Object* object = contents->get(i); 7446 Object* object = d->GetValue(i);
7450 if (object->IsMap()) { 7447 if (object->IsMap()) {
7451 ClearBackPointer(heap, object, &keep_entry); 7448 ClearBackPointer(heap, object, &keep_entry);
7452 } else { 7449 } else {
7453 FixedArray* array = FixedArray::cast(object); 7450 FixedArray* array = FixedArray::cast(object);
7454 for (int j = 0; j < array->length(); ++j) { 7451 for (int j = 0; j < array->length(); ++j) {
7455 if (ClearBackPointer(heap, array->get(j), &keep_entry)) { 7452 if (ClearBackPointer(heap, array->get(j), &keep_entry)) {
7456 array->set_undefined(j); 7453 array->set_undefined(j);
7457 } 7454 }
7458 } 7455 }
7459 } 7456 }
7460 break; 7457 break;
7461 } 7458 }
7462 case CALLBACKS: { 7459 case CALLBACKS: {
7463 Object* object = contents->get(i); 7460 Object* object = d->GetValue(i);
7464 if (object->IsAccessorPair()) { 7461 if (object->IsAccessorPair()) {
7465 AccessorPair* accessors = AccessorPair::cast(object); 7462 AccessorPair* accessors = AccessorPair::cast(object);
7466 if (ClearBackPointer(heap, accessors->getter(), &keep_entry)) { 7463 if (ClearBackPointer(heap, accessors->getter(), &keep_entry)) {
7467 accessors->set_getter(heap->the_hole_value()); 7464 accessors->set_getter(heap->the_hole_value());
7468 } 7465 }
7469 if (ClearBackPointer(heap, accessors->setter(), &keep_entry)) { 7466 if (ClearBackPointer(heap, accessors->setter(), &keep_entry)) {
7470 accessors->set_setter(heap->the_hole_value()); 7467 accessors->set_setter(heap->the_hole_value());
7471 } 7468 }
7472 } else { 7469 } else {
7473 keep_entry = true; 7470 keep_entry = true;
7474 } 7471 }
7475 break; 7472 break;
7476 } 7473 }
7477 case NORMAL: 7474 case NORMAL:
7478 case FIELD: 7475 case FIELD:
7479 case CONSTANT_FUNCTION: 7476 case CONSTANT_FUNCTION:
7480 case HANDLER: 7477 case HANDLER:
7481 case INTERCEPTOR: 7478 case INTERCEPTOR:
7482 case NULL_DESCRIPTOR: 7479 case NULL_DESCRIPTOR:
7483 keep_entry = true; 7480 keep_entry = true;
7484 break; 7481 break;
7485 } 7482 }
7486 // Make sure that an entry containing only dead transitions gets collected. 7483 // Make sure that an entry containing only dead transitions gets collected.
7487 // What we *really* want to do here is removing this entry completely, but 7484 // What we *really* want to do here is removing this entry completely, but
7488 // for technical reasons we can't do this, so we zero it out instead. 7485 // for technical reasons we can't do this, so we zero it out instead.
7489 if (!keep_entry) { 7486 if (!keep_entry) {
7490 contents->set_unchecked(i + 1, NullDescriptorDetails); 7487 d->SetDetailsUnchecked(i, NullDescriptorDetails);
7491 contents->set_null_unchecked(heap, i); 7488 d->SetNullValueUnchecked(i, heap);
7492 } 7489 }
7493 } 7490 }
7494 } 7491 }
7495 7492
7496 7493
7497 int Map::Hash() { 7494 int Map::Hash() {
7498 // For performance reasons we only hash the 3 most variable fields of a map: 7495 // For performance reasons we only hash the 3 most variable fields of a map:
7499 // constructor, prototype and bit_field2. 7496 // constructor, prototype and bit_field2.
7500 7497
7501 // Shift away the tag. 7498 // Shift away the tag.
(...skipping 5732 matching lines...) Expand 10 before | Expand all | Expand 10 after
13234 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13231 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13235 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13232 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13236 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13233 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13237 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13234 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13238 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13235 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13239 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13236 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13240 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13237 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13241 } 13238 }
13242 13239
13243 } } // namespace v8::internal 13240 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698