| 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 6230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6241 } else { | 6241 } else { |
| 6242 // Index not already used. Look for an accessor in the prototype chain. | 6242 // Index not already used. Look for an accessor in the prototype chain. |
| 6243 if (!IsJSArray()) { | 6243 if (!IsJSArray()) { |
| 6244 if (SetElementWithCallbackSetterInPrototypes(index, value)) { | 6244 if (SetElementWithCallbackSetterInPrototypes(index, value)) { |
| 6245 return value; | 6245 return value; |
| 6246 } | 6246 } |
| 6247 } | 6247 } |
| 6248 // When we set the is_extensible flag to false we always force | 6248 // When we set the is_extensible flag to false we always force |
| 6249 // the element into dictionary mode (and force them to stay there). | 6249 // the element into dictionary mode (and force them to stay there). |
| 6250 if (!map()->is_extensible()) { | 6250 if (!map()->is_extensible()) { |
| 6251 Handle<Object> number(Heap::NumberFromUint32(index)); | 6251 Handle<Object> number(Factory::NewNumberFromUint(index)); |
| 6252 Handle<String> index_string(Factory::NumberToString(number)); | 6252 Handle<String> index_string(Factory::NumberToString(number)); |
| 6253 Handle<Object> args[1] = { index_string }; | 6253 Handle<Object> args[1] = { index_string }; |
| 6254 return Top::Throw(*Factory::NewTypeError("object_not_extensible", | 6254 return Top::Throw(*Factory::NewTypeError("object_not_extensible", |
| 6255 HandleVector(args, 1))); | 6255 HandleVector(args, 1))); |
| 6256 } | 6256 } |
| 6257 Object* result = dictionary->AtNumberPut(index, value); | 6257 Object* result = dictionary->AtNumberPut(index, value); |
| 6258 if (result->IsFailure()) return result; | 6258 if (result->IsFailure()) return result; |
| 6259 if (elms != FixedArray::cast(result)) { | 6259 if (elms != FixedArray::cast(result)) { |
| 6260 set_elements(FixedArray::cast(result)); | 6260 set_elements(FixedArray::cast(result)); |
| 6261 } | 6261 } |
| (...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8312 | 8312 |
| 8313 Object* NumberDictionary::Set(uint32_t key, | 8313 Object* NumberDictionary::Set(uint32_t key, |
| 8314 Object* value, | 8314 Object* value, |
| 8315 PropertyDetails details) { | 8315 PropertyDetails details) { |
| 8316 int entry = FindEntry(key); | 8316 int entry = FindEntry(key); |
| 8317 if (entry == kNotFound) return AddNumberEntry(key, value, details); | 8317 if (entry == kNotFound) return AddNumberEntry(key, value, details); |
| 8318 // Preserve enumeration index. | 8318 // Preserve enumeration index. |
| 8319 details = PropertyDetails(details.attributes(), | 8319 details = PropertyDetails(details.attributes(), |
| 8320 details.type(), | 8320 details.type(), |
| 8321 DetailsAt(entry).index()); | 8321 DetailsAt(entry).index()); |
| 8322 SetEntry(entry, NumberDictionaryShape::AsObject(key), value, details); | 8322 Object* object_key = NumberDictionaryShape::AsObject(key); |
| 8323 if (object_key->IsFailure()) return object_key; |
| 8324 SetEntry(entry, object_key, value, details); |
| 8323 return this; | 8325 return this; |
| 8324 } | 8326 } |
| 8325 | 8327 |
| 8326 | 8328 |
| 8327 | 8329 |
| 8328 template<typename Shape, typename Key> | 8330 template<typename Shape, typename Key> |
| 8329 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( | 8331 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( |
| 8330 PropertyAttributes filter) { | 8332 PropertyAttributes filter) { |
| 8331 int capacity = HashTable<Shape, Key>::Capacity(); | 8333 int capacity = HashTable<Shape, Key>::Capacity(); |
| 8332 int result = 0; | 8334 int result = 0; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8783 if (break_point_objects()->IsUndefined()) return 0; | 8785 if (break_point_objects()->IsUndefined()) return 0; |
| 8784 // Single beak point. | 8786 // Single beak point. |
| 8785 if (!break_point_objects()->IsFixedArray()) return 1; | 8787 if (!break_point_objects()->IsFixedArray()) return 1; |
| 8786 // Multiple break points. | 8788 // Multiple break points. |
| 8787 return FixedArray::cast(break_point_objects())->length(); | 8789 return FixedArray::cast(break_point_objects())->length(); |
| 8788 } | 8790 } |
| 8789 #endif | 8791 #endif |
| 8790 | 8792 |
| 8791 | 8793 |
| 8792 } } // namespace v8::internal | 8794 } } // namespace v8::internal |
| OLD | NEW |