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