OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 11426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11437 hash += hash << 10; | 11437 hash += hash << 10; |
11438 hash ^= hash >> 6; | 11438 hash ^= hash >> 6; |
11439 // Char 2. | 11439 // Char 2. |
11440 hash += c2; | 11440 hash += c2; |
11441 hash += hash << 10; | 11441 hash += hash << 10; |
11442 hash ^= hash >> 6; | 11442 hash ^= hash >> 6; |
11443 // GetHash. | 11443 // GetHash. |
11444 hash += hash << 3; | 11444 hash += hash << 3; |
11445 hash ^= hash >> 11; | 11445 hash ^= hash >> 11; |
11446 hash += hash << 15; | 11446 hash += hash << 15; |
11447 if (hash == 0) hash = 27; | 11447 if ((hash & String::kHashBitMask) == 0) hash = 27; |
11448 #ifdef DEBUG | 11448 #ifdef DEBUG |
11449 StringHasher hasher(2, seed); | 11449 StringHasher hasher(2, seed); |
11450 hasher.AddCharacter(c1); | 11450 hasher.AddCharacter(c1); |
11451 hasher.AddCharacter(c2); | 11451 hasher.AddCharacter(c2); |
11452 // If this assert fails then we failed to reproduce the two-character | 11452 // If this assert fails then we failed to reproduce the two-character |
11453 // version of the string hashing algorithm above. One reason could be | 11453 // version of the string hashing algorithm above. One reason could be |
11454 // that we were passed two digits as characters, since the hash | 11454 // that we were passed two digits as characters, since the hash |
11455 // algorithm is different in that case. | 11455 // algorithm is different in that case. |
11456 ASSERT_EQ(static_cast<int>(hasher.GetHash()), static_cast<int>(hash)); | 11456 ASSERT_EQ(static_cast<int>(hasher.GetHash()), static_cast<int>(hash)); |
11457 #endif | 11457 #endif |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12598 if (break_point_objects()->IsUndefined()) return 0; | 12598 if (break_point_objects()->IsUndefined()) return 0; |
12599 // Single break point. | 12599 // Single break point. |
12600 if (!break_point_objects()->IsFixedArray()) return 1; | 12600 if (!break_point_objects()->IsFixedArray()) return 1; |
12601 // Multiple break points. | 12601 // Multiple break points. |
12602 return FixedArray::cast(break_point_objects())->length(); | 12602 return FixedArray::cast(break_point_objects())->length(); |
12603 } | 12603 } |
12604 #endif // ENABLE_DEBUGGER_SUPPORT | 12604 #endif // ENABLE_DEBUGGER_SUPPORT |
12605 | 12605 |
12606 | 12606 |
12607 } } // namespace v8::internal | 12607 } } // namespace v8::internal |
OLD | NEW |