OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 if (result.IsValid()) return SetProperty(&result, name, value, attributes); | 1295 if (result.IsValid()) return SetProperty(&result, name, value, attributes); |
1296 // Add real property. | 1296 // Add real property. |
1297 return AddProperty(name, value, attributes); | 1297 return AddProperty(name, value, attributes); |
1298 } | 1298 } |
1299 | 1299 |
1300 | 1300 |
1301 Object* JSObject::ReplaceSlowProperty(String* name, | 1301 Object* JSObject::ReplaceSlowProperty(String* name, |
1302 Object* value, | 1302 Object* value, |
1303 PropertyAttributes attributes) { | 1303 PropertyAttributes attributes) { |
1304 Dictionary* dictionary = property_dictionary(); | 1304 Dictionary* dictionary = property_dictionary(); |
1305 PropertyDetails old_details = | 1305 int old_index = dictionary->FindStringEntry(name); |
1306 dictionary->DetailsAt(dictionary->FindStringEntry(name)); | 1306 int new_enumeration_index = 0; // 0 means "Use the next available index." |
1307 int new_index = old_details.index(); | 1307 if (old_index != -1) { |
1308 if (old_details.IsTransition()) new_index = 0; | 1308 // All calls to ReplaceSlowProperty have had all transitions removed. |
| 1309 ASSERT(!dictionary->DetailsAt(old_index).IsTransition()); |
| 1310 new_enumeration_index = dictionary->DetailsAt(old_index).index(); |
| 1311 } |
1309 | 1312 |
1310 PropertyDetails new_details(attributes, NORMAL, old_details.index()); | 1313 PropertyDetails new_details(attributes, NORMAL, new_enumeration_index); |
1311 Object* result = | 1314 Object* result = |
1312 property_dictionary()->SetOrAddStringEntry(name, value, new_details); | 1315 dictionary->SetOrAddStringEntry(name, value, new_details); |
1313 if (result->IsFailure()) return result; | 1316 if (result->IsFailure()) return result; |
1314 if (property_dictionary() != result) { | 1317 if (dictionary != result) { |
1315 set_properties(Dictionary::cast(result)); | 1318 set_properties(Dictionary::cast(result)); |
1316 } | 1319 } |
1317 return value; | 1320 return value; |
1318 } | 1321 } |
1319 | 1322 |
1320 Object* JSObject::ConvertDescriptorToFieldAndMapTransition( | 1323 Object* JSObject::ConvertDescriptorToFieldAndMapTransition( |
1321 String* name, | 1324 String* name, |
1322 Object* new_value, | 1325 Object* new_value, |
1323 PropertyAttributes attributes) { | 1326 PropertyAttributes attributes) { |
1324 Map* old_map = map(); | 1327 Map* old_map = map(); |
(...skipping 6152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7477 // No break point. | 7480 // No break point. |
7478 if (break_point_objects()->IsUndefined()) return 0; | 7481 if (break_point_objects()->IsUndefined()) return 0; |
7479 // Single beak point. | 7482 // Single beak point. |
7480 if (!break_point_objects()->IsFixedArray()) return 1; | 7483 if (!break_point_objects()->IsFixedArray()) return 1; |
7481 // Multiple break points. | 7484 // Multiple break points. |
7482 return FixedArray::cast(break_point_objects())->length(); | 7485 return FixedArray::cast(break_point_objects())->length(); |
7483 } | 7486 } |
7484 #endif | 7487 #endif |
7485 | 7488 |
7486 } } // namespace v8::internal | 7489 } } // namespace v8::internal |
OLD | NEW |