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

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

Issue 636173002: Remove deprecated verification for context separation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/flag-definitions.h ('k') | 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 VerifyEvacuation(heap, heap->property_cell_space()); 220 VerifyEvacuation(heap, heap->property_cell_space());
221 VerifyEvacuation(heap, heap->map_space()); 221 VerifyEvacuation(heap, heap->map_space());
222 VerifyEvacuation(heap->new_space()); 222 VerifyEvacuation(heap->new_space());
223 223
224 VerifyEvacuationVisitor visitor; 224 VerifyEvacuationVisitor visitor;
225 heap->IterateStrongRoots(&visitor, VISIT_ALL); 225 heap->IterateStrongRoots(&visitor, VISIT_ALL);
226 } 226 }
227 #endif // VERIFY_HEAP 227 #endif // VERIFY_HEAP
228 228
229 229
230 #ifdef DEBUG
231 class VerifyNativeContextSeparationVisitor : public ObjectVisitor {
232 public:
233 VerifyNativeContextSeparationVisitor() : current_native_context_(NULL) {}
234
235 void VisitPointers(Object** start, Object** end) {
236 for (Object** current = start; current < end; current++) {
237 if ((*current)->IsHeapObject()) {
238 HeapObject* object = HeapObject::cast(*current);
239 if (object->IsString()) continue;
240 switch (object->map()->instance_type()) {
241 case JS_FUNCTION_TYPE:
242 CheckContext(JSFunction::cast(object)->context());
243 break;
244 case JS_GLOBAL_PROXY_TYPE:
245 CheckContext(JSGlobalProxy::cast(object)->native_context());
246 break;
247 case JS_GLOBAL_OBJECT_TYPE:
248 case JS_BUILTINS_OBJECT_TYPE:
249 CheckContext(GlobalObject::cast(object)->native_context());
250 break;
251 case JS_ARRAY_TYPE:
252 case JS_DATE_TYPE:
253 case JS_OBJECT_TYPE:
254 case JS_REGEXP_TYPE:
255 VisitPointer(HeapObject::RawField(object, JSObject::kMapOffset));
256 break;
257 case MAP_TYPE:
258 VisitPointer(HeapObject::RawField(object, Map::kPrototypeOffset));
259 VisitPointer(HeapObject::RawField(object, Map::kConstructorOffset));
260 break;
261 case FIXED_ARRAY_TYPE:
262 if (object->IsContext()) {
263 CheckContext(object);
264 } else {
265 FixedArray* array = FixedArray::cast(object);
266 int length = array->length();
267 // Set array length to zero to prevent cycles while iterating
268 // over array bodies, this is easier than intrusive marking.
269 array->set_length(0);
270 array->IterateBody(FIXED_ARRAY_TYPE, FixedArray::SizeFor(length),
271 this);
272 array->set_length(length);
273 }
274 break;
275 case CELL_TYPE:
276 case JS_PROXY_TYPE:
277 case JS_VALUE_TYPE:
278 case TYPE_FEEDBACK_INFO_TYPE:
279 object->Iterate(this);
280 break;
281 case DECLARED_ACCESSOR_INFO_TYPE:
282 case EXECUTABLE_ACCESSOR_INFO_TYPE:
283 case BYTE_ARRAY_TYPE:
284 case CALL_HANDLER_INFO_TYPE:
285 case CODE_TYPE:
286 case FIXED_DOUBLE_ARRAY_TYPE:
287 case HEAP_NUMBER_TYPE:
288 case MUTABLE_HEAP_NUMBER_TYPE:
289 case INTERCEPTOR_INFO_TYPE:
290 case ODDBALL_TYPE:
291 case SCRIPT_TYPE:
292 case SHARED_FUNCTION_INFO_TYPE:
293 break;
294 default:
295 UNREACHABLE();
296 }
297 }
298 }
299 }
300
301 private:
302 void CheckContext(Object* context) {
303 if (!context->IsContext()) return;
304 Context* native_context = Context::cast(context)->native_context();
305 if (current_native_context_ == NULL) {
306 current_native_context_ = native_context;
307 } else {
308 CHECK_EQ(current_native_context_, native_context);
309 }
310 }
311
312 Context* current_native_context_;
313 };
314
315
316 static void VerifyNativeContextSeparation(Heap* heap) {
317 HeapObjectIterator it(heap->code_space());
318
319 for (Object* object = it.Next(); object != NULL; object = it.Next()) {
320 VerifyNativeContextSeparationVisitor visitor;
321 Code::cast(object)->CodeIterateBody(&visitor);
322 }
323 }
324 #endif
325
326
327 void MarkCompactCollector::SetUp() { 230 void MarkCompactCollector::SetUp() {
328 free_list_old_data_space_.Reset(new FreeList(heap_->old_data_space())); 231 free_list_old_data_space_.Reset(new FreeList(heap_->old_data_space()));
329 free_list_old_pointer_space_.Reset(new FreeList(heap_->old_pointer_space())); 232 free_list_old_pointer_space_.Reset(new FreeList(heap_->old_pointer_space()));
330 } 233 }
331 234
332 235
333 void MarkCompactCollector::TearDown() { AbortCompaction(); } 236 void MarkCompactCollector::TearDown() { AbortCompaction(); }
334 237
335 238
336 void MarkCompactCollector::AddEvacuationCandidate(Page* p) { 239 void MarkCompactCollector::AddEvacuationCandidate(Page* p) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 ClearWeakCollections(); 301 ClearWeakCollections();
399 302
400 #ifdef VERIFY_HEAP 303 #ifdef VERIFY_HEAP
401 if (FLAG_verify_heap) { 304 if (FLAG_verify_heap) {
402 VerifyMarking(heap_); 305 VerifyMarking(heap_);
403 } 306 }
404 #endif 307 #endif
405 308
406 SweepSpaces(); 309 SweepSpaces();
407 310
408 #ifdef DEBUG
409 if (FLAG_verify_native_context_separation) {
410 VerifyNativeContextSeparation(heap_);
411 }
412 #endif
413
414 #ifdef VERIFY_HEAP 311 #ifdef VERIFY_HEAP
415 if (heap()->weak_embedded_objects_verification_enabled()) { 312 if (heap()->weak_embedded_objects_verification_enabled()) {
416 VerifyWeakEmbeddedObjectsInCode(); 313 VerifyWeakEmbeddedObjectsInCode();
417 } 314 }
418 if (FLAG_collect_maps && FLAG_omit_map_checks_for_leaf_maps) { 315 if (FLAG_collect_maps && FLAG_omit_map_checks_for_leaf_maps) {
419 VerifyOmittedMapChecks(); 316 VerifyOmittedMapChecks();
420 } 317 }
421 #endif 318 #endif
422 319
423 Finish(); 320 Finish();
(...skipping 4081 matching lines...) Expand 10 before | Expand all | Expand 10 after
4505 SlotsBuffer* buffer = *buffer_address; 4402 SlotsBuffer* buffer = *buffer_address;
4506 while (buffer != NULL) { 4403 while (buffer != NULL) {
4507 SlotsBuffer* next_buffer = buffer->next(); 4404 SlotsBuffer* next_buffer = buffer->next();
4508 DeallocateBuffer(buffer); 4405 DeallocateBuffer(buffer);
4509 buffer = next_buffer; 4406 buffer = next_buffer;
4510 } 4407 }
4511 *buffer_address = NULL; 4408 *buffer_address = NULL;
4512 } 4409 }
4513 } 4410 }
4514 } // namespace v8::internal 4411 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698