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 3354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3365 return false; | 3365 return false; |
3366 } | 3366 } |
3367 return String::SlowEquals(Handle<String>::cast(one), | 3367 return String::SlowEquals(Handle<String>::cast(one), |
3368 Handle<String>::cast(two)); | 3368 Handle<String>::cast(two)); |
3369 } | 3369 } |
3370 | 3370 |
3371 | 3371 |
3372 ACCESSORS(Symbol, name, Object, kNameOffset) | 3372 ACCESSORS(Symbol, name, Object, kNameOffset) |
3373 ACCESSORS(Symbol, flags, Smi, kFlagsOffset) | 3373 ACCESSORS(Symbol, flags, Smi, kFlagsOffset) |
3374 BOOL_ACCESSORS(Symbol, flags, is_private, kPrivateBit) | 3374 BOOL_ACCESSORS(Symbol, flags, is_private, kPrivateBit) |
3375 BOOL_ACCESSORS(Symbol, flags, is_own, kOwnBit) | |
3376 | 3375 |
3377 | 3376 |
3378 bool String::Equals(String* other) { | 3377 bool String::Equals(String* other) { |
3379 if (other == this) return true; | 3378 if (other == this) return true; |
3380 if (this->IsInternalizedString() && other->IsInternalizedString()) { | 3379 if (this->IsInternalizedString() && other->IsInternalizedString()) { |
3381 return false; | 3380 return false; |
3382 } | 3381 } |
3383 return SlowEquals(other); | 3382 return SlowEquals(other); |
3384 } | 3383 } |
3385 | 3384 |
(...skipping 3104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6490 | 6489 |
6491 | 6490 |
6492 uint32_t Name::Hash() { | 6491 uint32_t Name::Hash() { |
6493 // Fast case: has hash code already been computed? | 6492 // Fast case: has hash code already been computed? |
6494 uint32_t field = hash_field(); | 6493 uint32_t field = hash_field(); |
6495 if (IsHashFieldComputed(field)) return field >> kHashShift; | 6494 if (IsHashFieldComputed(field)) return field >> kHashShift; |
6496 // Slow case: compute hash code and set it. Has to be a string. | 6495 // Slow case: compute hash code and set it. Has to be a string. |
6497 return String::cast(this)->ComputeAndSetHash(); | 6496 return String::cast(this)->ComputeAndSetHash(); |
6498 } | 6497 } |
6499 | 6498 |
6500 bool Name::IsOwn() { | |
6501 return this->IsSymbol() && Symbol::cast(this)->is_own(); | |
6502 } | |
6503 | |
6504 | 6499 |
6505 StringHasher::StringHasher(int length, uint32_t seed) | 6500 StringHasher::StringHasher(int length, uint32_t seed) |
6506 : length_(length), | 6501 : length_(length), |
6507 raw_running_hash_(seed), | 6502 raw_running_hash_(seed), |
6508 array_index_(0), | 6503 array_index_(0), |
6509 is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize), | 6504 is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize), |
6510 is_first_char_(true) { | 6505 is_first_char_(true) { |
6511 DCHECK(FLAG_randomize_hashes || raw_running_hash_ == 0); | 6506 DCHECK(FLAG_randomize_hashes || raw_running_hash_ == 0); |
6512 } | 6507 } |
6513 | 6508 |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7283 #undef READ_SHORT_FIELD | 7278 #undef READ_SHORT_FIELD |
7284 #undef WRITE_SHORT_FIELD | 7279 #undef WRITE_SHORT_FIELD |
7285 #undef READ_BYTE_FIELD | 7280 #undef READ_BYTE_FIELD |
7286 #undef WRITE_BYTE_FIELD | 7281 #undef WRITE_BYTE_FIELD |
7287 #undef NOBARRIER_READ_BYTE_FIELD | 7282 #undef NOBARRIER_READ_BYTE_FIELD |
7288 #undef NOBARRIER_WRITE_BYTE_FIELD | 7283 #undef NOBARRIER_WRITE_BYTE_FIELD |
7289 | 7284 |
7290 } } // namespace v8::internal | 7285 } } // namespace v8::internal |
7291 | 7286 |
7292 #endif // V8_OBJECTS_INL_H_ | 7287 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |