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

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: '' Created 9 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 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 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 Object* storage = READ_FIELD(this, kBitField3StorageOffset); 1894 Object* storage = READ_FIELD(this, kBitField3StorageOffset);
1895 return Smi::cast(storage)->value(); 1895 return Smi::cast(storage)->value();
1896 } 1896 }
1897 1897
1898 void DescriptorArray::set_bit_field3_storage(int value) { 1898 void DescriptorArray::set_bit_field3_storage(int value) {
1899 ASSERT(!IsEmpty()); 1899 ASSERT(!IsEmpty());
1900 WRITE_FIELD(this, kBitField3StorageOffset, Smi::FromInt(value)); 1900 WRITE_FIELD(this, kBitField3StorageOffset, Smi::FromInt(value));
1901 } 1901 }
1902 1902
1903 1903
1904 void DescriptorArray::fast_swap(FixedArray* array, int first, int second) { 1904 void DescriptorArray::swap_elements(FixedArray* array, int first, int second) {
1905 Object* tmp = array->get(first); 1905 Object* tmp = array->get(first);
1906 fast_set(array, first, array->get(second)); 1906 array->set(first, array->get(second));
1907 fast_set(array, second, tmp); 1907 array->set(second, tmp);
1908 } 1908 }
1909 1909
1910 1910
1911 int DescriptorArray::Search(String* name) { 1911 int DescriptorArray::Search(String* name) {
1912 SLOW_ASSERT(IsSortedNoDuplicates()); 1912 SLOW_ASSERT(IsSortedNoDuplicates());
1913 1913
1914 // Check for empty descriptor array. 1914 // Check for empty descriptor array.
1915 int nof = number_of_descriptors(); 1915 int nof = number_of_descriptors();
1916 if (nof == 0) return kNotFound; 1916 if (nof == 0) return kNotFound;
1917 1917
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 desc->Init(GetKey(descriptor_number), 2009 desc->Init(GetKey(descriptor_number),
2010 GetValue(descriptor_number), 2010 GetValue(descriptor_number),
2011 PropertyDetails(GetDetails(descriptor_number))); 2011 PropertyDetails(GetDetails(descriptor_number)));
2012 } 2012 }
2013 2013
2014 2014
2015 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) { 2015 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) {
2016 // Range check. 2016 // Range check.
2017 ASSERT(descriptor_number < number_of_descriptors()); 2017 ASSERT(descriptor_number < number_of_descriptors());
2018 2018
2019 // Make sure none of the elements in desc are in new space. 2019 set(ToKeyIndex(descriptor_number), desc->GetKey());
2020 ASSERT(!HEAP->InNewSpace(desc->GetKey()));
2021 ASSERT(!HEAP->InNewSpace(desc->GetValue()));
2022
2023 fast_set(this, ToKeyIndex(descriptor_number), desc->GetKey());
2024 FixedArray* content_array = GetContentArray(); 2020 FixedArray* content_array = GetContentArray();
2025 fast_set(content_array, ToValueIndex(descriptor_number), desc->GetValue()); 2021 content_array->set(ToValueIndex(descriptor_number), desc->GetValue());
2026 fast_set(content_array, ToDetailsIndex(descriptor_number), 2022 content_array->set(ToDetailsIndex(descriptor_number),
2027 desc->GetDetails().AsSmi()); 2023 desc->GetDetails().AsSmi());
2028 } 2024 }
2029 2025
2030 2026
2031 void DescriptorArray::CopyFrom(int index, DescriptorArray* src, int src_index) { 2027 void DescriptorArray::CopyFrom(int index, DescriptorArray* src, int src_index) {
2032 Descriptor desc; 2028 Descriptor desc;
2033 src->Get(src_index, &desc); 2029 src->Get(src_index, &desc);
2034 Set(index, &desc); 2030 Set(index, &desc);
2035 } 2031 }
2036 2032
2037 2033
2038 void DescriptorArray::Swap(int first, int second) { 2034 void DescriptorArray::Swap(int first, int second) {
2039 fast_swap(this, ToKeyIndex(first), ToKeyIndex(second)); 2035 swap_elements(this, ToKeyIndex(first), ToKeyIndex(second));
2040 FixedArray* content_array = GetContentArray(); 2036 FixedArray* content_array = GetContentArray();
2041 fast_swap(content_array, ToValueIndex(first), ToValueIndex(second)); 2037 swap_elements(content_array, ToValueIndex(first), ToValueIndex(second));
2042 fast_swap(content_array, ToDetailsIndex(first), ToDetailsIndex(second)); 2038 swap_elements(content_array, ToDetailsIndex(first), ToDetailsIndex(second));
2043 } 2039 }
2044 2040
2045 2041
2046 template<typename Shape, typename Key> 2042 template<typename Shape, typename Key>
2047 int HashTable<Shape, Key>::ComputeCapacity(int at_least_space_for) { 2043 int HashTable<Shape, Key>::ComputeCapacity(int at_least_space_for) {
2048 const int kMinCapacity = 32; 2044 const int kMinCapacity = 32;
2049 int capacity = RoundUpToPowerOf2(at_least_space_for * 2); 2045 int capacity = RoundUpToPowerOf2(at_least_space_for * 2);
2050 if (capacity < kMinCapacity) { 2046 if (capacity < kMinCapacity) {
2051 capacity = kMinCapacity; // Guarantee min capacity. 2047 capacity = kMinCapacity; // Guarantee min capacity.
2052 } 2048 }
(...skipping 2581 matching lines...) Expand 10 before | Expand all | Expand 10 after
4634 #undef WRITE_INT_FIELD 4630 #undef WRITE_INT_FIELD
4635 #undef READ_SHORT_FIELD 4631 #undef READ_SHORT_FIELD
4636 #undef WRITE_SHORT_FIELD 4632 #undef WRITE_SHORT_FIELD
4637 #undef READ_BYTE_FIELD 4633 #undef READ_BYTE_FIELD
4638 #undef WRITE_BYTE_FIELD 4634 #undef WRITE_BYTE_FIELD
4639 4635
4640 4636
4641 } } // namespace v8::internal 4637 } } // namespace v8::internal
4642 4638
4643 #endif // V8_OBJECTS_INL_H_ 4639 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698