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

Side by Side Diff: src/heap/mark-compact.cc

Issue 1106983004: Filter out store/slots buffer entries that point into raw data objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/base/atomicops.h" 7 #include "src/base/atomicops.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 3192 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 3203
3204 bool MarkCompactCollector::IsSlotInLiveObject(Address slot) { 3204 bool MarkCompactCollector::IsSlotInLiveObject(Address slot) {
3205 HeapObject* object = NULL; 3205 HeapObject* object = NULL;
3206 // The target object is black but we don't know if the source slot is black. 3206 // The target object is black but we don't know if the source slot is black.
3207 // The source object could have died and the slot could be part of a free 3207 // The source object could have died and the slot could be part of a free
3208 // space. Find out based on mark bits if the slot is part of a live object. 3208 // space. Find out based on mark bits if the slot is part of a live object.
3209 if (!IsSlotInBlackObject(Page::FromAddress(slot), slot, &object)) { 3209 if (!IsSlotInBlackObject(Page::FromAddress(slot), slot, &object)) {
3210 return false; 3210 return false;
3211 } 3211 }
3212 3212
3213 #if V8_DOUBLE_FIELDS_UNBOXING
3214 // |object| is NULL only when the slot belongs to large object space. 3213 // |object| is NULL only when the slot belongs to large object space.
3215 DCHECK(object != NULL || 3214 DCHECK(object != NULL ||
3216 Page::FromAnyPointerAddress(heap_, slot)->owner() == 3215 Page::FromAnyPointerAddress(heap_, slot)->owner() ==
3217 heap_->lo_space()); 3216 heap_->lo_space());
3218 // We don't need to check large objects' layout descriptor since it can't 3217 // We don't need to check large objects' layout descriptor since it can't
3219 // contain in-object fields anyway. 3218 // contain in-object fields anyway.
3220 if (object != NULL) { 3219 if (object != NULL) {
3221 // Filter out slots that happens to point to unboxed double fields. 3220 InstanceType type = object->map()->instance_type();
3222 LayoutDescriptorHelper helper(object->map()); 3221 // Slots in maps and code can't be invalid because they are never shrunk.
3223 bool has_only_tagged_fields = helper.all_fields_tagged(); 3222 if (type == MAP_TYPE || type == CODE_TYPE) return true;
3224 if (!has_only_tagged_fields && 3223 if (type == CONSTANT_POOL_ARRAY_TYPE) {
3225 !helper.IsTagged(static_cast<int>(slot - object->address()))) { 3224 if (FLAG_enable_ool_constant_pool) {
3226 return false; 3225 // TODO(ishell): implement constant pool support if we ever enable it.
3226 UNIMPLEMENTED();
3227 } else {
3228 // This is left here just to make constant pool unit tests work.
3229 return true;
3230 }
3231 }
3232 // Consider slots in objects that contain ONLY raw data as invalid.
3233 if (object->MayContainRawValues()) return false;
3234 if (FLAG_unbox_double_fields) {
3235 // Filter out slots that happens to point to unboxed double fields.
Hannes Payer (out of office) 2015/04/28 06:31:36 happen
3236 LayoutDescriptorHelper helper(object->map());
3237 bool has_only_tagged_fields = helper.all_fields_tagged();
3238 if (!has_only_tagged_fields &&
3239 !helper.IsTagged(static_cast<int>(slot - object->address()))) {
3240 return false;
3241 }
3227 } 3242 }
3228 } 3243 }
3229 #endif
3230 3244
3231 return true; 3245 return true;
3232 } 3246 }
3233 3247
3234 3248
3235 void MarkCompactCollector::VerifyIsSlotInLiveObject(Address slot, 3249 void MarkCompactCollector::VerifyIsSlotInLiveObject(Address slot,
3236 HeapObject* object) { 3250 HeapObject* object) {
3237 // The target object has to be black. 3251 // The target object has to be black.
3238 CHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); 3252 CHECK(Marking::IsBlack(Marking::MarkBitFrom(object)));
3239 3253
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after
4728 SlotsBuffer* buffer = *buffer_address; 4742 SlotsBuffer* buffer = *buffer_address;
4729 while (buffer != NULL) { 4743 while (buffer != NULL) {
4730 SlotsBuffer* next_buffer = buffer->next(); 4744 SlotsBuffer* next_buffer = buffer->next();
4731 DeallocateBuffer(buffer); 4745 DeallocateBuffer(buffer);
4732 buffer = next_buffer; 4746 buffer = next_buffer;
4733 } 4747 }
4734 *buffer_address = NULL; 4748 *buffer_address = NULL;
4735 } 4749 }
4736 } 4750 }
4737 } // namespace v8::internal 4751 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698