OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
(...skipping 3177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3188 return false; | 3188 return false; |
3189 } | 3189 } |
3190 return String::SlowEquals(Handle<String>::cast(one), | 3190 return String::SlowEquals(Handle<String>::cast(one), |
3191 Handle<String>::cast(two)); | 3191 Handle<String>::cast(two)); |
3192 } | 3192 } |
3193 | 3193 |
3194 | 3194 |
3195 ACCESSORS(Symbol, name, Object, kNameOffset) | 3195 ACCESSORS(Symbol, name, Object, kNameOffset) |
3196 ACCESSORS(Symbol, flags, Smi, kFlagsOffset) | 3196 ACCESSORS(Symbol, flags, Smi, kFlagsOffset) |
3197 BOOL_ACCESSORS(Symbol, flags, is_private, kPrivateBit) | 3197 BOOL_ACCESSORS(Symbol, flags, is_private, kPrivateBit) |
3198 BOOL_ACCESSORS(Symbol, flags, is_own, kOwnBit) | |
3199 | 3198 |
3200 | 3199 |
3201 bool String::Equals(String* other) { | 3200 bool String::Equals(String* other) { |
3202 if (other == this) return true; | 3201 if (other == this) return true; |
3203 if (this->IsInternalizedString() && other->IsInternalizedString()) { | 3202 if (this->IsInternalizedString() && other->IsInternalizedString()) { |
3204 return false; | 3203 return false; |
3205 } | 3204 } |
3206 return SlowEquals(other); | 3205 return SlowEquals(other); |
3207 } | 3206 } |
3208 | 3207 |
(...skipping 3179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6388 | 6387 |
6389 | 6388 |
6390 uint32_t Name::Hash() { | 6389 uint32_t Name::Hash() { |
6391 // Fast case: has hash code already been computed? | 6390 // Fast case: has hash code already been computed? |
6392 uint32_t field = hash_field(); | 6391 uint32_t field = hash_field(); |
6393 if (IsHashFieldComputed(field)) return field >> kHashShift; | 6392 if (IsHashFieldComputed(field)) return field >> kHashShift; |
6394 // Slow case: compute hash code and set it. Has to be a string. | 6393 // Slow case: compute hash code and set it. Has to be a string. |
6395 return String::cast(this)->ComputeAndSetHash(); | 6394 return String::cast(this)->ComputeAndSetHash(); |
6396 } | 6395 } |
6397 | 6396 |
6398 bool Name::IsOwn() { | 6397 |
6399 return this->IsSymbol() && Symbol::cast(this)->is_own(); | 6398 bool Name::IsPrivate() { |
| 6399 return this->IsSymbol() && Symbol::cast(this)->is_private(); |
6400 } | 6400 } |
6401 | 6401 |
6402 | 6402 |
6403 StringHasher::StringHasher(int length, uint32_t seed) | 6403 StringHasher::StringHasher(int length, uint32_t seed) |
6404 : length_(length), | 6404 : length_(length), |
6405 raw_running_hash_(seed), | 6405 raw_running_hash_(seed), |
6406 array_index_(0), | 6406 array_index_(0), |
6407 is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize), | 6407 is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize), |
6408 is_first_char_(true) { | 6408 is_first_char_(true) { |
6409 DCHECK(FLAG_randomize_hashes || raw_running_hash_ == 0); | 6409 DCHECK(FLAG_randomize_hashes || raw_running_hash_ == 0); |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7340 #undef READ_SHORT_FIELD | 7340 #undef READ_SHORT_FIELD |
7341 #undef WRITE_SHORT_FIELD | 7341 #undef WRITE_SHORT_FIELD |
7342 #undef READ_BYTE_FIELD | 7342 #undef READ_BYTE_FIELD |
7343 #undef WRITE_BYTE_FIELD | 7343 #undef WRITE_BYTE_FIELD |
7344 #undef NOBARRIER_READ_BYTE_FIELD | 7344 #undef NOBARRIER_READ_BYTE_FIELD |
7345 #undef NOBARRIER_WRITE_BYTE_FIELD | 7345 #undef NOBARRIER_WRITE_BYTE_FIELD |
7346 | 7346 |
7347 } } // namespace v8::internal | 7347 } } // namespace v8::internal |
7348 | 7348 |
7349 #endif // V8_OBJECTS_INL_H_ | 7349 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |