OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1971 } | 1971 } |
1972 | 1972 |
1973 | 1973 |
1974 void ExternalTwoByteString::set_resource( | 1974 void ExternalTwoByteString::set_resource( |
1975 ExternalTwoByteString::Resource* resource) { | 1975 ExternalTwoByteString::Resource* resource) { |
1976 *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)) = resource; | 1976 *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)) = resource; |
1977 } | 1977 } |
1978 | 1978 |
1979 | 1979 |
1980 void JSFunctionResultCache::MakeZeroSize() { | 1980 void JSFunctionResultCache::MakeZeroSize() { |
1981 set(kFingerIndex, Smi::FromInt(kEntriesIndex)); | 1981 set_finger_index(kEntriesIndex); |
1982 set(kCacheSizeIndex, Smi::FromInt(kEntriesIndex)); | 1982 set_size(kEntriesIndex); |
1983 } | 1983 } |
1984 | 1984 |
1985 | 1985 |
1986 void JSFunctionResultCache::Clear() { | 1986 void JSFunctionResultCache::Clear() { |
1987 int cache_size = Smi::cast(get(kCacheSizeIndex))->value(); | 1987 int cache_size = size(); |
1988 Object** entries_start = RawField(this, OffsetOfElementAt(kEntriesIndex)); | 1988 Object** entries_start = RawField(this, OffsetOfElementAt(kEntriesIndex)); |
1989 MemsetPointer(entries_start, | 1989 MemsetPointer(entries_start, |
1990 Heap::the_hole_value(), | 1990 Heap::the_hole_value(), |
1991 cache_size - kEntriesIndex); | 1991 cache_size - kEntriesIndex); |
1992 MakeZeroSize(); | 1992 MakeZeroSize(); |
1993 } | 1993 } |
1994 | 1994 |
1995 | 1995 |
| 1996 int JSFunctionResultCache::size() { |
| 1997 return Smi::cast(get(kCacheSizeIndex))->value(); |
| 1998 } |
| 1999 |
| 2000 |
| 2001 void JSFunctionResultCache::set_size(int size) { |
| 2002 set(kCacheSizeIndex, Smi::FromInt(size)); |
| 2003 } |
| 2004 |
| 2005 |
| 2006 int JSFunctionResultCache::finger_index() { |
| 2007 return Smi::cast(get(kFingerIndex))->value(); |
| 2008 } |
| 2009 |
| 2010 |
| 2011 void JSFunctionResultCache::set_finger_index(int finger_index) { |
| 2012 set(kFingerIndex, Smi::FromInt(finger_index)); |
| 2013 } |
| 2014 |
| 2015 |
1996 byte ByteArray::get(int index) { | 2016 byte ByteArray::get(int index) { |
1997 ASSERT(index >= 0 && index < this->length()); | 2017 ASSERT(index >= 0 && index < this->length()); |
1998 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); | 2018 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); |
1999 } | 2019 } |
2000 | 2020 |
2001 | 2021 |
2002 void ByteArray::set(int index, byte value) { | 2022 void ByteArray::set(int index, byte value) { |
2003 ASSERT(index >= 0 && index < this->length()); | 2023 ASSERT(index >= 0 && index < this->length()); |
2004 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value); | 2024 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value); |
2005 } | 2025 } |
(...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3842 #undef WRITE_INT_FIELD | 3862 #undef WRITE_INT_FIELD |
3843 #undef READ_SHORT_FIELD | 3863 #undef READ_SHORT_FIELD |
3844 #undef WRITE_SHORT_FIELD | 3864 #undef WRITE_SHORT_FIELD |
3845 #undef READ_BYTE_FIELD | 3865 #undef READ_BYTE_FIELD |
3846 #undef WRITE_BYTE_FIELD | 3866 #undef WRITE_BYTE_FIELD |
3847 | 3867 |
3848 | 3868 |
3849 } } // namespace v8::internal | 3869 } } // namespace v8::internal |
3850 | 3870 |
3851 #endif // V8_OBJECTS_INL_H_ | 3871 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |