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

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: 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
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() { WRITE_FIELD(this, kValueOffset, Smi::FromInt(0)); }
Erik Corry Chromium.org 2014/10/20 08:00:18 If this should only be called by the GC, can we as
ulan 2014/10/20 12:30:19 Done.
1939 WRITE_FIELD(this, kValueOffset, undefined);
1940 }
1941 1939
1942 1940
1943 void WeakCell::initialize(HeapObject* val) { 1941 void WeakCell::initialize(HeapObject* val) {
1944 WRITE_FIELD(this, kValueOffset, val); 1942 WRITE_FIELD(this, kValueOffset, val);
1945 WRITE_BARRIER(GetHeap(), this, kValueOffset, val); 1943 WRITE_BARRIER(GetHeap(), this, kValueOffset, val);
1946 } 1944 }
1947 1945
1948 1946
1947 bool WeakCell::cleared() const { return value() == Smi::FromInt(0); }
1948
1949
1949 Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); } 1950 Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); }
1950 1951
1951 1952
1952 void WeakCell::set_next(Object* val, WriteBarrierMode mode) { 1953 void WeakCell::set_next(Object* val, WriteBarrierMode mode) {
1953 WRITE_FIELD(this, kNextOffset, val); 1954 WRITE_FIELD(this, kNextOffset, val);
1954 if (mode == UPDATE_WRITE_BARRIER) { 1955 if (mode == UPDATE_WRITE_BARRIER) {
1955 WRITE_BARRIER(GetHeap(), this, kNextOffset, val); 1956 WRITE_BARRIER(GetHeap(), this, kNextOffset, val);
1956 } 1957 }
1957 } 1958 }
1958 1959
(...skipping 5328 matching lines...) Expand 10 before | Expand all | Expand 10 after
7287 #undef READ_SHORT_FIELD 7288 #undef READ_SHORT_FIELD
7288 #undef WRITE_SHORT_FIELD 7289 #undef WRITE_SHORT_FIELD
7289 #undef READ_BYTE_FIELD 7290 #undef READ_BYTE_FIELD
7290 #undef WRITE_BYTE_FIELD 7291 #undef WRITE_BYTE_FIELD
7291 #undef NOBARRIER_READ_BYTE_FIELD 7292 #undef NOBARRIER_READ_BYTE_FIELD
7292 #undef NOBARRIER_WRITE_BYTE_FIELD 7293 #undef NOBARRIER_WRITE_BYTE_FIELD
7293 7294
7294 } } // namespace v8::internal 7295 } } // namespace v8::internal
7295 7296
7296 #endif // V8_OBJECTS_INL_H_ 7297 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/heap/objects-visiting-inl.h ('K') | « src/objects.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698