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 6562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6573 | 6573 |
6574 bool String::AsArrayIndex(uint32_t* index) { | 6574 bool String::AsArrayIndex(uint32_t* index) { |
6575 uint32_t field = hash_field(); | 6575 uint32_t field = hash_field(); |
6576 if (IsHashFieldComputed(field) && (field & kIsNotArrayIndexMask)) { | 6576 if (IsHashFieldComputed(field) && (field & kIsNotArrayIndexMask)) { |
6577 return false; | 6577 return false; |
6578 } | 6578 } |
6579 return SlowAsArrayIndex(index); | 6579 return SlowAsArrayIndex(index); |
6580 } | 6580 } |
6581 | 6581 |
6582 | 6582 |
6583 void String::SetForwardedInternalizedString(String* canonical) { | |
6584 ASSERT(IsInternalizedString()); | |
6585 ASSERT(HasHashCode()); | |
6586 if (canonical == this) return; // No need to forward. | |
6587 ASSERT(SlowEquals(canonical)); | |
6588 ASSERT(canonical->IsInternalizedString()); | |
6589 ASSERT(canonical->HasHashCode()); | |
6590 WRITE_FIELD(this, kHashFieldOffset, canonical); | |
6591 // With canonical being a string, the LSB is set. Interpreted as hash code, | |
6592 // this means that the hash code uninitialized. We use this for distinction. | |
6593 ASSERT(!HasHashCode()); | |
mvstanton
2014/07/22 13:31:31
How about words along this line?
"Setting a tagge
Yang
2014/07/23 06:55:58
Done.
| |
6594 } | |
6595 | |
6596 | |
6597 String* String::GetForwardedInternalizedString() { | |
6598 ASSERT(IsInternalizedString()); | |
6599 if (HasHashCode()) return this; | |
6600 String* canonical = String::cast(READ_FIELD(this, kHashFieldOffset)); | |
6601 ASSERT(canonical->IsInternalizedString()); | |
6602 ASSERT(SlowEquals(canonical)); | |
6603 ASSERT(canonical->HasHashCode()); | |
6604 return canonical; | |
6605 } | |
6606 | |
6607 | |
6583 Object* JSReceiver::GetConstructor() { | 6608 Object* JSReceiver::GetConstructor() { |
6584 return map()->constructor(); | 6609 return map()->constructor(); |
6585 } | 6610 } |
6586 | 6611 |
6587 | 6612 |
6588 bool JSReceiver::HasProperty(Handle<JSReceiver> object, | 6613 bool JSReceiver::HasProperty(Handle<JSReceiver> object, |
6589 Handle<Name> name) { | 6614 Handle<Name> name) { |
6590 if (object->IsJSProxy()) { | 6615 if (object->IsJSProxy()) { |
6591 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6616 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
6592 return JSProxy::HasPropertyWithHandler(proxy, name); | 6617 return JSProxy::HasPropertyWithHandler(proxy, name); |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7170 #undef READ_SHORT_FIELD | 7195 #undef READ_SHORT_FIELD |
7171 #undef WRITE_SHORT_FIELD | 7196 #undef WRITE_SHORT_FIELD |
7172 #undef READ_BYTE_FIELD | 7197 #undef READ_BYTE_FIELD |
7173 #undef WRITE_BYTE_FIELD | 7198 #undef WRITE_BYTE_FIELD |
7174 #undef NOBARRIER_READ_BYTE_FIELD | 7199 #undef NOBARRIER_READ_BYTE_FIELD |
7175 #undef NOBARRIER_WRITE_BYTE_FIELD | 7200 #undef NOBARRIER_WRITE_BYTE_FIELD |
7176 | 7201 |
7177 } } // namespace v8::internal | 7202 } } // namespace v8::internal |
7178 | 7203 |
7179 #endif // V8_OBJECTS_INL_H_ | 7204 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |