Chromium Code Reviews| 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 6826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6837 descriptors->InitializeRepresentations(Representation::Tagged()); | 6837 descriptors->InitializeRepresentations(Representation::Tagged()); |
| 6838 } | 6838 } |
| 6839 | 6839 |
| 6840 return result; | 6840 return result; |
| 6841 } | 6841 } |
| 6842 | 6842 |
| 6843 | 6843 |
| 6844 Handle<Map> Map::CopyInstallDescriptors(Handle<Map> map, | 6844 Handle<Map> Map::CopyInstallDescriptors(Handle<Map> map, |
| 6845 int new_descriptor, | 6845 int new_descriptor, |
| 6846 Handle<DescriptorArray> descriptors) { | 6846 Handle<DescriptorArray> descriptors) { |
| 6847 CALL_HEAP_FUNCTION(map->GetIsolate(), | |
| 6848 map->CopyInstallDescriptors(new_descriptor, *descriptors), | |
| 6849 Map); | |
| 6850 } | |
| 6851 | |
| 6852 | |
| 6853 // Since this method is used to rewrite an existing transition tree, it can | |
| 6854 // always insert transitions without checking. | |
|
Michael Starzinger
2013/10/23 08:59:05
nit: Let's preserve this comment above the handlif
rafaelw
2013/10/23 20:09:51
Woops. Good catch. done.
On 2013/10/23 08:59:05,
| |
| 6855 MaybeObject* Map::CopyInstallDescriptors(int new_descriptor, | |
| 6856 DescriptorArray* descriptors) { | |
| 6857 ASSERT(descriptors->IsSortedNoDuplicates()); | 6847 ASSERT(descriptors->IsSortedNoDuplicates()); |
| 6858 | 6848 |
| 6859 Map* result; | 6849 Handle<Map> result = Map::CopyDropDescriptors(map); |
| 6860 MaybeObject* maybe_result = CopyDropDescriptors(); | |
| 6861 if (!maybe_result->To(&result)) return maybe_result; | |
| 6862 | 6850 |
| 6863 result->InitializeDescriptors(descriptors); | 6851 result->InitializeDescriptors(*descriptors); |
| 6864 result->SetNumberOfOwnDescriptors(new_descriptor + 1); | 6852 result->SetNumberOfOwnDescriptors(new_descriptor + 1); |
| 6865 | 6853 |
| 6866 int unused_property_fields = this->unused_property_fields(); | 6854 int unused_property_fields = map->unused_property_fields(); |
| 6867 if (descriptors->GetDetails(new_descriptor).type() == FIELD) { | 6855 if (descriptors->GetDetails(new_descriptor).type() == FIELD) { |
| 6868 unused_property_fields = this->unused_property_fields() - 1; | 6856 unused_property_fields = map->unused_property_fields() - 1; |
| 6869 if (unused_property_fields < 0) { | 6857 if (unused_property_fields < 0) { |
| 6870 unused_property_fields += JSObject::kFieldsAdded; | 6858 unused_property_fields += JSObject::kFieldsAdded; |
| 6871 } | 6859 } |
| 6872 } | 6860 } |
| 6873 | 6861 |
| 6874 result->set_unused_property_fields(unused_property_fields); | 6862 result->set_unused_property_fields(unused_property_fields); |
| 6875 result->set_owns_descriptors(false); | 6863 result->set_owns_descriptors(false); |
| 6876 | 6864 |
| 6877 Name* name = descriptors->GetKey(new_descriptor); | 6865 Handle<Name> name = handle(descriptors->GetKey(new_descriptor)); |
| 6878 TransitionArray* transitions; | 6866 Handle<TransitionArray> transitions = Map::AddTransition(map, name, result, |
| 6879 MaybeObject* maybe_transitions = | 6867 SIMPLE_TRANSITION); |
| 6880 AddTransition(name, result, SIMPLE_TRANSITION); | |
| 6881 if (!maybe_transitions->To(&transitions)) return maybe_transitions; | |
| 6882 | 6868 |
| 6883 set_transitions(transitions); | 6869 map->set_transitions(*transitions); |
| 6884 result->SetBackPointer(this); | 6870 result->SetBackPointer(*map); |
| 6885 | 6871 |
| 6886 return result; | 6872 return result; |
| 6887 } | 6873 } |
| 6888 | 6874 |
| 6889 | 6875 |
| 6890 MaybeObject* Map::CopyAsElementsKind(ElementsKind kind, TransitionFlag flag) { | 6876 MaybeObject* Map::CopyAsElementsKind(ElementsKind kind, TransitionFlag flag) { |
| 6891 if (flag == INSERT_TRANSITION) { | 6877 if (flag == INSERT_TRANSITION) { |
| 6892 ASSERT(!HasElementsTransition() || | 6878 ASSERT(!HasElementsTransition() || |
| 6893 ((elements_transition_map()->elements_kind() == DICTIONARY_ELEMENTS || | 6879 ((elements_transition_map()->elements_kind() == DICTIONARY_ELEMENTS || |
| 6894 IsExternalArrayElementsKind( | 6880 IsExternalArrayElementsKind( |
| (...skipping 9491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16386 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16372 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16387 static const char* error_messages_[] = { | 16373 static const char* error_messages_[] = { |
| 16388 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16374 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16389 }; | 16375 }; |
| 16390 #undef ERROR_MESSAGES_TEXTS | 16376 #undef ERROR_MESSAGES_TEXTS |
| 16391 return error_messages_[reason]; | 16377 return error_messages_[reason]; |
| 16392 } | 16378 } |
| 16393 | 16379 |
| 16394 | 16380 |
| 16395 } } // namespace v8::internal | 16381 } } // namespace v8::internal |
| OLD | NEW |