OLD | NEW |
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 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2332 int length = descriptors->number_of_descriptors(); | 2332 int length = descriptors->number_of_descriptors(); |
2333 for (int i = 0; i < length; i++) { | 2333 for (int i = 0; i < length; i++) { |
2334 descriptors->SetRepresentation(i, Representation::Tagged()); | 2334 descriptors->SetRepresentation(i, Representation::Tagged()); |
2335 if (descriptors->GetDetails(i).type() == FIELD) { | 2335 if (descriptors->GetDetails(i).type() == FIELD) { |
2336 descriptors->SetValue(i, HeapType::Any()); | 2336 descriptors->SetValue(i, HeapType::Any()); |
2337 } | 2337 } |
2338 } | 2338 } |
2339 | 2339 |
2340 // Unless the instance is being migrated, ensure that modify_index is a field. | 2340 // Unless the instance is being migrated, ensure that modify_index is a field. |
2341 PropertyDetails details = descriptors->GetDetails(modify_index); | 2341 PropertyDetails details = descriptors->GetDetails(modify_index); |
2342 if (store_mode == FORCE_FIELD && details.type() != FIELD) { | 2342 if (store_mode == FORCE_FIELD && |
| 2343 (details.type() != FIELD || details.attributes() != attributes)) { |
| 2344 int field_index = details.type() == FIELD ? details.field_index() |
| 2345 : new_map->NumberOfFields(); |
2343 FieldDescriptor d(handle(descriptors->GetKey(modify_index), isolate), | 2346 FieldDescriptor d(handle(descriptors->GetKey(modify_index), isolate), |
2344 new_map->NumberOfFields(), | 2347 field_index, attributes, Representation::Tagged()); |
2345 attributes, | |
2346 Representation::Tagged()); | |
2347 descriptors->Replace(modify_index, &d); | 2348 descriptors->Replace(modify_index, &d); |
2348 int unused_property_fields = new_map->unused_property_fields() - 1; | 2349 if (details.type() != FIELD) { |
2349 if (unused_property_fields < 0) { | 2350 int unused_property_fields = new_map->unused_property_fields() - 1; |
2350 unused_property_fields += JSObject::kFieldsAdded; | 2351 if (unused_property_fields < 0) { |
| 2352 unused_property_fields += JSObject::kFieldsAdded; |
| 2353 } |
| 2354 new_map->set_unused_property_fields(unused_property_fields); |
2351 } | 2355 } |
2352 new_map->set_unused_property_fields(unused_property_fields); | 2356 } else { |
| 2357 ASSERT(details.attributes() == attributes); |
2353 } | 2358 } |
2354 | 2359 |
2355 if (FLAG_trace_generalization) { | 2360 if (FLAG_trace_generalization) { |
2356 HeapType* field_type = (details.type() == FIELD) | 2361 HeapType* field_type = (details.type() == FIELD) |
2357 ? map->instance_descriptors()->GetFieldType(modify_index) | 2362 ? map->instance_descriptors()->GetFieldType(modify_index) |
2358 : NULL; | 2363 : NULL; |
2359 map->PrintGeneralization(stdout, reason, modify_index, | 2364 map->PrintGeneralization(stdout, reason, modify_index, |
2360 new_map->NumberOfOwnDescriptors(), | 2365 new_map->NumberOfOwnDescriptors(), |
2361 new_map->NumberOfOwnDescriptors(), | 2366 new_map->NumberOfOwnDescriptors(), |
2362 details.type() == CONSTANT && store_mode == FORCE_FIELD, | 2367 details.type() == CONSTANT && store_mode == FORCE_FIELD, |
(...skipping 14632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16995 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17000 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16996 static const char* error_messages_[] = { | 17001 static const char* error_messages_[] = { |
16997 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17002 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16998 }; | 17003 }; |
16999 #undef ERROR_MESSAGES_TEXTS | 17004 #undef ERROR_MESSAGES_TEXTS |
17000 return error_messages_[reason]; | 17005 return error_messages_[reason]; |
17001 } | 17006 } |
17002 | 17007 |
17003 | 17008 |
17004 } } // namespace v8::internal | 17009 } } // namespace v8::internal |
OLD | NEW |