OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 bool Object::IsDictionary() { | 562 bool Object::IsDictionary() { |
563 return IsHashTable() && this != Heap::symbol_table(); | 563 return IsHashTable() && this != Heap::symbol_table(); |
564 } | 564 } |
565 | 565 |
566 | 566 |
567 bool Object::IsSymbolTable() { | 567 bool Object::IsSymbolTable() { |
568 return IsHashTable() && this == Heap::raw_unchecked_symbol_table(); | 568 return IsHashTable() && this == Heap::raw_unchecked_symbol_table(); |
569 } | 569 } |
570 | 570 |
571 | 571 |
| 572 bool Object::IsJSFunctionResultCache() { |
| 573 if (!IsFixedArray()) return false; |
| 574 FixedArray* self = FixedArray::cast(this); |
| 575 int length = self->length(); |
| 576 if (length < JSFunctionResultCache::kEntriesIndex) return false; |
| 577 if ((length - JSFunctionResultCache::kEntriesIndex) |
| 578 % JSFunctionResultCache::kEntrySize != 0) { |
| 579 return false; |
| 580 } |
| 581 #ifdef DEBUG |
| 582 reinterpret_cast<JSFunctionResultCache*>(this)->JSFunctionResultCacheVerify(); |
| 583 #endif |
| 584 return true; |
| 585 } |
| 586 |
| 587 |
572 bool Object::IsCompilationCacheTable() { | 588 bool Object::IsCompilationCacheTable() { |
573 return IsHashTable(); | 589 return IsHashTable(); |
574 } | 590 } |
575 | 591 |
576 | 592 |
577 bool Object::IsCodeCacheHashTable() { | 593 bool Object::IsCodeCacheHashTable() { |
578 return IsHashTable(); | 594 return IsHashTable(); |
579 } | 595 } |
580 | 596 |
581 | 597 |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1587 } | 1603 } |
1588 | 1604 |
1589 | 1605 |
1590 // ------------------------------------ | 1606 // ------------------------------------ |
1591 // Cast operations | 1607 // Cast operations |
1592 | 1608 |
1593 | 1609 |
1594 CAST_ACCESSOR(FixedArray) | 1610 CAST_ACCESSOR(FixedArray) |
1595 CAST_ACCESSOR(DescriptorArray) | 1611 CAST_ACCESSOR(DescriptorArray) |
1596 CAST_ACCESSOR(SymbolTable) | 1612 CAST_ACCESSOR(SymbolTable) |
| 1613 CAST_ACCESSOR(JSFunctionResultCache) |
1597 CAST_ACCESSOR(CompilationCacheTable) | 1614 CAST_ACCESSOR(CompilationCacheTable) |
1598 CAST_ACCESSOR(CodeCacheHashTable) | 1615 CAST_ACCESSOR(CodeCacheHashTable) |
1599 CAST_ACCESSOR(MapCache) | 1616 CAST_ACCESSOR(MapCache) |
1600 CAST_ACCESSOR(String) | 1617 CAST_ACCESSOR(String) |
1601 CAST_ACCESSOR(SeqString) | 1618 CAST_ACCESSOR(SeqString) |
1602 CAST_ACCESSOR(SeqAsciiString) | 1619 CAST_ACCESSOR(SeqAsciiString) |
1603 CAST_ACCESSOR(SeqTwoByteString) | 1620 CAST_ACCESSOR(SeqTwoByteString) |
1604 CAST_ACCESSOR(ConsString) | 1621 CAST_ACCESSOR(ConsString) |
1605 CAST_ACCESSOR(ExternalString) | 1622 CAST_ACCESSOR(ExternalString) |
1606 CAST_ACCESSOR(ExternalAsciiString) | 1623 CAST_ACCESSOR(ExternalAsciiString) |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1831 return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)); | 1848 return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)); |
1832 } | 1849 } |
1833 | 1850 |
1834 | 1851 |
1835 void ExternalTwoByteString::set_resource( | 1852 void ExternalTwoByteString::set_resource( |
1836 ExternalTwoByteString::Resource* resource) { | 1853 ExternalTwoByteString::Resource* resource) { |
1837 *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)) = resource; | 1854 *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)) = resource; |
1838 } | 1855 } |
1839 | 1856 |
1840 | 1857 |
| 1858 void JSFunctionResultCache::MakeZeroSize() { |
| 1859 set(kFingerIndex, Smi::FromInt(kEntriesIndex)); |
| 1860 set(kCacheSizeIndex, Smi::FromInt(kEntriesIndex)); |
| 1861 } |
| 1862 |
| 1863 |
| 1864 void JSFunctionResultCache::Clear() { |
| 1865 int cache_size = Smi::cast(get(kCacheSizeIndex))->value(); |
| 1866 Object** entries_start = RawField(this, OffsetOfElementAt(kEntriesIndex)); |
| 1867 MemsetPointer(entries_start, Heap::the_hole_value(), cache_size); |
| 1868 MakeZeroSize(); |
| 1869 } |
| 1870 |
| 1871 |
1841 byte ByteArray::get(int index) { | 1872 byte ByteArray::get(int index) { |
1842 ASSERT(index >= 0 && index < this->length()); | 1873 ASSERT(index >= 0 && index < this->length()); |
1843 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); | 1874 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); |
1844 } | 1875 } |
1845 | 1876 |
1846 | 1877 |
1847 void ByteArray::set(int index, byte value) { | 1878 void ByteArray::set(int index, byte value) { |
1848 ASSERT(index >= 0 && index < this->length()); | 1879 ASSERT(index >= 0 && index < this->length()); |
1849 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value); | 1880 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value); |
1850 } | 1881 } |
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3122 #undef WRITE_INT_FIELD | 3153 #undef WRITE_INT_FIELD |
3123 #undef READ_SHORT_FIELD | 3154 #undef READ_SHORT_FIELD |
3124 #undef WRITE_SHORT_FIELD | 3155 #undef WRITE_SHORT_FIELD |
3125 #undef READ_BYTE_FIELD | 3156 #undef READ_BYTE_FIELD |
3126 #undef WRITE_BYTE_FIELD | 3157 #undef WRITE_BYTE_FIELD |
3127 | 3158 |
3128 | 3159 |
3129 } } // namespace v8::internal | 3160 } } // namespace v8::internal |
3130 | 3161 |
3131 #endif // V8_OBJECTS_INL_H_ | 3162 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |