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

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

Issue 1433923002: Maintain a FixedArray for the optimized code map. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 5 years, 1 month 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 | « src/heap/heap.cc ('k') | src/heap/objects-visiting-inl.h » ('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 // 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/heap/mark-compact.h" 5 #include "src/heap/mark-compact.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/base/sys-info.h" 9 #include "src/base/sys-info.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 915
916 Code* code = shared->code(); 916 Code* code = shared->code();
917 MarkBit code_mark = Marking::MarkBitFrom(code); 917 MarkBit code_mark = Marking::MarkBitFrom(code);
918 if (Marking::IsWhite(code_mark)) { 918 if (Marking::IsWhite(code_mark)) {
919 if (FLAG_trace_code_flushing && shared->is_compiled()) { 919 if (FLAG_trace_code_flushing && shared->is_compiled()) {
920 PrintF("[code-flushing clears: "); 920 PrintF("[code-flushing clears: ");
921 shared->ShortPrint(); 921 shared->ShortPrint();
922 PrintF(" - age: %d]\n", code->GetAge()); 922 PrintF(" - age: %d]\n", code->GetAge());
923 } 923 }
924 // Always flush the optimized code map if there is one. 924 // Always flush the optimized code map if there is one.
925 if (!shared->optimized_code_map()->IsSmi()) { 925 if (!shared->OptimizedCodeMapIsCleared()) {
926 shared->ClearOptimizedCodeMap(); 926 shared->ClearOptimizedCodeMap();
927 } 927 }
928 shared->set_code(lazy_compile); 928 shared->set_code(lazy_compile);
929 candidate->set_code(lazy_compile); 929 candidate->set_code(lazy_compile);
930 } else { 930 } else {
931 DCHECK(Marking::IsBlack(code_mark)); 931 DCHECK(Marking::IsBlack(code_mark));
932 candidate->set_code(code); 932 candidate->set_code(code);
933 } 933 }
934 934
935 // We are in the middle of a GC cycle so the write barrier in the code 935 // We are in the middle of a GC cycle so the write barrier in the code
(...skipping 26 matching lines...) Expand all
962 962
963 Code* code = candidate->code(); 963 Code* code = candidate->code();
964 MarkBit code_mark = Marking::MarkBitFrom(code); 964 MarkBit code_mark = Marking::MarkBitFrom(code);
965 if (Marking::IsWhite(code_mark)) { 965 if (Marking::IsWhite(code_mark)) {
966 if (FLAG_trace_code_flushing && candidate->is_compiled()) { 966 if (FLAG_trace_code_flushing && candidate->is_compiled()) {
967 PrintF("[code-flushing clears: "); 967 PrintF("[code-flushing clears: ");
968 candidate->ShortPrint(); 968 candidate->ShortPrint();
969 PrintF(" - age: %d]\n", code->GetAge()); 969 PrintF(" - age: %d]\n", code->GetAge());
970 } 970 }
971 // Always flush the optimized code map if there is one. 971 // Always flush the optimized code map if there is one.
972 if (!candidate->optimized_code_map()->IsSmi()) { 972 if (!candidate->OptimizedCodeMapIsCleared()) {
973 candidate->ClearOptimizedCodeMap(); 973 candidate->ClearOptimizedCodeMap();
974 } 974 }
975 candidate->set_code(lazy_compile); 975 candidate->set_code(lazy_compile);
976 } 976 }
977 977
978 Object** code_slot = 978 Object** code_slot =
979 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset); 979 HeapObject::RawField(candidate, SharedFunctionInfo::kCodeOffset);
980 isolate_->heap()->mark_compact_collector()->RecordSlot(candidate, code_slot, 980 isolate_->heap()->mark_compact_collector()->RecordSlot(candidate, code_slot,
981 *code_slot); 981 *code_slot);
982 982
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 heap()->object_stats_->TraceObjectStats(); 2122 heap()->object_stats_->TraceObjectStats();
2123 } 2123 }
2124 heap()->object_stats_->CheckpointObjectStats(); 2124 heap()->object_stats_->CheckpointObjectStats();
2125 } 2125 }
2126 } 2126 }
2127 2127
2128 2128
2129 void MarkCompactCollector::ProcessAndClearOptimizedCodeMaps() { 2129 void MarkCompactCollector::ProcessAndClearOptimizedCodeMaps() {
2130 SharedFunctionInfo::Iterator iterator(isolate()); 2130 SharedFunctionInfo::Iterator iterator(isolate());
2131 while (SharedFunctionInfo* shared = iterator.Next()) { 2131 while (SharedFunctionInfo* shared = iterator.Next()) {
2132 if (shared->optimized_code_map()->IsSmi()) continue; 2132 if (shared->OptimizedCodeMapIsCleared()) continue;
2133 2133
2134 // Process context-dependent entries in the optimized code map. 2134 // Process context-dependent entries in the optimized code map.
2135 FixedArray* code_map = FixedArray::cast(shared->optimized_code_map()); 2135 FixedArray* code_map = shared->optimized_code_map();
2136 int new_length = SharedFunctionInfo::kEntriesStart; 2136 int new_length = SharedFunctionInfo::kEntriesStart;
2137 int old_length = code_map->length(); 2137 int old_length = code_map->length();
2138 for (int i = SharedFunctionInfo::kEntriesStart; i < old_length; 2138 for (int i = SharedFunctionInfo::kEntriesStart; i < old_length;
2139 i += SharedFunctionInfo::kEntryLength) { 2139 i += SharedFunctionInfo::kEntryLength) {
2140 // Each entry contains [ context, code, literals, ast-id ] as fields. 2140 // Each entry contains [ context, code, literals, ast-id ] as fields.
2141 STATIC_ASSERT(SharedFunctionInfo::kEntryLength == 4); 2141 STATIC_ASSERT(SharedFunctionInfo::kEntryLength == 4);
2142 Context* context = 2142 Context* context =
2143 Context::cast(code_map->get(i + SharedFunctionInfo::kContextOffset)); 2143 Context::cast(code_map->get(i + SharedFunctionInfo::kContextOffset));
2144 HeapObject* code = HeapObject::cast( 2144 HeapObject* code = HeapObject::cast(
2145 code_map->get(i + SharedFunctionInfo::kCachedCodeOffset)); 2145 code_map->get(i + SharedFunctionInfo::kCachedCodeOffset));
(...skipping 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after
4487 MarkBit mark_bit = Marking::MarkBitFrom(host); 4487 MarkBit mark_bit = Marking::MarkBitFrom(host);
4488 if (Marking::IsBlack(mark_bit)) { 4488 if (Marking::IsBlack(mark_bit)) {
4489 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); 4489 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host);
4490 RecordRelocSlot(&rinfo, target); 4490 RecordRelocSlot(&rinfo, target);
4491 } 4491 }
4492 } 4492 }
4493 } 4493 }
4494 4494
4495 } // namespace internal 4495 } // namespace internal
4496 } // namespace v8 4496 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698