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

Side by Side Diff: src/objects.cc

Issue 321383002: Version 3.26.31.2 (merged r21743) (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.26
Patch Set: Created 6 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
« no previous file with comments | « src/objects.h ('k') | src/version.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "accessors.h" 7 #include "accessors.h"
8 #include "allocation-site-scopes.h" 8 #include "allocation-site-scopes.h"
9 #include "api.h" 9 #include "api.h"
10 #include "arguments.h" 10 #include "arguments.h"
(...skipping 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 new_map->NumberOfOwnDescriptors(), 2339 new_map->NumberOfOwnDescriptors(),
2340 new_map->NumberOfOwnDescriptors(), 2340 new_map->NumberOfOwnDescriptors(),
2341 details.type() == CONSTANT && store_mode == FORCE_FIELD, 2341 details.type() == CONSTANT && store_mode == FORCE_FIELD,
2342 details.representation(), Representation::Tagged(), 2342 details.representation(), Representation::Tagged(),
2343 field_type, HeapType::Any()); 2343 field_type, HeapType::Any());
2344 } 2344 }
2345 return new_map; 2345 return new_map;
2346 } 2346 }
2347 2347
2348 2348
2349 // static
2350 Handle<Map> Map::CopyGeneralizeAllRepresentations(Handle<Map> map,
2351 int modify_index,
2352 StoreMode store_mode,
2353 const char* reason) {
2354 PropertyDetails details =
2355 map->instance_descriptors()->GetDetails(modify_index);
2356 return CopyGeneralizeAllRepresentations(map, modify_index, store_mode,
2357 details.attributes(), reason);
2358 }
2359
2360
2349 void Map::DeprecateTransitionTree() { 2361 void Map::DeprecateTransitionTree() {
2350 if (is_deprecated()) return; 2362 if (is_deprecated()) return;
2351 if (HasTransitionArray()) { 2363 if (HasTransitionArray()) {
2352 TransitionArray* transitions = this->transitions(); 2364 TransitionArray* transitions = this->transitions();
2353 for (int i = 0; i < transitions->number_of_transitions(); i++) { 2365 for (int i = 0; i < transitions->number_of_transitions(); i++) {
2354 transitions->GetTarget(i)->DeprecateTransitionTree(); 2366 transitions->GetTarget(i)->DeprecateTransitionTree();
2355 } 2367 }
2356 } 2368 }
2357 deprecate(); 2369 deprecate();
2358 dependent_code()->DeoptimizeDependentCodeGroup( 2370 dependent_code()->DeoptimizeDependentCodeGroup(
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 old_descriptors->GetFieldType(modify_index), *new_field_type); 2596 old_descriptors->GetFieldType(modify_index), *new_field_type);
2585 } 2597 }
2586 old_descriptors->SetRepresentation(modify_index, new_representation); 2598 old_descriptors->SetRepresentation(modify_index, new_representation);
2587 old_descriptors->SetValue(modify_index, *new_field_type); 2599 old_descriptors->SetValue(modify_index, *new_field_type);
2588 return old_map; 2600 return old_map;
2589 } 2601 }
2590 2602
2591 // Check the state of the root map. 2603 // Check the state of the root map.
2592 Handle<Map> root_map(old_map->FindRootMap(), isolate); 2604 Handle<Map> root_map(old_map->FindRootMap(), isolate);
2593 if (!old_map->EquivalentToForTransition(*root_map)) { 2605 if (!old_map->EquivalentToForTransition(*root_map)) {
2594 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, 2606 return CopyGeneralizeAllRepresentations(
2595 old_details.attributes(), "not equivalent"); 2607 old_map, modify_index, store_mode, "not equivalent");
2596 } 2608 }
2597 int root_nof = root_map->NumberOfOwnDescriptors(); 2609 int root_nof = root_map->NumberOfOwnDescriptors();
2598 if (modify_index < root_nof) { 2610 if (modify_index < root_nof) {
2599 PropertyDetails old_details = old_descriptors->GetDetails(modify_index); 2611 PropertyDetails old_details = old_descriptors->GetDetails(modify_index);
2600 if ((old_details.type() != FIELD && store_mode == FORCE_FIELD) || 2612 if ((old_details.type() != FIELD && store_mode == FORCE_FIELD) ||
2601 (old_details.type() == FIELD && 2613 (old_details.type() == FIELD &&
2602 (!new_field_type->NowIs(old_descriptors->GetFieldType(modify_index)) || 2614 (!new_field_type->NowIs(old_descriptors->GetFieldType(modify_index)) ||
2603 !new_representation.fits_into(old_details.representation())))) { 2615 !new_representation.fits_into(old_details.representation())))) {
2604 return CopyGeneralizeAllRepresentations(old_map, modify_index, store_mode, 2616 return CopyGeneralizeAllRepresentations(
2605 old_details.attributes(), "root modification"); 2617 old_map, modify_index, store_mode, "root modification");
2606 } 2618 }
2607 } 2619 }
2608 2620
2609 Handle<Map> target_map = root_map; 2621 Handle<Map> target_map = root_map;
2610 for (int i = root_nof; i < old_nof; ++i) { 2622 for (int i = root_nof; i < old_nof; ++i) {
2611 int j = target_map->SearchTransition(old_descriptors->GetKey(i)); 2623 int j = target_map->SearchTransition(old_descriptors->GetKey(i));
2612 if (j == TransitionArray::kNotFound) break; 2624 if (j == TransitionArray::kNotFound) break;
2613 Handle<Map> tmp_map(target_map->GetTransition(j), isolate); 2625 Handle<Map> tmp_map(target_map->GetTransition(j), isolate);
2614 Handle<DescriptorArray> tmp_descriptors = handle( 2626 Handle<DescriptorArray> tmp_descriptors = handle(
2615 tmp_map->instance_descriptors(), isolate); 2627 tmp_map->instance_descriptors(), isolate);
2616 2628
2617 // Check if target map is incompatible. 2629 // Check if target map is incompatible.
2618 PropertyDetails old_details = old_descriptors->GetDetails(i); 2630 PropertyDetails old_details = old_descriptors->GetDetails(i);
2619 PropertyDetails tmp_details = tmp_descriptors->GetDetails(i); 2631 PropertyDetails tmp_details = tmp_descriptors->GetDetails(i);
2620 PropertyType old_type = old_details.type(); 2632 PropertyType old_type = old_details.type();
2621 PropertyType tmp_type = tmp_details.type(); 2633 PropertyType tmp_type = tmp_details.type();
2622 if (tmp_details.attributes() != old_details.attributes() || 2634 if (tmp_details.attributes() != old_details.attributes() ||
2623 ((tmp_type == CALLBACKS || old_type == CALLBACKS) && 2635 ((tmp_type == CALLBACKS || old_type == CALLBACKS) &&
2624 (tmp_type != old_type || 2636 (tmp_type != old_type ||
2625 tmp_descriptors->GetValue(i) != old_descriptors->GetValue(i)))) { 2637 tmp_descriptors->GetValue(i) != old_descriptors->GetValue(i)))) {
2626 return CopyGeneralizeAllRepresentations( 2638 return CopyGeneralizeAllRepresentations(
2627 old_map, modify_index, store_mode, 2639 old_map, modify_index, store_mode, "incompatible");
2628 old_details.attributes(), "incompatible");
2629 } 2640 }
2630 Representation old_representation = old_details.representation(); 2641 Representation old_representation = old_details.representation();
2631 Representation tmp_representation = tmp_details.representation(); 2642 Representation tmp_representation = tmp_details.representation();
2632 if (!old_representation.fits_into(tmp_representation) || 2643 if (!old_representation.fits_into(tmp_representation) ||
2633 (!new_representation.fits_into(tmp_representation) && 2644 (!new_representation.fits_into(tmp_representation) &&
2634 modify_index == i)) { 2645 modify_index == i)) {
2635 break; 2646 break;
2636 } 2647 }
2637 if (tmp_type == FIELD) { 2648 if (tmp_type == FIELD) {
2638 // Generalize the field type as necessary. 2649 // Generalize the field type as necessary.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2682 tmp_map->instance_descriptors(), isolate); 2693 tmp_map->instance_descriptors(), isolate);
2683 2694
2684 // Check if target map is compatible. 2695 // Check if target map is compatible.
2685 PropertyDetails old_details = old_descriptors->GetDetails(i); 2696 PropertyDetails old_details = old_descriptors->GetDetails(i);
2686 PropertyDetails tmp_details = tmp_descriptors->GetDetails(i); 2697 PropertyDetails tmp_details = tmp_descriptors->GetDetails(i);
2687 if (tmp_details.attributes() != old_details.attributes() || 2698 if (tmp_details.attributes() != old_details.attributes() ||
2688 ((tmp_details.type() == CALLBACKS || old_details.type() == CALLBACKS) && 2699 ((tmp_details.type() == CALLBACKS || old_details.type() == CALLBACKS) &&
2689 (tmp_details.type() != old_details.type() || 2700 (tmp_details.type() != old_details.type() ||
2690 tmp_descriptors->GetValue(i) != old_descriptors->GetValue(i)))) { 2701 tmp_descriptors->GetValue(i) != old_descriptors->GetValue(i)))) {
2691 return CopyGeneralizeAllRepresentations( 2702 return CopyGeneralizeAllRepresentations(
2692 old_map, modify_index, store_mode, 2703 old_map, modify_index, store_mode, "incompatible");
2693 old_details.attributes(), "incompatible");
2694 } 2704 }
2695 target_map = tmp_map; 2705 target_map = tmp_map;
2696 } 2706 }
2697 target_nof = target_map->NumberOfOwnDescriptors(); 2707 target_nof = target_map->NumberOfOwnDescriptors();
2698 target_descriptors = handle(target_map->instance_descriptors(), isolate); 2708 target_descriptors = handle(target_map->instance_descriptors(), isolate);
2699 2709
2700 // Allocate a new descriptor array large enough to hold the required 2710 // Allocate a new descriptor array large enough to hold the required
2701 // descriptors, with minimally the exact same size as the old descriptor 2711 // descriptors, with minimally the exact same size as the old descriptor
2702 // array. 2712 // array.
2703 int new_slack = Max( 2713 int new_slack = Max(
(...skipping 22 matching lines...) Expand all
2726 Handle<Name> target_key(target_descriptors->GetKey(i), isolate); 2736 Handle<Name> target_key(target_descriptors->GetKey(i), isolate);
2727 PropertyDetails old_details = old_descriptors->GetDetails(i); 2737 PropertyDetails old_details = old_descriptors->GetDetails(i);
2728 PropertyDetails target_details = target_descriptors->GetDetails(i); 2738 PropertyDetails target_details = target_descriptors->GetDetails(i);
2729 target_details = target_details.CopyWithRepresentation( 2739 target_details = target_details.CopyWithRepresentation(
2730 old_details.representation().generalize( 2740 old_details.representation().generalize(
2731 target_details.representation())); 2741 target_details.representation()));
2732 if (modify_index == i) { 2742 if (modify_index == i) {
2733 target_details = target_details.CopyWithRepresentation( 2743 target_details = target_details.CopyWithRepresentation(
2734 new_representation.generalize(target_details.representation())); 2744 new_representation.generalize(target_details.representation()));
2735 } 2745 }
2746 ASSERT_EQ(old_details.attributes(), target_details.attributes());
2736 if (old_details.type() == FIELD || 2747 if (old_details.type() == FIELD ||
2737 target_details.type() == FIELD || 2748 target_details.type() == FIELD ||
2738 (modify_index == i && store_mode == FORCE_FIELD) || 2749 (modify_index == i && store_mode == FORCE_FIELD) ||
2739 (target_descriptors->GetValue(i) != old_descriptors->GetValue(i))) { 2750 (target_descriptors->GetValue(i) != old_descriptors->GetValue(i))) {
2740 Handle<HeapType> old_field_type = (old_details.type() == FIELD) 2751 Handle<HeapType> old_field_type = (old_details.type() == FIELD)
2741 ? handle(old_descriptors->GetFieldType(i), isolate) 2752 ? handle(old_descriptors->GetFieldType(i), isolate)
2742 : old_descriptors->GetValue(i)->OptimalType( 2753 : old_descriptors->GetValue(i)->OptimalType(
2743 isolate, target_details.representation()); 2754 isolate, target_details.representation());
2744 Handle<HeapType> target_field_type = (target_details.type() == FIELD) 2755 Handle<HeapType> target_field_type = (target_details.type() == FIELD)
2745 ? handle(target_descriptors->GetFieldType(i), isolate) 2756 ? handle(target_descriptors->GetFieldType(i), isolate)
(...skipping 14518 matching lines...) Expand 10 before | Expand all | Expand 10 after
17264 #define ERROR_MESSAGES_TEXTS(C, T) T, 17275 #define ERROR_MESSAGES_TEXTS(C, T) T,
17265 static const char* error_messages_[] = { 17276 static const char* error_messages_[] = {
17266 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17277 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17267 }; 17278 };
17268 #undef ERROR_MESSAGES_TEXTS 17279 #undef ERROR_MESSAGES_TEXTS
17269 return error_messages_[reason]; 17280 return error_messages_[reason];
17270 } 17281 }
17271 17282
17272 17283
17273 } } // namespace v8::internal 17284 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698