| 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 8137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8148 return Heap::false_value(); | 8148 return Heap::false_value(); |
| 8149 } | 8149 } |
| 8150 SetEntry(entry, Heap::null_value(), Heap::null_value(), Smi::FromInt(0)); | 8150 SetEntry(entry, Heap::null_value(), Heap::null_value(), Smi::FromInt(0)); |
| 8151 HashTable<Shape, Key>::ElementRemoved(); | 8151 HashTable<Shape, Key>::ElementRemoved(); |
| 8152 return Heap::true_value(); | 8152 return Heap::true_value(); |
| 8153 } | 8153 } |
| 8154 | 8154 |
| 8155 | 8155 |
| 8156 template<typename Shape, typename Key> | 8156 template<typename Shape, typename Key> |
| 8157 Object* Dictionary<Shape, Key>::AtPut(Key key, Object* value) { | 8157 Object* Dictionary<Shape, Key>::AtPut(Key key, Object* value) { |
| 8158 int entry = FindEntry(key); | 8158 int entry = this->FindEntry(key); |
| 8159 | 8159 |
| 8160 // If the entry is present set the value; | 8160 // If the entry is present set the value; |
| 8161 if (entry != Dictionary<Shape, Key>::kNotFound) { | 8161 if (entry != Dictionary<Shape, Key>::kNotFound) { |
| 8162 ValueAtPut(entry, value); | 8162 ValueAtPut(entry, value); |
| 8163 return this; | 8163 return this; |
| 8164 } | 8164 } |
| 8165 | 8165 |
| 8166 // Check whether the dictionary should be extended. | 8166 // Check whether the dictionary should be extended. |
| 8167 Object* obj = EnsureCapacity(1, key); | 8167 Object* obj = EnsureCapacity(1, key); |
| 8168 if (obj->IsFailure()) return obj; | 8168 if (obj->IsFailure()) return obj; |
| 8169 | 8169 |
| 8170 Object* k = Shape::AsObject(key); | 8170 Object* k = Shape::AsObject(key); |
| 8171 if (k->IsFailure()) return k; | 8171 if (k->IsFailure()) return k; |
| 8172 PropertyDetails details = PropertyDetails(NONE, NORMAL); | 8172 PropertyDetails details = PropertyDetails(NONE, NORMAL); |
| 8173 return Dictionary<Shape, Key>::cast(obj)-> | 8173 return Dictionary<Shape, Key>::cast(obj)-> |
| 8174 AddEntry(key, value, details, Shape::Hash(key)); | 8174 AddEntry(key, value, details, Shape::Hash(key)); |
| 8175 } | 8175 } |
| 8176 | 8176 |
| 8177 | 8177 |
| 8178 template<typename Shape, typename Key> | 8178 template<typename Shape, typename Key> |
| 8179 Object* Dictionary<Shape, Key>::Add(Key key, | 8179 Object* Dictionary<Shape, Key>::Add(Key key, |
| 8180 Object* value, | 8180 Object* value, |
| 8181 PropertyDetails details) { | 8181 PropertyDetails details) { |
| 8182 // Valdate key is absent. | 8182 // Valdate key is absent. |
| 8183 SLOW_ASSERT((FindEntry(key) == Dictionary<Shape, Key>::kNotFound)); | 8183 SLOW_ASSERT((this->FindEntry(key) == Dictionary<Shape, Key>::kNotFound)); |
| 8184 // Check whether the dictionary should be extended. | 8184 // Check whether the dictionary should be extended. |
| 8185 Object* obj = EnsureCapacity(1, key); | 8185 Object* obj = EnsureCapacity(1, key); |
| 8186 if (obj->IsFailure()) return obj; | 8186 if (obj->IsFailure()) return obj; |
| 8187 return Dictionary<Shape, Key>::cast(obj)-> | 8187 return Dictionary<Shape, Key>::cast(obj)-> |
| 8188 AddEntry(key, value, details, Shape::Hash(key)); | 8188 AddEntry(key, value, details, Shape::Hash(key)); |
| 8189 } | 8189 } |
| 8190 | 8190 |
| 8191 | 8191 |
| 8192 // Add a key, value pair to the dictionary. | 8192 // Add a key, value pair to the dictionary. |
| 8193 template<typename Shape, typename Key> | 8193 template<typename Shape, typename Key> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8232 FixedArray::set(kMaxNumberKeyIndex, | 8232 FixedArray::set(kMaxNumberKeyIndex, |
| 8233 Smi::FromInt(key << kRequiresSlowElementsTagSize)); | 8233 Smi::FromInt(key << kRequiresSlowElementsTagSize)); |
| 8234 } | 8234 } |
| 8235 } | 8235 } |
| 8236 | 8236 |
| 8237 | 8237 |
| 8238 Object* NumberDictionary::AddNumberEntry(uint32_t key, | 8238 Object* NumberDictionary::AddNumberEntry(uint32_t key, |
| 8239 Object* value, | 8239 Object* value, |
| 8240 PropertyDetails details) { | 8240 PropertyDetails details) { |
| 8241 UpdateMaxNumberKey(key); | 8241 UpdateMaxNumberKey(key); |
| 8242 SLOW_ASSERT(FindEntry(key) == kNotFound); | 8242 SLOW_ASSERT(this->FindEntry(key) == kNotFound); |
| 8243 return Add(key, value, details); | 8243 return Add(key, value, details); |
| 8244 } | 8244 } |
| 8245 | 8245 |
| 8246 | 8246 |
| 8247 Object* NumberDictionary::AtNumberPut(uint32_t key, Object* value) { | 8247 Object* NumberDictionary::AtNumberPut(uint32_t key, Object* value) { |
| 8248 UpdateMaxNumberKey(key); | 8248 UpdateMaxNumberKey(key); |
| 8249 return AtPut(key, value); | 8249 return AtPut(key, value); |
| 8250 } | 8250 } |
| 8251 | 8251 |
| 8252 | 8252 |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8723 if (break_point_objects()->IsUndefined()) return 0; | 8723 if (break_point_objects()->IsUndefined()) return 0; |
| 8724 // Single beak point. | 8724 // Single beak point. |
| 8725 if (!break_point_objects()->IsFixedArray()) return 1; | 8725 if (!break_point_objects()->IsFixedArray()) return 1; |
| 8726 // Multiple break points. | 8726 // Multiple break points. |
| 8727 return FixedArray::cast(break_point_objects())->length(); | 8727 return FixedArray::cast(break_point_objects())->length(); |
| 8728 } | 8728 } |
| 8729 #endif | 8729 #endif |
| 8730 | 8730 |
| 8731 | 8731 |
| 8732 } } // namespace v8::internal | 8732 } } // namespace v8::internal |
| OLD | NEW |