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

Side by Side Diff: src/incremental-marking.cc

Issue 8917014: Guard against undefined fields in global context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix more global context accesses. Created 9 years 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
« src/heap.cc ('K') | « src/heap.cc ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 670
671 if (FLAG_cleanup_code_caches_at_gc) { 671 if (FLAG_cleanup_code_caches_at_gc) {
672 PolymorphicCodeCache* poly_cache = heap_->polymorphic_code_cache(); 672 PolymorphicCodeCache* poly_cache = heap_->polymorphic_code_cache();
673 Marking::GreyToBlack(Marking::MarkBitFrom(poly_cache)); 673 Marking::GreyToBlack(Marking::MarkBitFrom(poly_cache));
674 MemoryChunk::IncrementLiveBytes(poly_cache->address(), 674 MemoryChunk::IncrementLiveBytes(poly_cache->address(),
675 PolymorphicCodeCache::kSize); 675 PolymorphicCodeCache::kSize);
676 } 676 }
677 677
678 Object* context = heap_->global_contexts_list(); 678 Object* context = heap_->global_contexts_list();
679 while (!context->IsUndefined()) { 679 while (!context->IsUndefined()) {
680 NormalizedMapCache* cache = Context::cast(context)->normalized_map_cache(); 680 int index = Context::NORMALIZED_MAP_CACHE_INDEX;
Vyacheslav Egorov (Chromium) 2011/12/13 12:26:20 I don't think we need separate index variable.
ulan 2011/12/13 13:02:58 Done.
681 MarkBit mark_bit = Marking::MarkBitFrom(cache); 681 Object* cache_or_undefined = Context::cast(context)->get(index);
682 if (Marking::IsGrey(mark_bit)) { 682 if (!cache_or_undefined->IsUndefined()) {
Vyacheslav Egorov (Chromium) 2011/12/13 12:26:20 Please comment why can it be undefined.
ulan 2011/12/13 13:02:58 Done.
683 Marking::GreyToBlack(mark_bit); 683 NormalizedMapCache* cache = NormalizedMapCache::cast(cache_or_undefined);
Vyacheslav Egorov (Chromium) 2011/12/13 12:26:20 you don't need a separate cache variable. just mak
ulan 2011/12/13 13:02:58 Done.
684 MemoryChunk::IncrementLiveBytes(cache->address(), cache->Size()); 684 MarkBit mark_bit = Marking::MarkBitFrom(cache);
685 if (Marking::IsGrey(mark_bit)) {
686 Marking::GreyToBlack(mark_bit);
687 MemoryChunk::IncrementLiveBytes(cache->address(), cache->Size());
688 }
685 } 689 }
686 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); 690 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK);
687 } 691 }
688 } 692 }
689 693
690 694
691 void IncrementalMarking::Abort() { 695 void IncrementalMarking::Abort() {
692 if (IsStopped()) return; 696 if (IsStopped()) return;
693 if (FLAG_trace_incremental_marking) { 697 if (FLAG_trace_incremental_marking) {
694 PrintF("[IncrementalMarking] Aborting.\n"); 698 PrintF("[IncrementalMarking] Aborting.\n");
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 allocation_marking_factor_ = kInitialAllocationMarkingFactor; 915 allocation_marking_factor_ = kInitialAllocationMarkingFactor;
912 bytes_scanned_ = 0; 916 bytes_scanned_ = 0;
913 } 917 }
914 918
915 919
916 int64_t IncrementalMarking::SpaceLeftInOldSpace() { 920 int64_t IncrementalMarking::SpaceLeftInOldSpace() {
917 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize(); 921 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSize();
918 } 922 }
919 923
920 } } // namespace v8::internal 924 } } // namespace v8::internal
OLDNEW
« src/heap.cc ('K') | « src/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698