Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Side by Side Diff: src/objects.h

Issue 9113006: Fix the logic that should ensure that a string cannot have (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6441 matching lines...) Expand 10 before | Expand all | Expand 10 after
6452 // whether a hash code has been computed. If the hash code has been 6452 // whether a hash code has been computed. If the hash code has been
6453 // computed the 2nd bit tells whether the string can be used as an 6453 // computed the 2nd bit tells whether the string can be used as an
6454 // array index. 6454 // array index.
6455 static const int kHashNotComputedMask = 1; 6455 static const int kHashNotComputedMask = 1;
6456 static const int kIsNotArrayIndexMask = 1 << 1; 6456 static const int kIsNotArrayIndexMask = 1 << 1;
6457 static const int kNofHashBitFields = 2; 6457 static const int kNofHashBitFields = 2;
6458 6458
6459 // Shift constant retrieving hash code from hash field. 6459 // Shift constant retrieving hash code from hash field.
6460 static const int kHashShift = kNofHashBitFields; 6460 static const int kHashShift = kNofHashBitFields;
6461 6461
6462 // Only these bits are relevant in the hash, since the top two are shifted
6463 // out.
6464 static const uint32_t kHashBitMask = 0xffffffffu >> kHashShift;
6465
6462 // Array index strings this short can keep their index in the hash 6466 // Array index strings this short can keep their index in the hash
6463 // field. 6467 // field.
6464 static const int kMaxCachedArrayIndexLength = 7; 6468 static const int kMaxCachedArrayIndexLength = 7;
6465 6469
6466 // For strings which are array indexes the hash value has the string length 6470 // For strings which are array indexes the hash value has the string length
6467 // mixed into the hash, mainly to avoid a hash value of zero which would be 6471 // mixed into the hash, mainly to avoid a hash value of zero which would be
6468 // the case for the string '0'. 24 bits are used for the array index value. 6472 // the case for the string '0'. 24 bits are used for the array index value.
6469 static const int kArrayIndexValueBits = 24; 6473 static const int kArrayIndexValueBits = 24;
6470 static const int kArrayIndexLengthBits = 6474 static const int kArrayIndexLengthBits =
6471 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields; 6475 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields;
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after
8011 } else { 8015 } else {
8012 value &= ~(1 << bit_position); 8016 value &= ~(1 << bit_position);
8013 } 8017 }
8014 return value; 8018 return value;
8015 } 8019 }
8016 }; 8020 };
8017 8021
8018 } } // namespace v8::internal 8022 } } // namespace v8::internal
8019 8023
8020 #endif // V8_OBJECTS_H_ 8024 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698