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 6509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6520 void Map::ClearCodeCache(Heap* heap) { | 6520 void Map::ClearCodeCache(Heap* heap) { |
6521 // No write barrier is needed since empty_fixed_array is not in new space. | 6521 // No write barrier is needed since empty_fixed_array is not in new space. |
6522 // Please note this function is used during marking: | 6522 // Please note this function is used during marking: |
6523 // - MarkCompactCollector::MarkUnmarkedObject | 6523 // - MarkCompactCollector::MarkUnmarkedObject |
6524 // - IncrementalMarking::Step | 6524 // - IncrementalMarking::Step |
6525 ASSERT(!heap->InNewSpace(heap->empty_fixed_array())); | 6525 ASSERT(!heap->InNewSpace(heap->empty_fixed_array())); |
6526 WRITE_FIELD(this, kCodeCacheOffset, heap->empty_fixed_array()); | 6526 WRITE_FIELD(this, kCodeCacheOffset, heap->empty_fixed_array()); |
6527 } | 6527 } |
6528 | 6528 |
6529 | 6529 |
6530 void JSArray::EnsureSize(int required_size) { | 6530 void JSArray::EnsureSize(Handle<JSArray> array, int required_size) { |
6531 ASSERT(HasFastSmiOrObjectElements()); | 6531 ASSERT(array->HasFastSmiOrObjectElements()); |
6532 FixedArray* elts = FixedArray::cast(elements()); | 6532 Handle<FixedArray> elts = handle(FixedArray::cast(array->elements())); |
6533 const int kArraySizeThatFitsComfortablyInNewSpace = 128; | 6533 const int kArraySizeThatFitsComfortablyInNewSpace = 128; |
6534 if (elts->length() < required_size) { | 6534 if (elts->length() < required_size) { |
6535 // Doubling in size would be overkill, but leave some slack to avoid | 6535 // Doubling in size would be overkill, but leave some slack to avoid |
6536 // constantly growing. | 6536 // constantly growing. |
6537 Expand(required_size + (required_size >> 3)); | 6537 Expand(array, required_size + (required_size >> 3)); |
6538 // It's a performance benefit to keep a frequently used array in new-space. | 6538 // It's a performance benefit to keep a frequently used array in new-space. |
6539 } else if (!GetHeap()->new_space()->Contains(elts) && | 6539 } else if (!array->GetHeap()->new_space()->Contains(*elts) && |
6540 required_size < kArraySizeThatFitsComfortablyInNewSpace) { | 6540 required_size < kArraySizeThatFitsComfortablyInNewSpace) { |
6541 // Expand will allocate a new backing store in new space even if the size | 6541 // Expand will allocate a new backing store in new space even if the size |
6542 // we asked for isn't larger than what we had before. | 6542 // we asked for isn't larger than what we had before. |
6543 Expand(required_size); | 6543 Expand(array, required_size); |
6544 } | 6544 } |
6545 } | 6545 } |
6546 | 6546 |
6547 | 6547 |
6548 void JSArray::set_length(Smi* length) { | 6548 void JSArray::set_length(Smi* length) { |
6549 // Don't need a write barrier for a Smi. | 6549 // Don't need a write barrier for a Smi. |
6550 set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER); | 6550 set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER); |
6551 } | 6551 } |
6552 | 6552 |
6553 | 6553 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6799 #undef READ_UINT32_FIELD | 6799 #undef READ_UINT32_FIELD |
6800 #undef WRITE_UINT32_FIELD | 6800 #undef WRITE_UINT32_FIELD |
6801 #undef READ_SHORT_FIELD | 6801 #undef READ_SHORT_FIELD |
6802 #undef WRITE_SHORT_FIELD | 6802 #undef WRITE_SHORT_FIELD |
6803 #undef READ_BYTE_FIELD | 6803 #undef READ_BYTE_FIELD |
6804 #undef WRITE_BYTE_FIELD | 6804 #undef WRITE_BYTE_FIELD |
6805 | 6805 |
6806 } } // namespace v8::internal | 6806 } } // namespace v8::internal |
6807 | 6807 |
6808 #endif // V8_OBJECTS_INL_H_ | 6808 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |