| 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 5918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5929 return counter; | 5929 return counter; |
| 5930 } | 5930 } |
| 5931 | 5931 |
| 5932 | 5932 |
| 5933 int JSObject::GetEnumElementKeys(FixedArray* storage) { | 5933 int JSObject::GetEnumElementKeys(FixedArray* storage) { |
| 5934 return GetLocalElementKeys(storage, | 5934 return GetLocalElementKeys(storage, |
| 5935 static_cast<PropertyAttributes>(DONT_ENUM)); | 5935 static_cast<PropertyAttributes>(DONT_ENUM)); |
| 5936 } | 5936 } |
| 5937 | 5937 |
| 5938 | 5938 |
| 5939 // Thomas Wang, Integer Hash Functions. | |
| 5940 // http://www.concentric.net/~Ttwang/tech/inthash.htm | |
| 5941 static uint32_t ComputeIntegerHash(uint32_t key) { | |
| 5942 uint32_t hash = key; | |
| 5943 hash = ~hash + (hash << 15); // hash = (hash << 15) - hash - 1; | |
| 5944 hash = hash ^ (hash >> 12); | |
| 5945 hash = hash + (hash << 2); | |
| 5946 hash = hash ^ (hash >> 4); | |
| 5947 hash = hash * 2057; // hash = (hash + (hash << 3)) + (hash << 11); | |
| 5948 hash = hash ^ (hash >> 16); | |
| 5949 return hash; | |
| 5950 } | |
| 5951 | |
| 5952 | |
| 5953 // The NumberKey uses carries the uint32_t as key. | 5939 // The NumberKey uses carries the uint32_t as key. |
| 5954 // This avoids allocation in HasProperty. | 5940 // This avoids allocation in HasProperty. |
| 5955 class NumberKey : public HashTableKey { | 5941 class NumberKey : public HashTableKey { |
| 5956 public: | 5942 public: |
| 5957 explicit NumberKey(uint32_t number) : number_(number) { } | 5943 explicit NumberKey(uint32_t number) : number_(number) { } |
| 5958 | 5944 |
| 5959 bool IsMatch(Object* number) { | 5945 bool IsMatch(Object* number) { |
| 5960 return number_ == ToUint32(number); | 5946 return number_ == ToUint32(number); |
| 5961 } | 5947 } |
| 5962 | 5948 |
| (...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7472 // No break point. | 7458 // No break point. |
| 7473 if (break_point_objects()->IsUndefined()) return 0; | 7459 if (break_point_objects()->IsUndefined()) return 0; |
| 7474 // Single beak point. | 7460 // Single beak point. |
| 7475 if (!break_point_objects()->IsFixedArray()) return 1; | 7461 if (!break_point_objects()->IsFixedArray()) return 1; |
| 7476 // Multiple break points. | 7462 // Multiple break points. |
| 7477 return FixedArray::cast(break_point_objects())->length(); | 7463 return FixedArray::cast(break_point_objects())->length(); |
| 7478 } | 7464 } |
| 7479 #endif | 7465 #endif |
| 7480 | 7466 |
| 7481 } } // namespace v8::internal | 7467 } } // namespace v8::internal |
| OLD | NEW |