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 6302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6313 } else { | 6313 } else { |
6314 // Index not already used. Look for an accessor in the prototype chain. | 6314 // Index not already used. Look for an accessor in the prototype chain. |
6315 if (!IsJSArray()) { | 6315 if (!IsJSArray()) { |
6316 if (SetElementWithCallbackSetterInPrototypes(index, value)) { | 6316 if (SetElementWithCallbackSetterInPrototypes(index, value)) { |
6317 return value; | 6317 return value; |
6318 } | 6318 } |
6319 } | 6319 } |
6320 // When we set the is_extensible flag to false we always force | 6320 // When we set the is_extensible flag to false we always force |
6321 // the element into dictionary mode (and force them to stay there). | 6321 // the element into dictionary mode (and force them to stay there). |
6322 if (!map()->is_extensible()) { | 6322 if (!map()->is_extensible()) { |
6323 Handle<Object> number(Heap::NumberFromUint32(index)); | 6323 Handle<Object> number(Factory::NewNumberFromUint(index)); |
6324 Handle<String> index_string(Factory::NumberToString(number)); | 6324 Handle<String> index_string(Factory::NumberToString(number)); |
6325 Handle<Object> args[1] = { index_string }; | 6325 Handle<Object> args[1] = { index_string }; |
6326 return Top::Throw(*Factory::NewTypeError("object_not_extensible", | 6326 return Top::Throw(*Factory::NewTypeError("object_not_extensible", |
6327 HandleVector(args, 1))); | 6327 HandleVector(args, 1))); |
6328 } | 6328 } |
6329 Object* result = dictionary->AtNumberPut(index, value); | 6329 Object* result = dictionary->AtNumberPut(index, value); |
6330 if (result->IsFailure()) return result; | 6330 if (result->IsFailure()) return result; |
6331 if (elms != FixedArray::cast(result)) { | 6331 if (elms != FixedArray::cast(result)) { |
6332 set_elements(FixedArray::cast(result)); | 6332 set_elements(FixedArray::cast(result)); |
6333 } | 6333 } |
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8427 | 8427 |
8428 Object* NumberDictionary::Set(uint32_t key, | 8428 Object* NumberDictionary::Set(uint32_t key, |
8429 Object* value, | 8429 Object* value, |
8430 PropertyDetails details) { | 8430 PropertyDetails details) { |
8431 int entry = FindEntry(key); | 8431 int entry = FindEntry(key); |
8432 if (entry == kNotFound) return AddNumberEntry(key, value, details); | 8432 if (entry == kNotFound) return AddNumberEntry(key, value, details); |
8433 // Preserve enumeration index. | 8433 // Preserve enumeration index. |
8434 details = PropertyDetails(details.attributes(), | 8434 details = PropertyDetails(details.attributes(), |
8435 details.type(), | 8435 details.type(), |
8436 DetailsAt(entry).index()); | 8436 DetailsAt(entry).index()); |
8437 SetEntry(entry, NumberDictionaryShape::AsObject(key), value, details); | 8437 Object* object_key = NumberDictionaryShape::AsObject(key); |
| 8438 if (object_key->IsFailure()) return object_key; |
| 8439 SetEntry(entry, object_key, value, details); |
8438 return this; | 8440 return this; |
8439 } | 8441 } |
8440 | 8442 |
8441 | 8443 |
8442 | 8444 |
8443 template<typename Shape, typename Key> | 8445 template<typename Shape, typename Key> |
8444 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( | 8446 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( |
8445 PropertyAttributes filter) { | 8447 PropertyAttributes filter) { |
8446 int capacity = HashTable<Shape, Key>::Capacity(); | 8448 int capacity = HashTable<Shape, Key>::Capacity(); |
8447 int result = 0; | 8449 int result = 0; |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8898 if (break_point_objects()->IsUndefined()) return 0; | 8900 if (break_point_objects()->IsUndefined()) return 0; |
8899 // Single beak point. | 8901 // Single beak point. |
8900 if (!break_point_objects()->IsFixedArray()) return 1; | 8902 if (!break_point_objects()->IsFixedArray()) return 1; |
8901 // Multiple break points. | 8903 // Multiple break points. |
8902 return FixedArray::cast(break_point_objects())->length(); | 8904 return FixedArray::cast(break_point_objects())->length(); |
8903 } | 8905 } |
8904 #endif | 8906 #endif |
8905 | 8907 |
8906 | 8908 |
8907 } } // namespace v8::internal | 8909 } } // namespace v8::internal |
OLD | NEW |