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

Side by Side Diff: src/objects.cc

Issue 404963002: Migrate to current map if deprecated in SetProperty (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | « no previous file | 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 // 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 7307 matching lines...) Expand 10 before | Expand all | Expand 10 after
7318 UNREACHABLE(); 7318 UNREACHABLE();
7319 return false; 7319 return false;
7320 } 7320 }
7321 7321
7322 7322
7323 Handle<Map> Map::PrepareForDataProperty(Handle<Map> map, int descriptor, 7323 Handle<Map> Map::PrepareForDataProperty(Handle<Map> map, int descriptor,
7324 Handle<Object> value) { 7324 Handle<Object> value) {
7325 // Dictionaries can store any property value. 7325 // Dictionaries can store any property value.
7326 if (map->is_dictionary_map()) return map; 7326 if (map->is_dictionary_map()) return map;
7327 7327
7328 // Migrate to the newest map before storing the property.
7329 if (map->is_deprecated()) {
7330 map = GeneralizeRepresentation(map, 0, Representation::None(),
7331 HeapType::None(map->GetIsolate()),
7332 ALLOW_AS_CONSTANT);
7333 }
7334
7328 Handle<DescriptorArray> descriptors(map->instance_descriptors()); 7335 Handle<DescriptorArray> descriptors(map->instance_descriptors());
7329 7336
7330 if (descriptors->CanHoldValue(descriptor, *value)) return map; 7337 if (descriptors->CanHoldValue(descriptor, *value)) return map;
7331 7338
7332 Isolate* isolate = map->GetIsolate(); 7339 Isolate* isolate = map->GetIsolate();
7333 Representation representation = value->OptimalRepresentation(); 7340 Representation representation = value->OptimalRepresentation();
7334 Handle<HeapType> type = value->OptimalType(isolate, representation); 7341 Handle<HeapType> type = value->OptimalType(isolate, representation);
7335 7342
7336 return GeneralizeRepresentation(map, descriptor, representation, type, 7343 return GeneralizeRepresentation(map, descriptor, representation, type,
7337 FORCE_FIELD); 7344 FORCE_FIELD);
7338 } 7345 }
7339 7346
7340 7347
7341 Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name, 7348 Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name,
7342 Handle<Object> value, 7349 Handle<Object> value,
7343 PropertyAttributes attributes, 7350 PropertyAttributes attributes,
7344 StoreFromKeyed store_mode) { 7351 StoreFromKeyed store_mode) {
7345 // Cannot currently handle deprecated maps.
7346 ASSERT(!map->is_deprecated());
7347 // Dictionary maps can always have additional data properties. 7352 // Dictionary maps can always have additional data properties.
7348 if (map->is_dictionary_map()) return map; 7353 if (map->is_dictionary_map()) return map;
7349 7354
7355 // Migrate to the newest map before transitioning to the new property.
7356 if (map->is_deprecated()) {
7357 map = GeneralizeRepresentation(map, 0, Representation::None(),
7358 HeapType::None(map->GetIsolate()),
7359 ALLOW_AS_CONSTANT);
7360 }
7361
7350 int index = map->SearchTransition(*name); 7362 int index = map->SearchTransition(*name);
7351 if (index != TransitionArray::kNotFound) { 7363 if (index != TransitionArray::kNotFound) {
7352 Handle<Map> transition(map->GetTransition(index)); 7364 Handle<Map> transition(map->GetTransition(index));
7353 int descriptor = transition->LastAdded(); 7365 int descriptor = transition->LastAdded();
7354 7366
7355 // TODO(verwaest): Handle attributes better. 7367 // TODO(verwaest): Handle attributes better.
7356 DescriptorArray* descriptors = transition->instance_descriptors(); 7368 DescriptorArray* descriptors = transition->instance_descriptors();
7357 if (descriptors->GetDetails(descriptor).attributes() != attributes) { 7369 if (descriptors->GetDetails(descriptor).attributes() != attributes) {
7358 return CopyGeneralizeAllRepresentations(transition, descriptor, 7370 return CopyGeneralizeAllRepresentations(transition, descriptor,
7359 FORCE_FIELD, attributes, 7371 FORCE_FIELD, attributes,
(...skipping 9588 matching lines...) Expand 10 before | Expand all | Expand 10 after
16948 #define ERROR_MESSAGES_TEXTS(C, T) T, 16960 #define ERROR_MESSAGES_TEXTS(C, T) T,
16949 static const char* error_messages_[] = { 16961 static const char* error_messages_[] = {
16950 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16962 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16951 }; 16963 };
16952 #undef ERROR_MESSAGES_TEXTS 16964 #undef ERROR_MESSAGES_TEXTS
16953 return error_messages_[reason]; 16965 return error_messages_[reason];
16954 } 16966 }
16955 16967
16956 16968
16957 } } // namespace v8::internal 16969 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698