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