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 2763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2774 proto_map = Handle<Map>(holder->map()); | 2774 proto_map = Handle<Map>(holder->map()); |
2775 } | 2775 } |
2776 } | 2776 } |
2777 return CurrentMapForDeprecatedInternal(map); | 2777 return CurrentMapForDeprecatedInternal(map); |
2778 } | 2778 } |
2779 | 2779 |
2780 | 2780 |
2781 // static | 2781 // static |
2782 MaybeHandle<Map> Map::CurrentMapForDeprecatedInternal(Handle<Map> old_map) { | 2782 MaybeHandle<Map> Map::CurrentMapForDeprecatedInternal(Handle<Map> old_map) { |
2783 DisallowHeapAllocation no_allocation; | 2783 DisallowHeapAllocation no_allocation; |
| 2784 DisallowDeoptimization no_deoptimization(old_map->GetIsolate()); |
2784 | 2785 |
2785 if (!old_map->is_deprecated()) return old_map; | 2786 if (!old_map->is_deprecated()) return old_map; |
2786 | 2787 |
2787 // Check the state of the root map. | 2788 // Check the state of the root map. |
2788 Map* root_map = old_map->FindRootMap(); | 2789 Map* root_map = old_map->FindRootMap(); |
2789 if (!old_map->EquivalentToForTransition(root_map)) return MaybeHandle<Map>(); | 2790 if (!old_map->EquivalentToForTransition(root_map)) return MaybeHandle<Map>(); |
2790 int root_nof = root_map->NumberOfOwnDescriptors(); | 2791 int root_nof = root_map->NumberOfOwnDescriptors(); |
2791 | 2792 |
2792 int old_nof = old_map->NumberOfOwnDescriptors(); | 2793 int old_nof = old_map->NumberOfOwnDescriptors(); |
2793 DescriptorArray* old_descriptors = old_map->instance_descriptors(); | 2794 DescriptorArray* old_descriptors = old_map->instance_descriptors(); |
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3933 ALLOW_AS_CONSTANT); | 3934 ALLOW_AS_CONSTANT); |
3934 object->map()->set_migration_target(true); | 3935 object->map()->set_migration_target(true); |
3935 if (FLAG_trace_migration) { | 3936 if (FLAG_trace_migration) { |
3936 object->PrintInstanceMigration(stdout, *original_map, object->map()); | 3937 object->PrintInstanceMigration(stdout, *original_map, object->map()); |
3937 } | 3938 } |
3938 } | 3939 } |
3939 | 3940 |
3940 | 3941 |
3941 // static | 3942 // static |
3942 bool JSObject::TryMigrateInstance(Handle<JSObject> object) { | 3943 bool JSObject::TryMigrateInstance(Handle<JSObject> object) { |
3943 Handle<Map> original_map(object->map()); | 3944 Isolate* isolate = object->GetIsolate(); |
| 3945 DisallowDeoptimization no_deoptimization(isolate); |
| 3946 Handle<Map> original_map(object->map(), isolate); |
3944 Handle<Map> new_map; | 3947 Handle<Map> new_map; |
3945 if (!Map::CurrentMapForDeprecatedInternal(original_map).ToHandle(&new_map)) { | 3948 if (!Map::CurrentMapForDeprecatedInternal(original_map).ToHandle(&new_map)) { |
3946 return false; | 3949 return false; |
3947 } | 3950 } |
3948 JSObject::MigrateToMap(object, new_map); | 3951 JSObject::MigrateToMap(object, new_map); |
3949 if (FLAG_trace_migration) { | 3952 if (FLAG_trace_migration) { |
3950 object->PrintInstanceMigration(stdout, *original_map, object->map()); | 3953 object->PrintInstanceMigration(stdout, *original_map, object->map()); |
3951 } | 3954 } |
3952 return true; | 3955 return true; |
3953 } | 3956 } |
(...skipping 13385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17339 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17342 #define ERROR_MESSAGES_TEXTS(C, T) T, |
17340 static const char* error_messages_[] = { | 17343 static const char* error_messages_[] = { |
17341 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17344 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
17342 }; | 17345 }; |
17343 #undef ERROR_MESSAGES_TEXTS | 17346 #undef ERROR_MESSAGES_TEXTS |
17344 return error_messages_[reason]; | 17347 return error_messages_[reason]; |
17345 } | 17348 } |
17346 | 17349 |
17347 | 17350 |
17348 } } // namespace v8::internal | 17351 } } // namespace v8::internal |
OLD | NEW |