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

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

Issue 10878047: Revert to code state of 3.13.1 plus r12350 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 4 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/liveobjectlist.cc ('k') | src/mips/builtins-mips.cc » ('j') | 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 // 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 VerifyEvacuation(heap->code_space()); 217 VerifyEvacuation(heap->code_space());
218 VerifyEvacuation(heap->cell_space()); 218 VerifyEvacuation(heap->cell_space());
219 VerifyEvacuation(heap->map_space()); 219 VerifyEvacuation(heap->map_space());
220 VerifyEvacuation(heap->new_space()); 220 VerifyEvacuation(heap->new_space());
221 221
222 VerifyEvacuationVisitor visitor; 222 VerifyEvacuationVisitor visitor;
223 heap->IterateStrongRoots(&visitor, VISIT_ALL); 223 heap->IterateStrongRoots(&visitor, VISIT_ALL);
224 } 224 }
225 225
226 226
227 class VerifyNativeContextSeparationVisitor: public ObjectVisitor { 227 class VerifyGlobalContextSeparationVisitor: public ObjectVisitor {
228 public: 228 public:
229 VerifyNativeContextSeparationVisitor() : current_native_context_(NULL) {} 229 VerifyGlobalContextSeparationVisitor() : current_global_context_(NULL) {}
230 230
231 void VisitPointers(Object** start, Object** end) { 231 void VisitPointers(Object** start, Object** end) {
232 for (Object** current = start; current < end; current++) { 232 for (Object** current = start; current < end; current++) {
233 if ((*current)->IsHeapObject()) { 233 if ((*current)->IsHeapObject()) {
234 HeapObject* object = HeapObject::cast(*current); 234 HeapObject* object = HeapObject::cast(*current);
235 if (object->IsString()) continue; 235 if (object->IsString()) continue;
236 switch (object->map()->instance_type()) { 236 switch (object->map()->instance_type()) {
237 case JS_FUNCTION_TYPE: 237 case JS_FUNCTION_TYPE:
238 CheckContext(JSFunction::cast(object)->context()); 238 CheckContext(JSFunction::cast(object)->context());
239 break; 239 break;
240 case JS_GLOBAL_PROXY_TYPE: 240 case JS_GLOBAL_PROXY_TYPE:
241 CheckContext(JSGlobalProxy::cast(object)->native_context()); 241 CheckContext(JSGlobalProxy::cast(object)->context());
242 break; 242 break;
243 case JS_GLOBAL_OBJECT_TYPE: 243 case JS_GLOBAL_OBJECT_TYPE:
244 case JS_BUILTINS_OBJECT_TYPE: 244 case JS_BUILTINS_OBJECT_TYPE:
245 CheckContext(GlobalObject::cast(object)->native_context()); 245 CheckContext(GlobalObject::cast(object)->global_context());
246 break; 246 break;
247 case JS_ARRAY_TYPE: 247 case JS_ARRAY_TYPE:
248 case JS_DATE_TYPE: 248 case JS_DATE_TYPE:
249 case JS_OBJECT_TYPE: 249 case JS_OBJECT_TYPE:
250 case JS_REGEXP_TYPE: 250 case JS_REGEXP_TYPE:
251 VisitPointer(HeapObject::RawField(object, JSObject::kMapOffset)); 251 VisitPointer(HeapObject::RawField(object, JSObject::kMapOffset));
252 break; 252 break;
253 case MAP_TYPE: 253 case MAP_TYPE:
254 VisitPointer(HeapObject::RawField(object, Map::kPrototypeOffset)); 254 VisitPointer(HeapObject::RawField(object, Map::kPrototypeOffset));
255 VisitPointer(HeapObject::RawField(object, Map::kConstructorOffset)); 255 VisitPointer(HeapObject::RawField(object, Map::kConstructorOffset));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 default: 288 default:
289 UNREACHABLE(); 289 UNREACHABLE();
290 } 290 }
291 } 291 }
292 } 292 }
293 } 293 }
294 294
295 private: 295 private:
296 void CheckContext(Object* context) { 296 void CheckContext(Object* context) {
297 if (!context->IsContext()) return; 297 if (!context->IsContext()) return;
298 Context* native_context = Context::cast(context)->native_context(); 298 Context* global_context = Context::cast(context)->global_context();
299 if (current_native_context_ == NULL) { 299 if (current_global_context_ == NULL) {
300 current_native_context_ = native_context; 300 current_global_context_ = global_context;
301 } else { 301 } else {
302 CHECK_EQ(current_native_context_, native_context); 302 CHECK_EQ(current_global_context_, global_context);
303 } 303 }
304 } 304 }
305 305
306 Context* current_native_context_; 306 Context* current_global_context_;
307 }; 307 };
308 308
309 309
310 static void VerifyNativeContextSeparation(Heap* heap) { 310 static void VerifyGlobalContextSeparation(Heap* heap) {
311 HeapObjectIterator it(heap->code_space()); 311 HeapObjectIterator it(heap->code_space());
312 312
313 for (Object* object = it.Next(); object != NULL; object = it.Next()) { 313 for (Object* object = it.Next(); object != NULL; object = it.Next()) {
314 VerifyNativeContextSeparationVisitor visitor; 314 VerifyGlobalContextSeparationVisitor visitor;
315 Code::cast(object)->CodeIterateBody(&visitor); 315 Code::cast(object)->CodeIterateBody(&visitor);
316 } 316 }
317 } 317 }
318 #endif 318 #endif
319 319
320 320
321 void MarkCompactCollector::AddEvacuationCandidate(Page* p) { 321 void MarkCompactCollector::AddEvacuationCandidate(Page* p) {
322 p->MarkEvacuationCandidate(); 322 p->MarkEvacuationCandidate();
323 evacuation_candidates_.Add(p); 323 evacuation_candidates_.Add(p);
324 } 324 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 if (FLAG_verify_heap) { 382 if (FLAG_verify_heap) {
383 VerifyMarking(heap_); 383 VerifyMarking(heap_);
384 } 384 }
385 #endif 385 #endif
386 386
387 SweepSpaces(); 387 SweepSpaces();
388 388
389 if (!FLAG_collect_maps) ReattachInitialMaps(); 389 if (!FLAG_collect_maps) ReattachInitialMaps();
390 390
391 #ifdef DEBUG 391 #ifdef DEBUG
392 if (FLAG_verify_native_context_separation) { 392 if (FLAG_verify_global_context_separation) {
393 VerifyNativeContextSeparation(heap_); 393 VerifyGlobalContextSeparation(heap_);
394 } 394 }
395 #endif 395 #endif
396 396
397 Finish(); 397 Finish();
398 398
399 tracer_ = NULL; 399 tracer_ = NULL;
400 } 400 }
401 401
402 402
403 #ifdef DEBUG 403 #ifdef DEBUG
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 // decision until we see all functions that point to the same 1262 // decision until we see all functions that point to the same
1263 // SharedFunctionInfo because some of them might be optimized. 1263 // SharedFunctionInfo because some of them might be optimized.
1264 // That would make the nonoptimized version of the code nonflushable, 1264 // That would make the nonoptimized version of the code nonflushable,
1265 // because it is required for bailing out from optimized code. 1265 // because it is required for bailing out from optimized code.
1266 heap->mark_compact_collector()->code_flusher()->AddCandidate(function); 1266 heap->mark_compact_collector()->code_flusher()->AddCandidate(function);
1267 return true; 1267 return true;
1268 } 1268 }
1269 1269
1270 static inline bool IsValidNotBuiltinContext(Object* ctx) { 1270 static inline bool IsValidNotBuiltinContext(Object* ctx) {
1271 return ctx->IsContext() && 1271 return ctx->IsContext() &&
1272 !Context::cast(ctx)->global_object()->IsJSBuiltinsObject(); 1272 !Context::cast(ctx)->global()->IsJSBuiltinsObject();
1273 } 1273 }
1274 1274
1275 1275
1276 static void VisitSharedFunctionInfoGeneric(Map* map, HeapObject* object) { 1276 static void VisitSharedFunctionInfoGeneric(Map* map, HeapObject* object) {
1277 SharedFunctionInfo::cast(object)->BeforeVisitingPointers(); 1277 SharedFunctionInfo::cast(object)->BeforeVisitingPointers();
1278 1278
1279 FixedBodyVisitor<MarkCompactMarkingVisitor, 1279 FixedBodyVisitor<MarkCompactMarkingVisitor,
1280 SharedFunctionInfo::BodyDescriptor, 1280 SharedFunctionInfo::BodyDescriptor,
1281 void>::Visit(map, object); 1281 void>::Visit(map, object);
1282 } 1282 }
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2416 heap()->isolate()->runtime_profiler()->RemoveDeadSamples(); 2416 heap()->isolate()->runtime_profiler()->RemoveDeadSamples();
2417 } 2417 }
2418 2418
2419 if (FLAG_track_gc_object_stats) { 2419 if (FLAG_track_gc_object_stats) {
2420 heap()->CheckpointObjectStats(); 2420 heap()->CheckpointObjectStats();
2421 } 2421 }
2422 } 2422 }
2423 2423
2424 2424
2425 void MarkCompactCollector::ProcessMapCaches() { 2425 void MarkCompactCollector::ProcessMapCaches() {
2426 Object* raw_context = heap()->native_contexts_list_; 2426 Object* raw_context = heap()->global_contexts_list_;
2427 while (raw_context != heap()->undefined_value()) { 2427 while (raw_context != heap()->undefined_value()) {
2428 Context* context = reinterpret_cast<Context*>(raw_context); 2428 Context* context = reinterpret_cast<Context*>(raw_context);
2429 if (IsMarked(context)) { 2429 if (IsMarked(context)) {
2430 HeapObject* raw_map_cache = 2430 HeapObject* raw_map_cache =
2431 HeapObject::cast(context->get(Context::MAP_CACHE_INDEX)); 2431 HeapObject::cast(context->get(Context::MAP_CACHE_INDEX));
2432 // A map cache may be reachable from the stack. In this case 2432 // A map cache may be reachable from the stack. In this case
2433 // it's already transitively marked and it's too late to clean 2433 // it's already transitively marked and it's too late to clean
2434 // up its parts. 2434 // up its parts.
2435 if (!IsMarked(raw_map_cache) && 2435 if (!IsMarked(raw_map_cache) &&
2436 raw_map_cache != heap()->undefined_value()) { 2436 raw_map_cache != heap()->undefined_value()) {
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
3397 cell != NULL; 3397 cell != NULL;
3398 cell = cell_iterator.Next()) { 3398 cell = cell_iterator.Next()) {
3399 if (cell->IsJSGlobalPropertyCell()) { 3399 if (cell->IsJSGlobalPropertyCell()) {
3400 Address value_address = 3400 Address value_address =
3401 reinterpret_cast<Address>(cell) + 3401 reinterpret_cast<Address>(cell) +
3402 (JSGlobalPropertyCell::kValueOffset - kHeapObjectTag); 3402 (JSGlobalPropertyCell::kValueOffset - kHeapObjectTag);
3403 updating_visitor.VisitPointer(reinterpret_cast<Object**>(value_address)); 3403 updating_visitor.VisitPointer(reinterpret_cast<Object**>(value_address));
3404 } 3404 }
3405 } 3405 }
3406 3406
3407 // Update pointer from the native contexts list. 3407 // Update pointer from the global contexts list.
3408 updating_visitor.VisitPointer(heap_->native_contexts_list_address()); 3408 updating_visitor.VisitPointer(heap_->global_contexts_list_address());
3409 3409
3410 heap_->symbol_table()->Iterate(&updating_visitor); 3410 heap_->symbol_table()->Iterate(&updating_visitor);
3411 3411
3412 // Update pointers from external string table. 3412 // Update pointers from external string table.
3413 heap_->UpdateReferencesInExternalStringTable( 3413 heap_->UpdateReferencesInExternalStringTable(
3414 &UpdateReferenceInExternalStringTableEntry); 3414 &UpdateReferenceInExternalStringTableEntry);
3415 3415
3416 if (!FLAG_watch_ic_patching) { 3416 if (!FLAG_watch_ic_patching) {
3417 // Update JSFunction pointers from the runtime profiler. 3417 // Update JSFunction pointers from the runtime profiler.
3418 heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact( 3418 heap()->isolate()->runtime_profiler()->UpdateSamplesAfterCompact(
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
4142 while (buffer != NULL) { 4142 while (buffer != NULL) {
4143 SlotsBuffer* next_buffer = buffer->next(); 4143 SlotsBuffer* next_buffer = buffer->next();
4144 DeallocateBuffer(buffer); 4144 DeallocateBuffer(buffer);
4145 buffer = next_buffer; 4145 buffer = next_buffer;
4146 } 4146 }
4147 *buffer_address = NULL; 4147 *buffer_address = NULL;
4148 } 4148 }
4149 4149
4150 4150
4151 } } // namespace v8::internal 4151 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/liveobjectlist.cc ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698