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

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

Issue 2701003: Revert r4782. Fix issues 728, 732. (Closed)
Patch Set: fix review remarks, add static checks 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
« src/objects.h ('K') | « src/objects.cc ('k') | src/utils.h » ('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-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_ && 2989 is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize),
2990 length_ <= String::kMaxCachedArrayIndexLength),
2991 is_first_char_(true), 2990 is_first_char_(true),
2992 is_valid_(true) { } 2991 is_valid_(true) { }
2993 2992
2994 2993
2995 bool StringHasher::has_trivial_hash() { 2994 bool StringHasher::has_trivial_hash() {
2996 return length_ > String::kMaxHashCalcLength; 2995 return length_ > String::kMaxHashCalcLength;
2997 } 2996 }
2998 2997
2999 2998
3000 void StringHasher::AddCharacter(uc32 c) { 2999 void StringHasher::AddCharacter(uc32 c) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3043 result += (result << 15); 3042 result += (result << 15);
3044 if (result == 0) { 3043 if (result == 0) {
3045 result = 27; 3044 result = 27;
3046 } 3045 }
3047 return result; 3046 return result;
3048 } 3047 }
3049 3048
3050 3049
3051 bool String::AsArrayIndex(uint32_t* index) { 3050 bool String::AsArrayIndex(uint32_t* index) {
3052 uint32_t field = hash_field(); 3051 uint32_t field = hash_field();
3053 if (IsHashFieldComputed(field) && !(field & kIsArrayIndexMask)) return false; 3052 if (IsHashFieldComputed(field) && (field & kIsNotArrayIndexMask)) {
3053 return false;
3054 }
3054 return SlowAsArrayIndex(index); 3055 return SlowAsArrayIndex(index);
3055 } 3056 }
3056 3057
3057 3058
3058 Object* JSObject::GetPrototype() { 3059 Object* JSObject::GetPrototype() {
3059 return JSObject::cast(this)->map()->prototype(); 3060 return JSObject::cast(this)->map()->prototype();
3060 } 3061 }
3061 3062
3062 3063
3063 PropertyAttributes JSObject::GetPropertyAttribute(String* key) { 3064 PropertyAttributes JSObject::GetPropertyAttribute(String* key) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
3224 #undef WRITE_INT_FIELD 3225 #undef WRITE_INT_FIELD
3225 #undef READ_SHORT_FIELD 3226 #undef READ_SHORT_FIELD
3226 #undef WRITE_SHORT_FIELD 3227 #undef WRITE_SHORT_FIELD
3227 #undef READ_BYTE_FIELD 3228 #undef READ_BYTE_FIELD
3228 #undef WRITE_BYTE_FIELD 3229 #undef WRITE_BYTE_FIELD
3229 3230
3230 3231
3231 } } // namespace v8::internal 3232 } } // namespace v8::internal
3232 3233
3233 #endif // V8_OBJECTS_INL_H_ 3234 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects.h ('K') | « src/objects.cc ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698