| 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 2519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2530 | 2530 |
| 2531 if (old_representation.IsNone()) { | 2531 if (old_representation.IsNone()) { |
| 2532 UNREACHABLE(); | 2532 UNREACHABLE(); |
| 2533 old_descriptors->SetRepresentation(modify_index, new_representation); | 2533 old_descriptors->SetRepresentation(modify_index, new_representation); |
| 2534 return this; | 2534 return this; |
| 2535 } | 2535 } |
| 2536 | 2536 |
| 2537 int descriptors = old_map->NumberOfOwnDescriptors(); | 2537 int descriptors = old_map->NumberOfOwnDescriptors(); |
| 2538 Map* root_map = old_map->FindRootMap(); | 2538 Map* root_map = old_map->FindRootMap(); |
| 2539 | 2539 |
| 2540 // Check the state of the root map. |
| 2540 if (!old_map->EquivalentToForTransition(root_map)) { | 2541 if (!old_map->EquivalentToForTransition(root_map)) { |
| 2541 return CopyGeneralizeAllRepresentations(); | 2542 return CopyGeneralizeAllRepresentations(); |
| 2542 } | 2543 } |
| 2543 | 2544 |
| 2544 int verbatim = root_map->NumberOfOwnDescriptors(); | 2545 int verbatim = root_map->NumberOfOwnDescriptors(); |
| 2545 | 2546 |
| 2546 Map* updated = root_map->FindUpdatedMap( | 2547 Map* updated = root_map->FindUpdatedMap( |
| 2547 verbatim, descriptors, old_descriptors); | 2548 verbatim, descriptors, old_descriptors); |
| 2548 if (updated == NULL) return CopyGeneralizeAllRepresentations(); | 2549 if (updated == NULL) return CopyGeneralizeAllRepresentations(); |
| 2549 | 2550 |
| 2550 // Check the state of the root map. | |
| 2551 DescriptorArray* updated_descriptors = updated->instance_descriptors(); | 2551 DescriptorArray* updated_descriptors = updated->instance_descriptors(); |
| 2552 | 2552 |
| 2553 int valid = updated->NumberOfOwnDescriptors(); | 2553 int valid = updated->NumberOfOwnDescriptors(); |
| 2554 if (updated_descriptors->IsMoreGeneralThan( | 2554 if (updated_descriptors->IsMoreGeneralThan( |
| 2555 verbatim, valid, descriptors, old_descriptors)) { | 2555 verbatim, valid, descriptors, old_descriptors)) { |
| 2556 Representation updated_representation = | 2556 Representation updated_representation = |
| 2557 updated_descriptors->GetDetails(modify_index).representation(); | 2557 updated_descriptors->GetDetails(modify_index).representation(); |
| 2558 if (new_representation.fits_into(updated_representation)) { | 2558 if (new_representation.fits_into(updated_representation)) { |
| 2559 if (FLAG_trace_generalization && | 2559 if (FLAG_trace_generalization && |
| 2560 !(modify_index == 0 && new_representation.IsSmi())) { | 2560 !(modify_index == 0 && new_representation.IsSmi())) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2617 Handle<Map>(new_map); | 2617 Handle<Map>(new_map); |
| 2618 return maybe_map; | 2618 return maybe_map; |
| 2619 } | 2619 } |
| 2620 } | 2620 } |
| 2621 | 2621 |
| 2622 new_map->set_owns_descriptors(true); | 2622 new_map->set_owns_descriptors(true); |
| 2623 return new_map; | 2623 return new_map; |
| 2624 } | 2624 } |
| 2625 | 2625 |
| 2626 | 2626 |
| 2627 Map* Map::CurrentMapForDeprecated() { |
| 2628 AssertNoAllocation no_allocation; |
| 2629 if (!is_deprecated()) return this; |
| 2630 |
| 2631 DescriptorArray* old_descriptors = instance_descriptors(); |
| 2632 |
| 2633 int descriptors = NumberOfOwnDescriptors(); |
| 2634 Map* root_map = FindRootMap(); |
| 2635 |
| 2636 // Check the state of the root map. |
| 2637 if (!EquivalentToForTransition(root_map)) return NULL; |
| 2638 int verbatim = root_map->NumberOfOwnDescriptors(); |
| 2639 |
| 2640 Map* updated = root_map->FindUpdatedMap( |
| 2641 verbatim, descriptors, old_descriptors); |
| 2642 if (updated == NULL) return NULL; |
| 2643 |
| 2644 DescriptorArray* updated_descriptors = updated->instance_descriptors(); |
| 2645 int valid = updated->NumberOfOwnDescriptors(); |
| 2646 if (!updated_descriptors->IsMoreGeneralThan( |
| 2647 verbatim, valid, descriptors, old_descriptors)) { |
| 2648 return NULL; |
| 2649 } |
| 2650 |
| 2651 return updated; |
| 2652 } |
| 2653 |
| 2654 |
| 2627 MaybeObject* JSObject::SetPropertyWithInterceptor( | 2655 MaybeObject* JSObject::SetPropertyWithInterceptor( |
| 2628 Name* name, | 2656 Name* name, |
| 2629 Object* value, | 2657 Object* value, |
| 2630 PropertyAttributes attributes, | 2658 PropertyAttributes attributes, |
| 2631 StrictModeFlag strict_mode) { | 2659 StrictModeFlag strict_mode) { |
| 2632 // TODO(rossberg): Support symbols in the API. | 2660 // TODO(rossberg): Support symbols in the API. |
| 2633 if (name->IsSymbol()) return value; | 2661 if (name->IsSymbol()) return value; |
| 2634 Isolate* isolate = GetIsolate(); | 2662 Isolate* isolate = GetIsolate(); |
| 2635 HandleScope scope(isolate); | 2663 HandleScope scope(isolate); |
| 2636 Handle<JSObject> this_handle(this); | 2664 Handle<JSObject> this_handle(this); |
| (...skipping 12793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15430 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 15458 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
| 15431 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 15459 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
| 15432 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 15460 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
| 15433 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 15461 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
| 15434 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 15462 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
| 15435 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 15463 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
| 15436 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 15464 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
| 15437 } | 15465 } |
| 15438 | 15466 |
| 15439 } } // namespace v8::internal | 15467 } } // namespace v8::internal |
| OLD | NEW |