Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: src/objects-inl.h

Issue 411483002: Correctly hook up back references to internalized strings in code deserializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: edited comment Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/serialize.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Setting the hash field to a tagged value sets the LSB, causing the hash
6592 // code to be interpreted as uninitialized. We use this fact to recognize
6593 // that we have a forwarded string.
6594 ASSERT(!HasHashCode());
6595 }
6596
6597
6598 String* String::GetForwardedInternalizedString() {
6599 ASSERT(IsInternalizedString());
6600 if (HasHashCode()) return this;
6601 String* canonical = String::cast(READ_FIELD(this, kHashFieldOffset));
6602 ASSERT(canonical->IsInternalizedString());
6603 ASSERT(SlowEquals(canonical));
6604 ASSERT(canonical->HasHashCode());
6605 return canonical;
6606 }
6607
6608
6583 Object* JSReceiver::GetConstructor() { 6609 Object* JSReceiver::GetConstructor() {
6584 return map()->constructor(); 6610 return map()->constructor();
6585 } 6611 }
6586 6612
6587 6613
6588 bool JSReceiver::HasProperty(Handle<JSReceiver> object, 6614 bool JSReceiver::HasProperty(Handle<JSReceiver> object,
6589 Handle<Name> name) { 6615 Handle<Name> name) {
6590 if (object->IsJSProxy()) { 6616 if (object->IsJSProxy()) {
6591 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); 6617 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
6592 return JSProxy::HasPropertyWithHandler(proxy, name); 6618 return JSProxy::HasPropertyWithHandler(proxy, name);
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
7170 #undef READ_SHORT_FIELD 7196 #undef READ_SHORT_FIELD
7171 #undef WRITE_SHORT_FIELD 7197 #undef WRITE_SHORT_FIELD
7172 #undef READ_BYTE_FIELD 7198 #undef READ_BYTE_FIELD
7173 #undef WRITE_BYTE_FIELD 7199 #undef WRITE_BYTE_FIELD
7174 #undef NOBARRIER_READ_BYTE_FIELD 7200 #undef NOBARRIER_READ_BYTE_FIELD
7175 #undef NOBARRIER_WRITE_BYTE_FIELD 7201 #undef NOBARRIER_WRITE_BYTE_FIELD
7176 7202
7177 } } // namespace v8::internal 7203 } } // namespace v8::internal
7178 7204
7179 #endif // V8_OBJECTS_INL_H_ 7205 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698