OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 } | 653 } |
654 | 654 |
655 | 655 |
656 bool Object::IsDictionary() { | 656 bool Object::IsDictionary() { |
657 return IsHashTable() && | 657 return IsHashTable() && |
658 this != HeapObject::cast(this)->GetHeap()->symbol_table(); | 658 this != HeapObject::cast(this)->GetHeap()->symbol_table(); |
659 } | 659 } |
660 | 660 |
661 | 661 |
662 bool Object::IsSymbolTable() { | 662 bool Object::IsSymbolTable() { |
663 return IsHashTable() && this == | 663 return IsHashTable() && |
664 HeapObject::cast(this)->GetHeap()->raw_unchecked_symbol_table(); | 664 this == HeapObject::cast(this)->GetHeap()->raw_unchecked_symbol_table(); |
665 } | 665 } |
666 | 666 |
667 | 667 |
668 bool Object::IsJSFunctionResultCache() { | 668 bool Object::IsJSFunctionResultCache() { |
669 if (!IsFixedArray()) return false; | 669 if (!IsFixedArray()) return false; |
670 FixedArray* self = FixedArray::cast(this); | 670 FixedArray* self = FixedArray::cast(this); |
671 int length = self->length(); | 671 int length = self->length(); |
672 if (length < JSFunctionResultCache::kEntriesIndex) return false; | 672 if (length < JSFunctionResultCache::kEntriesIndex) return false; |
673 if ((length - JSFunctionResultCache::kEntriesIndex) | 673 if ((length - JSFunctionResultCache::kEntriesIndex) |
674 % JSFunctionResultCache::kEntrySize != 0) { | 674 % JSFunctionResultCache::kEntrySize != 0) { |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1843 ASSERT(index >= 0 && index < this->length()); | 1843 ASSERT(index >= 0 && index < this->length()); |
1844 int offset = kHeaderSize + index * kPointerSize; | 1844 int offset = kHeaderSize + index * kPointerSize; |
1845 WRITE_FIELD(this, offset, value); | 1845 WRITE_FIELD(this, offset, value); |
1846 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); | 1846 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); |
1847 } | 1847 } |
1848 | 1848 |
1849 | 1849 |
1850 void FixedArray::NoIncrementalWriteBarrierSet(FixedArray* array, | 1850 void FixedArray::NoIncrementalWriteBarrierSet(FixedArray* array, |
1851 int index, | 1851 int index, |
1852 Object* value) { | 1852 Object* value) { |
1853 ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map()); | 1853 ASSERT(array->map() != HEAP->fixed_cow_array_map()); |
1854 ASSERT(index >= 0 && index < array->length()); | 1854 ASSERT(index >= 0 && index < array->length()); |
1855 int offset = kHeaderSize + index * kPointerSize; | 1855 int offset = kHeaderSize + index * kPointerSize; |
1856 WRITE_FIELD(array, offset, value); | 1856 WRITE_FIELD(array, offset, value); |
1857 Heap* heap = array->GetHeap(); | 1857 Heap* heap = array->GetHeap(); |
1858 if (heap->InNewSpace(value)) { | 1858 if (heap->InNewSpace(value)) { |
1859 heap->RecordWrite(array->address(), offset); | 1859 heap->RecordWrite(array->address(), offset); |
1860 } | 1860 } |
1861 } | 1861 } |
1862 | 1862 |
1863 | 1863 |
1864 void FixedArray::NoWriteBarrierSet(FixedArray* array, | 1864 void FixedArray::NoWriteBarrierSet(FixedArray* array, |
1865 int index, | 1865 int index, |
1866 Object* value) { | 1866 Object* value) { |
1867 ASSERT(array->map() != HEAP->raw_unchecked_fixed_cow_array_map()); | 1867 ASSERT(array->map() != HEAP->fixed_cow_array_map()); |
1868 ASSERT(index >= 0 && index < array->length()); | 1868 ASSERT(index >= 0 && index < array->length()); |
1869 ASSERT(!HEAP->InNewSpace(value)); | 1869 ASSERT(!HEAP->InNewSpace(value)); |
1870 WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value); | 1870 WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value); |
1871 } | 1871 } |
1872 | 1872 |
1873 | 1873 |
1874 void FixedArray::set_undefined(int index) { | 1874 void FixedArray::set_undefined(int index) { |
1875 ASSERT(map() != HEAP->fixed_cow_array_map()); | 1875 ASSERT(map() != HEAP->fixed_cow_array_map()); |
1876 set_undefined(GetHeap(), index); | 1876 set_undefined(GetHeap(), index); |
1877 } | 1877 } |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2284 // Find entry for key otherwise return kNotFound. | 2284 // Find entry for key otherwise return kNotFound. |
2285 template<typename Shape, typename Key> | 2285 template<typename Shape, typename Key> |
2286 int HashTable<Shape, Key>::FindEntry(Isolate* isolate, Key key) { | 2286 int HashTable<Shape, Key>::FindEntry(Isolate* isolate, Key key) { |
2287 uint32_t capacity = Capacity(); | 2287 uint32_t capacity = Capacity(); |
2288 uint32_t entry = FirstProbe(HashTable<Shape, Key>::Hash(key), capacity); | 2288 uint32_t entry = FirstProbe(HashTable<Shape, Key>::Hash(key), capacity); |
2289 uint32_t count = 1; | 2289 uint32_t count = 1; |
2290 // EnsureCapacity will guarantee the hash table is never full. | 2290 // EnsureCapacity will guarantee the hash table is never full. |
2291 while (true) { | 2291 while (true) { |
2292 Object* element = KeyAt(entry); | 2292 Object* element = KeyAt(entry); |
2293 // Empty entry. | 2293 // Empty entry. |
2294 if (element == isolate->heap()->raw_unchecked_undefined_value()) break; | 2294 if (element == isolate->heap()->undefined_value()) break; |
2295 if (element != isolate->heap()->raw_unchecked_the_hole_value() && | 2295 if (element != isolate->heap()->the_hole_value() && |
2296 Shape::IsMatch(key, element)) return entry; | 2296 Shape::IsMatch(key, element)) return entry; |
2297 entry = NextProbe(entry, count++, capacity); | 2297 entry = NextProbe(entry, count++, capacity); |
2298 } | 2298 } |
2299 return kNotFound; | 2299 return kNotFound; |
2300 } | 2300 } |
2301 | 2301 |
2302 | 2302 |
2303 bool SeededNumberDictionary::requires_slow_elements() { | 2303 bool SeededNumberDictionary::requires_slow_elements() { |
2304 Object* max_index_object = get(kMaxNumberKeyIndex); | 2304 Object* max_index_object = get(kMaxNumberKeyIndex); |
2305 if (!max_index_object->IsSmi()) return false; | 2305 if (!max_index_object->IsSmi()) return false; |
(...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5245 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Object* key) { | 5245 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Object* key) { |
5246 return key; | 5246 return key; |
5247 } | 5247 } |
5248 | 5248 |
5249 | 5249 |
5250 void Map::ClearCodeCache(Heap* heap) { | 5250 void Map::ClearCodeCache(Heap* heap) { |
5251 // No write barrier is needed since empty_fixed_array is not in new space. | 5251 // No write barrier is needed since empty_fixed_array is not in new space. |
5252 // Please note this function is used during marking: | 5252 // Please note this function is used during marking: |
5253 // - MarkCompactCollector::MarkUnmarkedObject | 5253 // - MarkCompactCollector::MarkUnmarkedObject |
5254 // - IncrementalMarking::Step | 5254 // - IncrementalMarking::Step |
5255 ASSERT(!heap->InNewSpace(heap->raw_unchecked_empty_fixed_array())); | 5255 ASSERT(!heap->InNewSpace(heap->empty_fixed_array())); |
5256 WRITE_FIELD(this, kCodeCacheOffset, heap->raw_unchecked_empty_fixed_array()); | 5256 WRITE_FIELD(this, kCodeCacheOffset, heap->empty_fixed_array()); |
5257 } | 5257 } |
5258 | 5258 |
5259 | 5259 |
5260 void JSArray::EnsureSize(int required_size) { | 5260 void JSArray::EnsureSize(int required_size) { |
5261 ASSERT(HasFastSmiOrObjectElements()); | 5261 ASSERT(HasFastSmiOrObjectElements()); |
5262 FixedArray* elts = FixedArray::cast(elements()); | 5262 FixedArray* elts = FixedArray::cast(elements()); |
5263 const int kArraySizeThatFitsComfortablyInNewSpace = 128; | 5263 const int kArraySizeThatFitsComfortablyInNewSpace = 128; |
5264 if (elts->length() < required_size) { | 5264 if (elts->length() < required_size) { |
5265 // Doubling in size would be overkill, but leave some slack to avoid | 5265 // Doubling in size would be overkill, but leave some slack to avoid |
5266 // constantly growing. | 5266 // constantly growing. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5340 return isolate->factory()->the_hole_value(); | 5340 return isolate->factory()->the_hole_value(); |
5341 } | 5341 } |
5342 | 5342 |
5343 | 5343 |
5344 Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) { | 5344 Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) { |
5345 return isolate->factory()->undefined_value(); | 5345 return isolate->factory()->undefined_value(); |
5346 } | 5346 } |
5347 | 5347 |
5348 | 5348 |
5349 Object* TypeFeedbackCells::RawUninitializedSentinel(Heap* heap) { | 5349 Object* TypeFeedbackCells::RawUninitializedSentinel(Heap* heap) { |
5350 return heap->raw_unchecked_the_hole_value(); | 5350 return heap->the_hole_value(); |
5351 } | 5351 } |
5352 | 5352 |
5353 | 5353 |
5354 int TypeFeedbackInfo::ic_total_count() { | 5354 int TypeFeedbackInfo::ic_total_count() { |
5355 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); | 5355 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); |
5356 return ICTotalCountField::decode(current); | 5356 return ICTotalCountField::decode(current); |
5357 } | 5357 } |
5358 | 5358 |
5359 | 5359 |
5360 void TypeFeedbackInfo::set_ic_total_count(int count) { | 5360 void TypeFeedbackInfo::set_ic_total_count(int count) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5540 #undef WRITE_UINT32_FIELD | 5540 #undef WRITE_UINT32_FIELD |
5541 #undef READ_SHORT_FIELD | 5541 #undef READ_SHORT_FIELD |
5542 #undef WRITE_SHORT_FIELD | 5542 #undef WRITE_SHORT_FIELD |
5543 #undef READ_BYTE_FIELD | 5543 #undef READ_BYTE_FIELD |
5544 #undef WRITE_BYTE_FIELD | 5544 #undef WRITE_BYTE_FIELD |
5545 | 5545 |
5546 | 5546 |
5547 } } // namespace v8::internal | 5547 } } // namespace v8::internal |
5548 | 5548 |
5549 #endif // V8_OBJECTS_INL_H_ | 5549 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |