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

Side by Side Diff: src/objects-inl.h

Issue 2452007: Fix bug that could cause a string to be incorrectly tagged as an array index. (Closed)
Patch Set: Created 10 years, 6 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
« no previous file with comments | « no previous file | test/cctest/test-strings.cc » ('j') | test/cctest/test-strings.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 2968 matching lines...) Expand 10 before | Expand all | Expand 10 after
2979 if (IsHashFieldComputed(field)) return field >> kHashShift; 2979 if (IsHashFieldComputed(field)) return field >> kHashShift;
2980 // Slow case: compute hash code and set it. 2980 // Slow case: compute hash code and set it.
2981 return ComputeAndSetHash(); 2981 return ComputeAndSetHash();
2982 } 2982 }
2983 2983
2984 2984
2985 StringHasher::StringHasher(int length) 2985 StringHasher::StringHasher(int length)
2986 : length_(length), 2986 : length_(length),
2987 raw_running_hash_(0), 2987 raw_running_hash_(0),
2988 array_index_(0), 2988 array_index_(0),
2989 is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize), 2989 is_array_index_(0 < length_ &&
2990 length_ <= String::kMaxCachedArrayIndexLength),
2990 is_first_char_(true), 2991 is_first_char_(true),
2991 is_valid_(true) { } 2992 is_valid_(true) { }
2992 2993
2993 2994
2994 bool StringHasher::has_trivial_hash() { 2995 bool StringHasher::has_trivial_hash() {
2995 return length_ > String::kMaxHashCalcLength; 2996 return length_ > String::kMaxHashCalcLength;
2996 } 2997 }
2997 2998
2998 2999
2999 void StringHasher::AddCharacter(uc32 c) { 3000 void StringHasher::AddCharacter(uc32 c) {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
3223 #undef WRITE_INT_FIELD 3224 #undef WRITE_INT_FIELD
3224 #undef READ_SHORT_FIELD 3225 #undef READ_SHORT_FIELD
3225 #undef WRITE_SHORT_FIELD 3226 #undef WRITE_SHORT_FIELD
3226 #undef READ_BYTE_FIELD 3227 #undef READ_BYTE_FIELD
3227 #undef WRITE_BYTE_FIELD 3228 #undef WRITE_BYTE_FIELD
3228 3229
3229 3230
3230 } } // namespace v8::internal 3231 } } // namespace v8::internal
3231 3232
3232 #endif // V8_OBJECTS_INL_H_ 3233 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-strings.cc » ('j') | test/cctest/test-strings.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698