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

Side by Side Diff: src/objects.h

Issue 3295017: Removing a wrong check.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 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 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 4197 matching lines...) Expand 10 before | Expand all | Expand 10 after
4208 // index. 4208 // index.
4209 bool is_array_index() { return is_array_index_; } 4209 bool is_array_index() { return is_array_index_; }
4210 4210
4211 bool is_valid() { return is_valid_; } 4211 bool is_valid() { return is_valid_; }
4212 4212
4213 void invalidate() { is_valid_ = false; } 4213 void invalidate() { is_valid_ = false; }
4214 4214
4215 // Calculated hash value for a string consisting of 1 to 4215 // Calculated hash value for a string consisting of 1 to
4216 // String::kMaxArrayIndexSize digits with no leading zeros (except "0"). 4216 // String::kMaxArrayIndexSize digits with no leading zeros (except "0").
4217 // value is represented decimal value. 4217 // value is represented decimal value.
4218 static uint32_t MakeCachedArrayIndex(uint32_t value, int length); 4218 static uint32_t MakeArrayIndexHash(uint32_t value, int length);
4219 4219
4220 private: 4220 private:
4221 4221
4222 uint32_t array_index() { 4222 uint32_t array_index() {
4223 ASSERT(is_array_index()); 4223 ASSERT(is_array_index());
4224 return array_index_; 4224 return array_index_;
4225 } 4225 }
4226 4226
4227 inline uint32_t GetHash(); 4227 inline uint32_t GetHash();
4228 4228
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
4452 static const int kMaxCachedArrayIndexLength = 7; 4452 static const int kMaxCachedArrayIndexLength = 7;
4453 4453
4454 // For strings which are array indexes the hash value has the string length 4454 // For strings which are array indexes the hash value has the string length
4455 // mixed into the hash, mainly to avoid a hash value of zero which would be 4455 // mixed into the hash, mainly to avoid a hash value of zero which would be
4456 // the case for the string '0'. 24 bits are used for the array index value. 4456 // the case for the string '0'. 24 bits are used for the array index value.
4457 static const int kArrayIndexValueBits = 24; 4457 static const int kArrayIndexValueBits = 24;
4458 static const int kArrayIndexLengthBits = 4458 static const int kArrayIndexLengthBits =
4459 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields; 4459 kBitsPerInt - kArrayIndexValueBits - kNofHashBitFields;
4460 4460
4461 STATIC_CHECK((kArrayIndexLengthBits > 0)); 4461 STATIC_CHECK((kArrayIndexLengthBits > 0));
4462 STATIC_CHECK(kMaxArrayIndexSize < (1 << kArrayIndexLengthBits));
4462 4463
4463 static const int kArrayIndexHashLengthShift = 4464 static const int kArrayIndexHashLengthShift =
4464 kArrayIndexValueBits + kNofHashBitFields; 4465 kArrayIndexValueBits + kNofHashBitFields;
4465 4466
4466 static const int kArrayIndexHashMask = (1 << kArrayIndexHashLengthShift) - 1; 4467 static const int kArrayIndexHashMask = (1 << kArrayIndexHashLengthShift) - 1;
4467 4468
4468 static const int kArrayIndexValueMask = 4469 static const int kArrayIndexValueMask =
4469 ((1 << kArrayIndexValueBits) - 1) << kHashShift; 4470 ((1 << kArrayIndexValueBits) - 1) << kHashShift;
4470 4471
4471 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we 4472 // Check that kMaxCachedArrayIndexLength + 1 is a power of two so we
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
5552 } else { 5553 } else {
5553 value &= ~(1 << bit_position); 5554 value &= ~(1 << bit_position);
5554 } 5555 }
5555 return value; 5556 return value;
5556 } 5557 }
5557 }; 5558 };
5558 5559
5559 } } // namespace v8::internal 5560 } } // namespace v8::internal
5560 5561
5561 #endif // V8_OBJECTS_H_ 5562 #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