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

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

Issue 8111006: Allow new-space JSFunction objects as constant-function properties. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: rebased Created 9 years 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 Object* value, 1696 Object* value,
1697 WriteBarrierMode mode) { 1697 WriteBarrierMode mode) {
1698 ASSERT(map() != HEAP->fixed_cow_array_map()); 1698 ASSERT(map() != HEAP->fixed_cow_array_map());
1699 ASSERT(index >= 0 && index < this->length()); 1699 ASSERT(index >= 0 && index < this->length());
1700 int offset = kHeaderSize + index * kPointerSize; 1700 int offset = kHeaderSize + index * kPointerSize;
1701 WRITE_FIELD(this, offset, value); 1701 WRITE_FIELD(this, offset, value);
1702 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); 1702 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode);
1703 } 1703 }
1704 1704
1705 1705
1706 void FixedArray::NoIncrementalWriteBarrierSet(FixedArray* array,
1707 int index,
1708 Object* value) {
1709 ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map());
1710 ASSERT(index >= 0 && index < array->length());
1711 int offset = kHeaderSize + index * kPointerSize;
1712 WRITE_FIELD(array, offset, value);
1713 if (array->GetHeap()->InNewSpace(value)) {
Vyacheslav Egorov (Chromium) 2011/12/02 12:44:42 Get heap once and cache it locally.
fschneider 2011/12/02 13:51:19 Done.
1714 array->GetHeap()->RecordWrite(array->address(), offset);
1715 }
1716 }
1717
1718
1706 void FixedArray::NoWriteBarrierSet(FixedArray* array, 1719 void FixedArray::NoWriteBarrierSet(FixedArray* array,
1707 int index, 1720 int index,
1708 Object* value) { 1721 Object* value) {
1709 ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map()); 1722 ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map());
1710 ASSERT(index >= 0 && index < array->length()); 1723 ASSERT(index >= 0 && index < array->length());
1711 ASSERT(!HEAP->InNewSpace(value)); 1724 ASSERT(!HEAP->InNewSpace(value));
1712 WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value); 1725 WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value);
1713 } 1726 }
1714 1727
1715 1728
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 Object* storage = READ_FIELD(this, kBitField3StorageOffset); 1803 Object* storage = READ_FIELD(this, kBitField3StorageOffset);
1791 return Smi::cast(storage)->value(); 1804 return Smi::cast(storage)->value();
1792 } 1805 }
1793 1806
1794 void DescriptorArray::set_bit_field3_storage(int value) { 1807 void DescriptorArray::set_bit_field3_storage(int value) {
1795 ASSERT(!IsEmpty()); 1808 ASSERT(!IsEmpty());
1796 WRITE_FIELD(this, kBitField3StorageOffset, Smi::FromInt(value)); 1809 WRITE_FIELD(this, kBitField3StorageOffset, Smi::FromInt(value));
1797 } 1810 }
1798 1811
1799 1812
1800 void DescriptorArray::NoWriteBarrierSwap(FixedArray* array, 1813 void DescriptorArray::NoIncrementalWriteBarrierSwap(FixedArray* array,
1801 int first, 1814 int first,
1802 int second) { 1815 int second) {
1803 Object* tmp = array->get(first); 1816 Object* tmp = array->get(first);
1804 NoWriteBarrierSet(array, first, array->get(second)); 1817 NoIncrementalWriteBarrierSet(array, first, array->get(second));
1805 NoWriteBarrierSet(array, second, tmp); 1818 NoIncrementalWriteBarrierSet(array, second, tmp);
1806 } 1819 }
1807 1820
1808 1821
1809 int DescriptorArray::Search(String* name) { 1822 int DescriptorArray::Search(String* name) {
1810 SLOW_ASSERT(IsSortedNoDuplicates()); 1823 SLOW_ASSERT(IsSortedNoDuplicates());
1811 1824
1812 // Check for empty descriptor array. 1825 // Check for empty descriptor array.
1813 int nof = number_of_descriptors(); 1826 int nof = number_of_descriptors();
1814 if (nof == 0) return kNotFound; 1827 if (nof == 0) return kNotFound;
1815 1828
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 PropertyDetails(GetDetails(descriptor_number))); 1920 PropertyDetails(GetDetails(descriptor_number)));
1908 } 1921 }
1909 1922
1910 1923
1911 void DescriptorArray::Set(int descriptor_number, 1924 void DescriptorArray::Set(int descriptor_number,
1912 Descriptor* desc, 1925 Descriptor* desc,
1913 const WhitenessWitness&) { 1926 const WhitenessWitness&) {
1914 // Range check. 1927 // Range check.
1915 ASSERT(descriptor_number < number_of_descriptors()); 1928 ASSERT(descriptor_number < number_of_descriptors());
1916 1929
1917 // Make sure none of the elements in desc are in new space. 1930 NoIncrementalWriteBarrierSet(this,
1918 ASSERT(!HEAP->InNewSpace(desc->GetKey())); 1931 ToKeyIndex(descriptor_number),
1919 ASSERT(!HEAP->InNewSpace(desc->GetValue())); 1932 desc->GetKey());
1920
1921 NoWriteBarrierSet(this,
1922 ToKeyIndex(descriptor_number),
1923 desc->GetKey());
1924 FixedArray* content_array = GetContentArray(); 1933 FixedArray* content_array = GetContentArray();
1925 NoWriteBarrierSet(content_array, 1934 NoIncrementalWriteBarrierSet(content_array,
1926 ToValueIndex(descriptor_number), 1935 ToValueIndex(descriptor_number),
1927 desc->GetValue()); 1936 desc->GetValue());
1928 NoWriteBarrierSet(content_array, 1937 NoIncrementalWriteBarrierSet(content_array,
1929 ToDetailsIndex(descriptor_number), 1938 ToDetailsIndex(descriptor_number),
1930 desc->GetDetails().AsSmi()); 1939 desc->GetDetails().AsSmi());
1931 } 1940 }
1932 1941
1933 1942
1934 void DescriptorArray::CopyFrom(int index, 1943 void DescriptorArray::CopyFrom(int index,
1935 DescriptorArray* src, 1944 DescriptorArray* src,
1936 int src_index, 1945 int src_index,
1937 const WhitenessWitness& witness) { 1946 const WhitenessWitness& witness) {
1938 Descriptor desc; 1947 Descriptor desc;
1939 src->Get(src_index, &desc); 1948 src->Get(src_index, &desc);
1940 Set(index, &desc, witness); 1949 Set(index, &desc, witness);
1941 } 1950 }
1942 1951
1943 1952
1944 void DescriptorArray::NoWriteBarrierSwapDescriptors(int first, int second) { 1953 void DescriptorArray::NoIncrementalWriteBarrierSwapDescriptors(
1945 NoWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second)); 1954 int first, int second) {
1955 NoIncrementalWriteBarrierSwap(this, ToKeyIndex(first), ToKeyIndex(second));
1946 FixedArray* content_array = GetContentArray(); 1956 FixedArray* content_array = GetContentArray();
1947 NoWriteBarrierSwap(content_array, 1957 NoIncrementalWriteBarrierSwap(content_array,
1948 ToValueIndex(first), 1958 ToValueIndex(first),
1949 ToValueIndex(second)); 1959 ToValueIndex(second));
1950 NoWriteBarrierSwap(content_array, 1960 NoIncrementalWriteBarrierSwap(content_array,
1951 ToDetailsIndex(first), 1961 ToDetailsIndex(first),
1952 ToDetailsIndex(second)); 1962 ToDetailsIndex(second));
1953 } 1963 }
1954 1964
1955 1965
1956 DescriptorArray::WhitenessWitness::WhitenessWitness(DescriptorArray* array) 1966 DescriptorArray::WhitenessWitness::WhitenessWitness(DescriptorArray* array)
1957 : marking_(array->GetHeap()->incremental_marking()) { 1967 : marking_(array->GetHeap()->incremental_marking()) {
1958 marking_->EnterNoMarkingScope(); 1968 marking_->EnterNoMarkingScope();
1959 if (array->number_of_descriptors() > 0) { 1969 if (array->number_of_descriptors() > 0) {
1960 ASSERT(Marking::Color(array) == Marking::WHITE_OBJECT); 1970 ASSERT(Marking::Color(array) == Marking::WHITE_OBJECT);
1961 ASSERT(Marking::Color(array->GetContentArray()) == Marking::WHITE_OBJECT); 1971 ASSERT(Marking::Color(array->GetContentArray()) == Marking::WHITE_OBJECT);
1962 } 1972 }
(...skipping 2728 matching lines...) Expand 10 before | Expand all | Expand 10 after
4691 #undef WRITE_INT_FIELD 4701 #undef WRITE_INT_FIELD
4692 #undef READ_SHORT_FIELD 4702 #undef READ_SHORT_FIELD
4693 #undef WRITE_SHORT_FIELD 4703 #undef WRITE_SHORT_FIELD
4694 #undef READ_BYTE_FIELD 4704 #undef READ_BYTE_FIELD
4695 #undef WRITE_BYTE_FIELD 4705 #undef WRITE_BYTE_FIELD
4696 4706
4697 4707
4698 } } // namespace v8::internal 4708 } } // namespace v8::internal
4699 4709
4700 #endif // V8_OBJECTS_INL_H_ 4710 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/stub-cache.h » ('j') | src/x64/lithium-codegen-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698