| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 6433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6444 } else { | 6444 } else { |
| 6445 // Index not already used. Look for an accessor in the prototype chain. | 6445 // Index not already used. Look for an accessor in the prototype chain. |
| 6446 if (!IsJSArray()) { | 6446 if (!IsJSArray()) { |
| 6447 if (SetElementWithCallbackSetterInPrototypes(index, value)) { | 6447 if (SetElementWithCallbackSetterInPrototypes(index, value)) { |
| 6448 return value; | 6448 return value; |
| 6449 } | 6449 } |
| 6450 } | 6450 } |
| 6451 // When we set the is_extensible flag to false we always force | 6451 // When we set the is_extensible flag to false we always force |
| 6452 // the element into dictionary mode (and force them to stay there). | 6452 // the element into dictionary mode (and force them to stay there). |
| 6453 if (!map()->is_extensible()) { | 6453 if (!map()->is_extensible()) { |
| 6454 Handle<Object> number(Heap::NumberFromUint32(index)); | 6454 Handle<Object> number(Factory::NewNumberFromUint(index)); |
| 6455 Handle<String> index_string(Factory::NumberToString(number)); | 6455 Handle<String> index_string(Factory::NumberToString(number)); |
| 6456 Handle<Object> args[1] = { index_string }; | 6456 Handle<Object> args[1] = { index_string }; |
| 6457 return Top::Throw(*Factory::NewTypeError("object_not_extensible", | 6457 return Top::Throw(*Factory::NewTypeError("object_not_extensible", |
| 6458 HandleVector(args, 1))); | 6458 HandleVector(args, 1))); |
| 6459 } | 6459 } |
| 6460 Object* result = dictionary->AtNumberPut(index, value); | 6460 Object* result = dictionary->AtNumberPut(index, value); |
| 6461 if (result->IsFailure()) return result; | 6461 if (result->IsFailure()) return result; |
| 6462 if (elms != FixedArray::cast(result)) { | 6462 if (elms != FixedArray::cast(result)) { |
| 6463 set_elements(FixedArray::cast(result)); | 6463 set_elements(FixedArray::cast(result)); |
| 6464 } | 6464 } |
| (...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8558 | 8558 |
| 8559 Object* NumberDictionary::Set(uint32_t key, | 8559 Object* NumberDictionary::Set(uint32_t key, |
| 8560 Object* value, | 8560 Object* value, |
| 8561 PropertyDetails details) { | 8561 PropertyDetails details) { |
| 8562 int entry = FindEntry(key); | 8562 int entry = FindEntry(key); |
| 8563 if (entry == kNotFound) return AddNumberEntry(key, value, details); | 8563 if (entry == kNotFound) return AddNumberEntry(key, value, details); |
| 8564 // Preserve enumeration index. | 8564 // Preserve enumeration index. |
| 8565 details = PropertyDetails(details.attributes(), | 8565 details = PropertyDetails(details.attributes(), |
| 8566 details.type(), | 8566 details.type(), |
| 8567 DetailsAt(entry).index()); | 8567 DetailsAt(entry).index()); |
| 8568 SetEntry(entry, NumberDictionaryShape::AsObject(key), value, details); | 8568 Object* object_key = NumberDictionaryShape::AsObject(key); |
| 8569 if (object_key->IsFailure()) return object_key; |
| 8570 SetEntry(entry, object_key, value, details); |
| 8569 return this; | 8571 return this; |
| 8570 } | 8572 } |
| 8571 | 8573 |
| 8572 | 8574 |
| 8573 | 8575 |
| 8574 template<typename Shape, typename Key> | 8576 template<typename Shape, typename Key> |
| 8575 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( | 8577 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( |
| 8576 PropertyAttributes filter) { | 8578 PropertyAttributes filter) { |
| 8577 int capacity = HashTable<Shape, Key>::Capacity(); | 8579 int capacity = HashTable<Shape, Key>::Capacity(); |
| 8578 int result = 0; | 8580 int result = 0; |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9034 if (break_point_objects()->IsUndefined()) return 0; | 9036 if (break_point_objects()->IsUndefined()) return 0; |
| 9035 // Single beak point. | 9037 // Single beak point. |
| 9036 if (!break_point_objects()->IsFixedArray()) return 1; | 9038 if (!break_point_objects()->IsFixedArray()) return 1; |
| 9037 // Multiple break points. | 9039 // Multiple break points. |
| 9038 return FixedArray::cast(break_point_objects())->length(); | 9040 return FixedArray::cast(break_point_objects())->length(); |
| 9039 } | 9041 } |
| 9040 #endif | 9042 #endif |
| 9041 | 9043 |
| 9042 | 9044 |
| 9043 } } // namespace v8::internal | 9045 } } // namespace v8::internal |
| OLD | NEW |