| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2430 Map* Map::FindRootMap() { | 2430 Map* Map::FindRootMap() { |
| 2431 Map* result = this; | 2431 Map* result = this; |
| 2432 while (true) { | 2432 while (true) { |
| 2433 Object* back = result->GetBackPointer(); | 2433 Object* back = result->GetBackPointer(); |
| 2434 if (back->IsUndefined()) return result; | 2434 if (back->IsUndefined()) return result; |
| 2435 result = Map::cast(back); | 2435 result = Map::cast(back); |
| 2436 } | 2436 } |
| 2437 } | 2437 } |
| 2438 | 2438 |
| 2439 | 2439 |
| 2440 // Returns NULL if the updated map is incompatible. |
| 2440 Map* Map::FindUpdatedMap(int verbatim, | 2441 Map* Map::FindUpdatedMap(int verbatim, |
| 2441 int length, | 2442 int length, |
| 2442 DescriptorArray* descriptors) { | 2443 DescriptorArray* descriptors) { |
| 2443 // This can only be called on roots of transition trees. | 2444 // This can only be called on roots of transition trees. |
| 2444 ASSERT(GetBackPointer()->IsUndefined()); | 2445 ASSERT(GetBackPointer()->IsUndefined()); |
| 2445 | 2446 |
| 2446 Map* current = this; | 2447 Map* current = this; |
| 2447 | 2448 |
| 2448 for (int i = verbatim; i < length; i++) { | 2449 for (int i = verbatim; i < length; i++) { |
| 2449 if (!current->HasTransitionArray()) break; | 2450 if (!current->HasTransitionArray()) break; |
| 2450 Name* name = descriptors->GetKey(i); | 2451 Name* name = descriptors->GetKey(i); |
| 2451 TransitionArray* transitions = current->transitions(); | 2452 TransitionArray* transitions = current->transitions(); |
| 2452 int transition = transitions->Search(name); | 2453 int transition = transitions->Search(name); |
| 2453 if (transition == TransitionArray::kNotFound) break; | 2454 if (transition == TransitionArray::kNotFound) break; |
| 2454 current = transitions->GetTarget(transition); | 2455 current = transitions->GetTarget(transition); |
| 2456 PropertyDetails details = descriptors->GetDetails(i); |
| 2457 PropertyDetails target_details = |
| 2458 current->instance_descriptors()->GetDetails(i); |
| 2459 if (details.attributes() != target_details.attributes()) return NULL; |
| 2460 if (details.type() == CALLBACKS) { |
| 2461 if (target_details.type() != CALLBACKS) return NULL; |
| 2462 if (descriptors->GetValue(i) != |
| 2463 current->instance_descriptors()->GetValue(i)) { |
| 2464 return NULL; |
| 2465 } |
| 2466 } |
| 2455 } | 2467 } |
| 2456 | 2468 |
| 2457 return current; | 2469 return current; |
| 2458 } | 2470 } |
| 2459 | 2471 |
| 2460 | 2472 |
| 2461 Map* Map::FindLastMatchMap(int verbatim, | 2473 Map* Map::FindLastMatchMap(int verbatim, |
| 2462 int length, | 2474 int length, |
| 2463 DescriptorArray* descriptors) { | 2475 DescriptorArray* descriptors) { |
| 2464 // This can only be called on roots of transition trees. | 2476 // This can only be called on roots of transition trees. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2527 Map* root_map = old_map->FindRootMap(); | 2539 Map* root_map = old_map->FindRootMap(); |
| 2528 | 2540 |
| 2529 if (!old_map->EquivalentToForTransition(root_map)) { | 2541 if (!old_map->EquivalentToForTransition(root_map)) { |
| 2530 return CopyGeneralizeAllRepresentations(); | 2542 return CopyGeneralizeAllRepresentations(); |
| 2531 } | 2543 } |
| 2532 | 2544 |
| 2533 int verbatim = root_map->NumberOfOwnDescriptors(); | 2545 int verbatim = root_map->NumberOfOwnDescriptors(); |
| 2534 | 2546 |
| 2535 Map* updated = root_map->FindUpdatedMap( | 2547 Map* updated = root_map->FindUpdatedMap( |
| 2536 verbatim, descriptors, old_descriptors); | 2548 verbatim, descriptors, old_descriptors); |
| 2549 if (updated == NULL) return CopyGeneralizeAllRepresentations(); |
| 2550 |
| 2537 // Check the state of the root map. | 2551 // Check the state of the root map. |
| 2538 DescriptorArray* updated_descriptors = updated->instance_descriptors(); | 2552 DescriptorArray* updated_descriptors = updated->instance_descriptors(); |
| 2539 | 2553 |
| 2540 int valid = updated->NumberOfOwnDescriptors(); | 2554 int valid = updated->NumberOfOwnDescriptors(); |
| 2541 if (updated_descriptors->IsMoreGeneralThan( | 2555 if (updated_descriptors->IsMoreGeneralThan( |
| 2542 verbatim, valid, descriptors, old_descriptors)) { | 2556 verbatim, valid, descriptors, old_descriptors)) { |
| 2543 Representation updated_representation = | 2557 Representation updated_representation = |
| 2544 updated_descriptors->GetDetails(modify_index).representation(); | 2558 updated_descriptors->GetDetails(modify_index).representation(); |
| 2545 if (new_representation.fits_into(updated_representation)) { | 2559 if (new_representation.fits_into(updated_representation)) { |
| 2546 if (FLAG_trace_generalization && | 2560 if (FLAG_trace_generalization && |
| (...skipping 4955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7502 int valid, | 7516 int valid, |
| 7503 int new_size, | 7517 int new_size, |
| 7504 DescriptorArray* other) { | 7518 DescriptorArray* other) { |
| 7505 ASSERT(verbatim <= valid); | 7519 ASSERT(verbatim <= valid); |
| 7506 ASSERT(valid <= new_size); | 7520 ASSERT(valid <= new_size); |
| 7507 if (valid != new_size) return false; | 7521 if (valid != new_size) return false; |
| 7508 | 7522 |
| 7509 for (int descriptor = verbatim; descriptor < valid; descriptor++) { | 7523 for (int descriptor = verbatim; descriptor < valid; descriptor++) { |
| 7510 PropertyDetails details = GetDetails(descriptor); | 7524 PropertyDetails details = GetDetails(descriptor); |
| 7511 PropertyDetails other_details = other->GetDetails(descriptor); | 7525 PropertyDetails other_details = other->GetDetails(descriptor); |
| 7512 if (details.type() != other_details.type()) { | 7526 if (!other_details.representation().fits_into(details.representation())) { |
| 7513 if (details.type() != FIELD || | |
| 7514 other_details.type() != CONSTANT_FUNCTION) { | |
| 7515 return false; | |
| 7516 } | |
| 7517 } else if (details.type() == CONSTANT_FUNCTION) { | |
| 7518 if (GetValue(descriptor) != other->GetValue(descriptor)) { | |
| 7519 return false; | |
| 7520 } | |
| 7521 } else if (!other_details.representation().fits_into( | |
| 7522 details.representation())) { | |
| 7523 return false; | 7527 return false; |
| 7524 } | 7528 } |
| 7529 if (details.type() == CONSTANT_FUNCTION) { |
| 7530 if (other_details.type() != CONSTANT_FUNCTION) return false; |
| 7531 if (GetValue(descriptor) != other->GetValue(descriptor)) return false; |
| 7532 } |
| 7525 } | 7533 } |
| 7526 | 7534 |
| 7527 return true; | 7535 return true; |
| 7528 } | 7536 } |
| 7529 | 7537 |
| 7530 | 7538 |
| 7531 // We need the whiteness witness since sort will reshuffle the entries in the | 7539 // We need the whiteness witness since sort will reshuffle the entries in the |
| 7532 // descriptor array. If the descriptor array were to be black, the shuffling | 7540 // descriptor array. If the descriptor array were to be black, the shuffling |
| 7533 // would move a slot that was already recorded as pointing into an evacuation | 7541 // would move a slot that was already recorded as pointing into an evacuation |
| 7534 // candidate. This would result in missing updates upon evacuation. | 7542 // candidate. This would result in missing updates upon evacuation. |
| (...skipping 7894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15429 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 15437 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
| 15430 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 15438 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
| 15431 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 15439 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
| 15432 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 15440 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
| 15433 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 15441 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
| 15434 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 15442 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
| 15435 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 15443 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
| 15436 } | 15444 } |
| 15437 | 15445 |
| 15438 } } // namespace v8::internal | 15446 } } // namespace v8::internal |
| OLD | NEW |