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

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

Issue 637253004: Use smi zero instead of undefine_value to zap dead weak cells. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 6 years, 2 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.cc ('k') | test/cctest/test-heap.cc » ('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 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 Object* PropertyCell::type_raw() const { 1923 Object* PropertyCell::type_raw() const {
1924 return READ_FIELD(this, kTypeOffset); 1924 return READ_FIELD(this, kTypeOffset);
1925 } 1925 }
1926 1926
1927 1927
1928 void PropertyCell::set_type_raw(Object* val, WriteBarrierMode ignored) { 1928 void PropertyCell::set_type_raw(Object* val, WriteBarrierMode ignored) {
1929 WRITE_FIELD(this, kTypeOffset, val); 1929 WRITE_FIELD(this, kTypeOffset, val);
1930 } 1930 }
1931 1931
1932 1932
1933 HeapObject* WeakCell::value() const { 1933 Object* WeakCell::value() const {
1934 return HeapObject::cast(READ_FIELD(this, kValueOffset)); 1934 return HeapObject::cast(READ_FIELD(this, kValueOffset));
1935 } 1935 }
1936 1936
1937 1937
1938 void WeakCell::clear(HeapObject* undefined) { 1938 void WeakCell::clear() {
1939 WRITE_FIELD(this, kValueOffset, undefined); 1939 DCHECK(GetHeap()->gc_state() == Heap::MARK_COMPACT);
1940 WRITE_FIELD(this, kValueOffset, Smi::FromInt(0));
1940 } 1941 }
1941 1942
1942 1943
1943 void WeakCell::initialize(HeapObject* val) { 1944 void WeakCell::initialize(HeapObject* val) {
1944 WRITE_FIELD(this, kValueOffset, val); 1945 WRITE_FIELD(this, kValueOffset, val);
1945 WRITE_BARRIER(GetHeap(), this, kValueOffset, val); 1946 WRITE_BARRIER(GetHeap(), this, kValueOffset, val);
1946 } 1947 }
1947 1948
1948 1949
1950 bool WeakCell::cleared() const { return value() == Smi::FromInt(0); }
1951
1952
1949 Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); } 1953 Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); }
1950 1954
1951 1955
1952 void WeakCell::set_next(Object* val, WriteBarrierMode mode) { 1956 void WeakCell::set_next(Object* val, WriteBarrierMode mode) {
1953 WRITE_FIELD(this, kNextOffset, val); 1957 WRITE_FIELD(this, kNextOffset, val);
1954 if (mode == UPDATE_WRITE_BARRIER) { 1958 if (mode == UPDATE_WRITE_BARRIER) {
1955 WRITE_BARRIER(GetHeap(), this, kNextOffset, val); 1959 WRITE_BARRIER(GetHeap(), this, kNextOffset, val);
1956 } 1960 }
1957 } 1961 }
1958 1962
(...skipping 5326 matching lines...) Expand 10 before | Expand all | Expand 10 after
7285 #undef READ_SHORT_FIELD 7289 #undef READ_SHORT_FIELD
7286 #undef WRITE_SHORT_FIELD 7290 #undef WRITE_SHORT_FIELD
7287 #undef READ_BYTE_FIELD 7291 #undef READ_BYTE_FIELD
7288 #undef WRITE_BYTE_FIELD 7292 #undef WRITE_BYTE_FIELD
7289 #undef NOBARRIER_READ_BYTE_FIELD 7293 #undef NOBARRIER_READ_BYTE_FIELD
7290 #undef NOBARRIER_WRITE_BYTE_FIELD 7294 #undef NOBARRIER_WRITE_BYTE_FIELD
7291 7295
7292 } } // namespace v8::internal 7296 } } // namespace v8::internal
7293 7297
7294 #endif // V8_OBJECTS_INL_H_ 7298 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698