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

Side by Side Diff: src/objects.cc

Issue 34603008: Handlify Map::CopyInstallDescriptors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: cr changes Created 7 years, 1 month 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') | no next file » | 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 // 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 6819 matching lines...) Expand 10 before | Expand all | Expand 10 after
6830 set_transitions(transitions); 6830 set_transitions(transitions);
6831 result->SetBackPointer(this); 6831 result->SetBackPointer(this);
6832 } else { 6832 } else {
6833 descriptors->InitializeRepresentations(Representation::Tagged()); 6833 descriptors->InitializeRepresentations(Representation::Tagged());
6834 } 6834 }
6835 6835
6836 return result; 6836 return result;
6837 } 6837 }
6838 6838
6839 6839
6840 Handle<Map> Map::CopyInstallDescriptors(Handle<Map> map,
6841 int new_descriptor,
6842 Handle<DescriptorArray> descriptors) {
6843 CALL_HEAP_FUNCTION(map->GetIsolate(),
6844 map->CopyInstallDescriptors(new_descriptor, *descriptors),
6845 Map);
6846 }
6847
6848
6849 // Since this method is used to rewrite an existing transition tree, it can 6840 // Since this method is used to rewrite an existing transition tree, it can
6850 // always insert transitions without checking. 6841 // always insert transitions without checking.
6851 MaybeObject* Map::CopyInstallDescriptors(int new_descriptor, 6842 Handle<Map> Map::CopyInstallDescriptors(Handle<Map> map,
6852 DescriptorArray* descriptors) { 6843 int new_descriptor,
6844 Handle<DescriptorArray> descriptors) {
6853 ASSERT(descriptors->IsSortedNoDuplicates()); 6845 ASSERT(descriptors->IsSortedNoDuplicates());
6854 6846
6855 Map* result; 6847 Handle<Map> result = Map::CopyDropDescriptors(map);
6856 MaybeObject* maybe_result = CopyDropDescriptors();
6857 if (!maybe_result->To(&result)) return maybe_result;
6858 6848
6859 result->InitializeDescriptors(descriptors); 6849 result->InitializeDescriptors(*descriptors);
6860 result->SetNumberOfOwnDescriptors(new_descriptor + 1); 6850 result->SetNumberOfOwnDescriptors(new_descriptor + 1);
6861 6851
6862 int unused_property_fields = this->unused_property_fields(); 6852 int unused_property_fields = map->unused_property_fields();
6863 if (descriptors->GetDetails(new_descriptor).type() == FIELD) { 6853 if (descriptors->GetDetails(new_descriptor).type() == FIELD) {
6864 unused_property_fields = this->unused_property_fields() - 1; 6854 unused_property_fields = map->unused_property_fields() - 1;
6865 if (unused_property_fields < 0) { 6855 if (unused_property_fields < 0) {
6866 unused_property_fields += JSObject::kFieldsAdded; 6856 unused_property_fields += JSObject::kFieldsAdded;
6867 } 6857 }
6868 } 6858 }
6869 6859
6870 result->set_unused_property_fields(unused_property_fields); 6860 result->set_unused_property_fields(unused_property_fields);
6871 result->set_owns_descriptors(false); 6861 result->set_owns_descriptors(false);
6872 6862
6873 Name* name = descriptors->GetKey(new_descriptor); 6863 Handle<Name> name = handle(descriptors->GetKey(new_descriptor));
6874 TransitionArray* transitions; 6864 Handle<TransitionArray> transitions = Map::AddTransition(map, name, result,
6875 MaybeObject* maybe_transitions = 6865 SIMPLE_TRANSITION);
6876 AddTransition(name, result, SIMPLE_TRANSITION);
6877 if (!maybe_transitions->To(&transitions)) return maybe_transitions;
6878 6866
6879 set_transitions(transitions); 6867 map->set_transitions(*transitions);
6880 result->SetBackPointer(this); 6868 result->SetBackPointer(*map);
6881 6869
6882 return result; 6870 return result;
6883 } 6871 }
6884 6872
6885 6873
6886 MaybeObject* Map::CopyAsElementsKind(ElementsKind kind, TransitionFlag flag) { 6874 MaybeObject* Map::CopyAsElementsKind(ElementsKind kind, TransitionFlag flag) {
6887 if (flag == INSERT_TRANSITION) { 6875 if (flag == INSERT_TRANSITION) {
6888 ASSERT(!HasElementsTransition() || 6876 ASSERT(!HasElementsTransition() ||
6889 ((elements_transition_map()->elements_kind() == DICTIONARY_ELEMENTS || 6877 ((elements_transition_map()->elements_kind() == DICTIONARY_ELEMENTS ||
6890 IsExternalArrayElementsKind( 6878 IsExternalArrayElementsKind(
(...skipping 9519 matching lines...) Expand 10 before | Expand all | Expand 10 after
16410 #define ERROR_MESSAGES_TEXTS(C, T) T, 16398 #define ERROR_MESSAGES_TEXTS(C, T) T,
16411 static const char* error_messages_[] = { 16399 static const char* error_messages_[] = {
16412 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16400 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16413 }; 16401 };
16414 #undef ERROR_MESSAGES_TEXTS 16402 #undef ERROR_MESSAGES_TEXTS
16415 return error_messages_[reason]; 16403 return error_messages_[reason];
16416 } 16404 }
16417 16405
16418 16406
16419 } } // namespace v8::internal 16407 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698