V8 Project
v8::internal::CodeFlusher Class Reference

#include <mark-compact.h>

+ Collaboration diagram for v8::internal::CodeFlusher:

Public Member Functions

 CodeFlusher (Isolate *isolate)
 
void AddCandidate (SharedFunctionInfo *shared_info)
 
void AddCandidate (JSFunction *function)
 
void AddOptimizedCodeMap (SharedFunctionInfo *code_map_holder)
 
void EvictOptimizedCodeMap (SharedFunctionInfo *code_map_holder)
 
void EvictCandidate (SharedFunctionInfo *shared_info)
 
void EvictCandidate (JSFunction *function)
 
void ProcessCandidates ()
 
void EvictAllCandidates ()
 
void IteratePointersToFromSpace (ObjectVisitor *v)
 

Private Member Functions

void ProcessOptimizedCodeMaps ()
 
void ProcessJSFunctionCandidates ()
 
void ProcessSharedFunctionInfoCandidates ()
 
void EvictOptimizedCodeMaps ()
 
void EvictJSFunctionCandidates ()
 
void EvictSharedFunctionInfoCandidates ()
 
 DISALLOW_COPY_AND_ASSIGN (CodeFlusher)
 

Static Private Member Functions

static JSFunction ** GetNextCandidateSlot (JSFunction *candidate)
 
static JSFunctionGetNextCandidate (JSFunction *candidate)
 
static void SetNextCandidate (JSFunction *candidate, JSFunction *next_candidate)
 
static void ClearNextCandidate (JSFunction *candidate, Object *undefined)
 
static SharedFunctionInfoGetNextCandidate (SharedFunctionInfo *candidate)
 
static void SetNextCandidate (SharedFunctionInfo *candidate, SharedFunctionInfo *next_candidate)
 
static void ClearNextCandidate (SharedFunctionInfo *candidate)
 
static SharedFunctionInfoGetNextCodeMap (SharedFunctionInfo *holder)
 
static void SetNextCodeMap (SharedFunctionInfo *holder, SharedFunctionInfo *next_holder)
 
static void ClearNextCodeMap (SharedFunctionInfo *holder)
 

Private Attributes

Isolateisolate_
 
JSFunctionjsfunction_candidates_head_
 
SharedFunctionInfoshared_function_info_candidates_head_
 
SharedFunctionInfooptimized_code_map_holder_head_
 

Detailed Description

Definition at line 376 of file mark-compact.h.

Constructor & Destructor Documentation

◆ CodeFlusher()

v8::internal::CodeFlusher::CodeFlusher ( Isolate isolate)
inlineexplicit

Definition at line 378 of file mark-compact.h.

379  : isolate_(isolate),
JSFunction * jsfunction_candidates_head_
Definition: mark-compact.h:484
SharedFunctionInfo * shared_function_info_candidates_head_
Definition: mark-compact.h:485
SharedFunctionInfo * optimized_code_map_holder_head_
Definition: mark-compact.h:486
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL

Member Function Documentation

◆ AddCandidate() [1/2]

void v8::internal::CodeFlusher::AddCandidate ( JSFunction function)
inline

Definition at line 391 of file mark-compact.h.

391  {
392  DCHECK(function->code() == function->shared()->code());
393  if (GetNextCandidate(function)->IsUndefined()) {
395  jsfunction_candidates_head_ = function;
396  }
397  }
static JSFunction * GetNextCandidate(JSFunction *candidate)
Definition: mark-compact.h:437
static void SetNextCandidate(JSFunction *candidate, JSFunction *next_candidate)
Definition: mark-compact.h:442
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, GetNextCandidate(), jsfunction_candidates_head_, and SetNextCandidate().

+ Here is the call graph for this function:

◆ AddCandidate() [2/2]

void v8::internal::CodeFlusher::AddCandidate ( SharedFunctionInfo shared_info)
inline

Definition at line 384 of file mark-compact.h.

384  {
385  if (GetNextCandidate(shared_info) == NULL) {
388  }
389  }

References GetNextCandidate(), NULL, SetNextCandidate(), and shared_function_info_candidates_head_.

+ Here is the call graph for this function:

◆ AddOptimizedCodeMap()

void v8::internal::CodeFlusher::AddOptimizedCodeMap ( SharedFunctionInfo code_map_holder)
inline

Definition at line 399 of file mark-compact.h.

399  {
400  if (GetNextCodeMap(code_map_holder)->IsUndefined()) {
402  optimized_code_map_holder_head_ = code_map_holder;
403  }
404  }
static void SetNextCodeMap(SharedFunctionInfo *holder, SharedFunctionInfo *next_holder)
Definition: mark-compact.h:472
static SharedFunctionInfo * GetNextCodeMap(SharedFunctionInfo *holder)
Definition: mark-compact.h:466

References GetNextCodeMap(), optimized_code_map_holder_head_, and SetNextCodeMap().

+ Here is the call graph for this function:

◆ ClearNextCandidate() [1/2]

static void v8::internal::CodeFlusher::ClearNextCandidate ( JSFunction candidate,
Object undefined 
)
inlinestaticprivate

Definition at line 447 of file mark-compact.h.

447  {
448  DCHECK(undefined->IsUndefined());
449  candidate->set_next_function_link(undefined, SKIP_WRITE_BARRIER);
450  }
@ SKIP_WRITE_BARRIER
Definition: objects.h:235

References DCHECK, and v8::internal::SKIP_WRITE_BARRIER.

Referenced by EvictCandidate(), ProcessJSFunctionCandidates(), and ProcessSharedFunctionInfoCandidates().

+ Here is the caller graph for this function:

◆ ClearNextCandidate() [2/2]

static void v8::internal::CodeFlusher::ClearNextCandidate ( SharedFunctionInfo candidate)
inlinestaticprivate

Definition at line 462 of file mark-compact.h.

462  {
463  candidate->code()->set_gc_metadata(NULL, SKIP_WRITE_BARRIER);
464  }

References NULL, and v8::internal::SKIP_WRITE_BARRIER.

◆ ClearNextCodeMap()

static void v8::internal::CodeFlusher::ClearNextCodeMap ( SharedFunctionInfo holder)
inlinestaticprivate

Definition at line 478 of file mark-compact.h.

478  {
479  FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
480  code_map->set_undefined(SharedFunctionInfo::kNextMapIndex);
481  }
static const int kNextMapIndex
Definition: objects.h:6623

References v8::internal::SharedFunctionInfo::kNextMapIndex, and v8::internal::FixedArray::set_undefined().

Referenced by EvictOptimizedCodeMap(), and ProcessOptimizedCodeMaps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::CodeFlusher::DISALLOW_COPY_AND_ASSIGN ( CodeFlusher  )
private

◆ EvictAllCandidates()

void v8::internal::CodeFlusher::EvictAllCandidates ( )
inline

Definition at line 416 of file mark-compact.h.

References EvictJSFunctionCandidates(), EvictOptimizedCodeMaps(), and EvictSharedFunctionInfoCandidates().

Referenced by v8::internal::MarkCompactCollector::EnableCodeFlushing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EvictCandidate() [1/2]

void v8::internal::CodeFlusher::EvictCandidate ( JSFunction function)

Definition at line 1184 of file mark-compact.cc.

1184  {
1185  DCHECK(!function->next_function_link()->IsUndefined());
1186  Object* undefined = isolate_->heap()->undefined_value();
1187 
1188  // Make sure previous flushing decisions are revisited.
1189  isolate_->heap()->incremental_marking()->RecordWrites(function);
1190  isolate_->heap()->incremental_marking()->RecordWrites(function->shared());
1191 
1192  if (FLAG_trace_code_flushing) {
1193  PrintF("[code-flushing abandons closure: ");
1194  function->shared()->ShortPrint();
1195  PrintF("]\n");
1196  }
1197 
1198  JSFunction* candidate = jsfunction_candidates_head_;
1199  JSFunction* next_candidate;
1200  if (candidate == function) {
1201  next_candidate = GetNextCandidate(function);
1202  jsfunction_candidates_head_ = next_candidate;
1203  ClearNextCandidate(function, undefined);
1204  } else {
1205  while (candidate != NULL) {
1206  next_candidate = GetNextCandidate(candidate);
1207 
1208  if (next_candidate == function) {
1209  next_candidate = GetNextCandidate(function);
1210  SetNextCandidate(candidate, next_candidate);
1211  ClearNextCandidate(function, undefined);
1212  break;
1213  }
1214 
1215  candidate = next_candidate;
1216  }
1217  }
1218 }
static void ClearNextCandidate(JSFunction *candidate, Object *undefined)
Definition: mark-compact.h:447
IncrementalMarking * incremental_marking()
Definition: heap.h:1205
kSerializedDataOffset Object
Definition: objects-inl.h:5322
void PrintF(const char *format,...)
Definition: utils.cc:80

References ClearNextCandidate(), DCHECK, GetNextCandidate(), v8::internal::Isolate::heap(), v8::internal::Heap::incremental_marking(), isolate_, jsfunction_candidates_head_, NULL, v8::internal::PrintF(), v8::internal::IncrementalMarking::RecordWrites(), and SetNextCandidate().

+ Here is the call graph for this function:

◆ EvictCandidate() [2/2]

void v8::internal::CodeFlusher::EvictCandidate ( SharedFunctionInfo shared_info)

Definition at line 1151 of file mark-compact.cc.

1151  {
1152  // Make sure previous flushing decisions are revisited.
1153  isolate_->heap()->incremental_marking()->RecordWrites(shared_info);
1154 
1155  if (FLAG_trace_code_flushing) {
1156  PrintF("[code-flushing abandons function-info: ");
1157  shared_info->ShortPrint();
1158  PrintF("]\n");
1159  }
1160 
1161  SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
1162  SharedFunctionInfo* next_candidate;
1163  if (candidate == shared_info) {
1164  next_candidate = GetNextCandidate(shared_info);
1165  shared_function_info_candidates_head_ = next_candidate;
1166  ClearNextCandidate(shared_info);
1167  } else {
1168  while (candidate != NULL) {
1169  next_candidate = GetNextCandidate(candidate);
1170 
1171  if (next_candidate == shared_info) {
1172  next_candidate = GetNextCandidate(shared_info);
1173  SetNextCandidate(candidate, next_candidate);
1174  ClearNextCandidate(shared_info);
1175  break;
1176  }
1177 
1178  candidate = next_candidate;
1179  }
1180  }
1181 }

References ClearNextCandidate(), GetNextCandidate(), v8::internal::Isolate::heap(), v8::internal::Heap::incremental_marking(), isolate_, NULL, v8::internal::PrintF(), v8::internal::IncrementalMarking::RecordWrites(), SetNextCandidate(), shared_function_info_candidates_head_, and v8::internal::Object::ShortPrint().

Referenced by v8::internal::Context::AddOptimizedFunction(), EvictJSFunctionCandidates(), EvictSharedFunctionInfoCandidates(), and v8::internal::SharedFunctionInfo::ReplaceCode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EvictJSFunctionCandidates()

void v8::internal::CodeFlusher::EvictJSFunctionCandidates ( )
private

Definition at line 1258 of file mark-compact.cc.

1258  {
1259  JSFunction* candidate = jsfunction_candidates_head_;
1260  JSFunction* next_candidate;
1261  while (candidate != NULL) {
1262  next_candidate = GetNextCandidate(candidate);
1263  EvictCandidate(candidate);
1264  candidate = next_candidate;
1265  }
1267 }
void EvictCandidate(SharedFunctionInfo *shared_info)

References DCHECK, EvictCandidate(), GetNextCandidate(), jsfunction_candidates_head_, and NULL.

Referenced by EvictAllCandidates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EvictOptimizedCodeMap()

void v8::internal::CodeFlusher::EvictOptimizedCodeMap ( SharedFunctionInfo code_map_holder)

Definition at line 1221 of file mark-compact.cc.

1221  {
1222  DCHECK(!FixedArray::cast(code_map_holder->optimized_code_map())
1224  ->IsUndefined());
1225 
1226  // Make sure previous flushing decisions are revisited.
1227  isolate_->heap()->incremental_marking()->RecordWrites(code_map_holder);
1228 
1229  if (FLAG_trace_code_flushing) {
1230  PrintF("[code-flushing abandons code-map: ");
1231  code_map_holder->ShortPrint();
1232  PrintF("]\n");
1233  }
1234 
1235  SharedFunctionInfo* holder = optimized_code_map_holder_head_;
1236  SharedFunctionInfo* next_holder;
1237  if (holder == code_map_holder) {
1238  next_holder = GetNextCodeMap(code_map_holder);
1239  optimized_code_map_holder_head_ = next_holder;
1240  ClearNextCodeMap(code_map_holder);
1241  } else {
1242  while (holder != NULL) {
1243  next_holder = GetNextCodeMap(holder);
1244 
1245  if (next_holder == code_map_holder) {
1246  next_holder = GetNextCodeMap(code_map_holder);
1247  SetNextCodeMap(holder, next_holder);
1248  ClearNextCodeMap(code_map_holder);
1249  break;
1250  }
1251 
1252  holder = next_holder;
1253  }
1254  }
1255 }
static void ClearNextCodeMap(SharedFunctionInfo *holder)
Definition: mark-compact.h:478

References ClearNextCodeMap(), DCHECK, GetNextCodeMap(), v8::internal::Isolate::heap(), v8::internal::Heap::incremental_marking(), isolate_, v8::internal::SharedFunctionInfo::kNextMapIndex, NULL, optimized_code_map_holder_head_, v8::internal::PrintF(), v8::internal::IncrementalMarking::RecordWrites(), SetNextCodeMap(), and v8::internal::Object::ShortPrint().

Referenced by v8::internal::SharedFunctionInfo::ClearOptimizedCodeMap(), and EvictOptimizedCodeMaps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EvictOptimizedCodeMaps()

void v8::internal::CodeFlusher::EvictOptimizedCodeMaps ( )
private

Definition at line 1282 of file mark-compact.cc.

1282  {
1283  SharedFunctionInfo* holder = optimized_code_map_holder_head_;
1284  SharedFunctionInfo* next_holder;
1285  while (holder != NULL) {
1286  next_holder = GetNextCodeMap(holder);
1287  EvictOptimizedCodeMap(holder);
1288  holder = next_holder;
1289  }
1291 }
void EvictOptimizedCodeMap(SharedFunctionInfo *code_map_holder)

References DCHECK, EvictOptimizedCodeMap(), GetNextCodeMap(), NULL, and optimized_code_map_holder_head_.

Referenced by EvictAllCandidates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EvictSharedFunctionInfoCandidates()

void v8::internal::CodeFlusher::EvictSharedFunctionInfoCandidates ( )
private

Definition at line 1270 of file mark-compact.cc.

1270  {
1271  SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
1272  SharedFunctionInfo* next_candidate;
1273  while (candidate != NULL) {
1274  next_candidate = GetNextCandidate(candidate);
1275  EvictCandidate(candidate);
1276  candidate = next_candidate;
1277  }
1279 }

References DCHECK, EvictCandidate(), GetNextCandidate(), NULL, and shared_function_info_candidates_head_.

Referenced by EvictAllCandidates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetNextCandidate() [1/2]

static JSFunction* v8::internal::CodeFlusher::GetNextCandidate ( JSFunction candidate)
inlinestaticprivate

Definition at line 437 of file mark-compact.h.

437  {
438  Object* next_candidate = candidate->next_function_link();
439  return reinterpret_cast<JSFunction*>(next_candidate);
440  }

Referenced by AddCandidate(), EvictCandidate(), EvictJSFunctionCandidates(), EvictSharedFunctionInfoCandidates(), IteratePointersToFromSpace(), ProcessJSFunctionCandidates(), and ProcessSharedFunctionInfoCandidates().

+ Here is the caller graph for this function:

◆ GetNextCandidate() [2/2]

static SharedFunctionInfo* v8::internal::CodeFlusher::GetNextCandidate ( SharedFunctionInfo candidate)
inlinestaticprivate

Definition at line 452 of file mark-compact.h.

452  {
453  Object* next_candidate = candidate->code()->gc_metadata();
454  return reinterpret_cast<SharedFunctionInfo*>(next_candidate);
455  }

◆ GetNextCandidateSlot()

static JSFunction** v8::internal::CodeFlusher::GetNextCandidateSlot ( JSFunction candidate)
inlinestaticprivate

Definition at line 432 of file mark-compact.h.

432  {
433  return reinterpret_cast<JSFunction**>(
435  }
static Object ** RawField(HeapObject *obj, int offset)
Definition: objects-inl.h:1311
static const int kNextFunctionLinkOffset
Definition: objects.h:7384

References v8::internal::JSFunction::kNextFunctionLinkOffset, and v8::internal::HeapObject::RawField().

Referenced by IteratePointersToFromSpace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetNextCodeMap()

static SharedFunctionInfo* v8::internal::CodeFlusher::GetNextCodeMap ( SharedFunctionInfo holder)
inlinestaticprivate

Definition at line 466 of file mark-compact.h.

466  {
467  FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
468  Object* next_map = code_map->get(SharedFunctionInfo::kNextMapIndex);
469  return reinterpret_cast<SharedFunctionInfo*>(next_map);
470  }

References v8::internal::FixedArray::get(), and v8::internal::SharedFunctionInfo::kNextMapIndex.

Referenced by AddOptimizedCodeMap(), EvictOptimizedCodeMap(), EvictOptimizedCodeMaps(), and ProcessOptimizedCodeMaps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IteratePointersToFromSpace()

void v8::internal::CodeFlusher::IteratePointersToFromSpace ( ObjectVisitor v)

Definition at line 1294 of file mark-compact.cc.

1294  {
1295  Heap* heap = isolate_->heap();
1296 
1297  JSFunction** slot = &jsfunction_candidates_head_;
1298  JSFunction* candidate = jsfunction_candidates_head_;
1299  while (candidate != NULL) {
1300  if (heap->InFromSpace(candidate)) {
1301  v->VisitPointer(reinterpret_cast<Object**>(slot));
1302  }
1303  candidate = GetNextCandidate(*slot);
1304  slot = GetNextCandidateSlot(*slot);
1305  }
1306 }
static JSFunction ** GetNextCandidateSlot(JSFunction *candidate)
Definition: mark-compact.h:432

References GetNextCandidate(), GetNextCandidateSlot(), v8::internal::Isolate::heap(), v8::internal::Heap::InFromSpace(), isolate_, jsfunction_candidates_head_, and NULL.

Referenced by v8::internal::Heap::Scavenge().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessCandidates()

void v8::internal::CodeFlusher::ProcessCandidates ( )
inline

Definition at line 410 of file mark-compact.h.

References ProcessJSFunctionCandidates(), ProcessOptimizedCodeMaps(), and ProcessSharedFunctionInfoCandidates().

Referenced by v8::internal::MarkCompactCollector::AfterMarking().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessJSFunctionCandidates()

void v8::internal::CodeFlusher::ProcessJSFunctionCandidates ( )
private

Definition at line 1026 of file mark-compact.cc.

1026  {
1027  Code* lazy_compile = isolate_->builtins()->builtin(Builtins::kCompileLazy);
1028  Object* undefined = isolate_->heap()->undefined_value();
1029 
1030  JSFunction* candidate = jsfunction_candidates_head_;
1031  JSFunction* next_candidate;
1032  while (candidate != NULL) {
1033  next_candidate = GetNextCandidate(candidate);
1034  ClearNextCandidate(candidate, undefined);
1035 
1036  SharedFunctionInfo* shared = candidate->shared();
1037 
1038  Code* code = shared->code();
1039  MarkBit code_mark = Marking::MarkBitFrom(code);
1040  if (!code_mark.Get()) {
1041  if (FLAG_trace_code_flushing && shared->is_compiled()) {
1042  PrintF("[code-flushing clears: ");
1043  shared->ShortPrint();
1044  PrintF(" - age: %d]\n", code->GetAge());
1045  }
1046  shared->set_code(lazy_compile);
1047  candidate->set_code(lazy_compile);
1048  } else {
1049  candidate->set_code(code);
1050  }
1051 
1052  // We are in the middle of a GC cycle so the write barrier in the code
1053  // setter did not record the slot update and we have to do that manually.
1054  Address slot = candidate->address() + JSFunction::kCodeEntryOffset;
1055  Code* target = Code::cast(Code::GetObjectFromEntryAddress(slot));
1057  target);
1058 
1059  Object** shared_code_slot =
1061  isolate_->heap()->mark_compact_collector()->RecordSlot(
1062  shared_code_slot, shared_code_slot, *shared_code_slot);
1063 
1064  candidate = next_candidate;
1065  }
1066 
1068 }
Code * builtin(Name name)
Definition: builtins.h:254
static Object * GetObjectFromEntryAddress(Address location_of_address)
Definition: objects-inl.h:5029
MarkCompactCollector * mark_compact_collector()
Definition: heap.h:1197
Builtins * builtins()
Definition: isolate.h:947
static const int kCodeEntryOffset
Definition: objects.h:7376
void RecordCodeEntrySlot(Address slot, Code *target)
static const int kCodeOffset
Definition: objects.h:6893
byte * Address
Definition: globals.h:101

References v8::internal::HeapObject::address(), v8::internal::Builtins::builtin(), v8::internal::Isolate::builtins(), ClearNextCandidate(), v8::internal::MarkBit::Get(), v8::internal::Code::GetAge(), GetNextCandidate(), v8::internal::Code::GetObjectFromEntryAddress(), v8::internal::Isolate::heap(), v8::internal::SharedFunctionInfo::is_compiled(), isolate_, jsfunction_candidates_head_, v8::internal::JSFunction::kCodeEntryOffset, v8::internal::SharedFunctionInfo::kCodeOffset, v8::internal::Heap::mark_compact_collector(), NULL, v8::internal::PrintF(), v8::internal::HeapObject::RawField(), v8::internal::MarkCompactCollector::RecordCodeEntrySlot(), v8::internal::JSFunction::set_code(), and v8::internal::Object::ShortPrint().

Referenced by ProcessCandidates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessOptimizedCodeMaps()

void v8::internal::CodeFlusher::ProcessOptimizedCodeMaps ( )
private

Definition at line 1103 of file mark-compact.cc.

1103  {
1105 
1106  SharedFunctionInfo* holder = optimized_code_map_holder_head_;
1107  SharedFunctionInfo* next_holder;
1108 
1109  while (holder != NULL) {
1110  next_holder = GetNextCodeMap(holder);
1111  ClearNextCodeMap(holder);
1112 
1113  FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
1114  int new_length = SharedFunctionInfo::kEntriesStart;
1115  int old_length = code_map->length();
1116  for (int i = SharedFunctionInfo::kEntriesStart; i < old_length;
1118  Code* code =
1119  Code::cast(code_map->get(i + SharedFunctionInfo::kCachedCodeOffset));
1120  if (!Marking::MarkBitFrom(code).Get()) continue;
1121 
1122  // Move every slot in the entry.
1123  for (int j = 0; j < SharedFunctionInfo::kEntryLength; j++) {
1124  int dst_index = new_length++;
1125  Object** slot = code_map->RawFieldOfElementAt(dst_index);
1126  Object* object = code_map->get(i + j);
1127  code_map->set(dst_index, object);
1129  DCHECK(object->IsSmi());
1130  } else {
1131  DCHECK(
1132  Marking::IsBlack(Marking::MarkBitFrom(HeapObject::cast(*slot))));
1133  isolate_->heap()->mark_compact_collector()->RecordSlot(slot, slot,
1134  *slot);
1135  }
1136  }
1137  }
1138 
1139  // Trim the optimized code map if entries have been removed.
1140  if (new_length < old_length) {
1141  holder->TrimOptimizedCodeMap(old_length - new_length);
1142  }
1143 
1144  holder = next_holder;
1145  }
1146 
1148 }
static const int kCachedCodeOffset
Definition: objects.h:6626
static const int kEntriesStart
Definition: objects.h:6624
static const int kOsrAstIdOffset
Definition: objects.h:6628
static const int kEntryLength
Definition: objects.h:6629
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))

References ClearNextCodeMap(), DCHECK, v8::internal::FixedArray::get(), GetNextCodeMap(), v8::internal::Isolate::heap(), isolate_, v8::internal::SharedFunctionInfo::kCachedCodeOffset, v8::internal::SharedFunctionInfo::kEntriesStart, v8::internal::SharedFunctionInfo::kEntryLength, v8::internal::SharedFunctionInfo::kOsrAstIdOffset, v8::internal::FixedArrayBase::length(), v8::internal::Heap::mark_compact_collector(), NULL, optimized_code_map_holder_head_, v8::internal::FixedArray::RawFieldOfElementAt(), v8::internal::FixedArray::set(), v8::internal::STATIC_ASSERT(), and v8::internal::SharedFunctionInfo::TrimOptimizedCodeMap().

Referenced by ProcessCandidates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessSharedFunctionInfoCandidates()

void v8::internal::CodeFlusher::ProcessSharedFunctionInfoCandidates ( )
private

Definition at line 1071 of file mark-compact.cc.

1071  {
1072  Code* lazy_compile = isolate_->builtins()->builtin(Builtins::kCompileLazy);
1073 
1074  SharedFunctionInfo* candidate = shared_function_info_candidates_head_;
1075  SharedFunctionInfo* next_candidate;
1076  while (candidate != NULL) {
1077  next_candidate = GetNextCandidate(candidate);
1078  ClearNextCandidate(candidate);
1079 
1080  Code* code = candidate->code();
1081  MarkBit code_mark = Marking::MarkBitFrom(code);
1082  if (!code_mark.Get()) {
1083  if (FLAG_trace_code_flushing && candidate->is_compiled()) {
1084  PrintF("[code-flushing clears: ");
1085  candidate->ShortPrint();
1086  PrintF(" - age: %d]\n", code->GetAge());
1087  }
1088  candidate->set_code(lazy_compile);
1089  }
1090 
1091  Object** code_slot =
1093  isolate_->heap()->mark_compact_collector()->RecordSlot(code_slot, code_slot,
1094  *code_slot);
1095 
1096  candidate = next_candidate;
1097  }
1098 
1100 }

References v8::internal::Builtins::builtin(), v8::internal::Isolate::builtins(), ClearNextCandidate(), v8::internal::MarkBit::Get(), v8::internal::Code::GetAge(), GetNextCandidate(), v8::internal::Isolate::heap(), v8::internal::SharedFunctionInfo::is_compiled(), isolate_, v8::internal::SharedFunctionInfo::kCodeOffset, v8::internal::Heap::mark_compact_collector(), NULL, v8::internal::PrintF(), v8::internal::HeapObject::RawField(), shared_function_info_candidates_head_, and v8::internal::Object::ShortPrint().

Referenced by ProcessCandidates().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetNextCandidate() [1/2]

static void v8::internal::CodeFlusher::SetNextCandidate ( JSFunction candidate,
JSFunction next_candidate 
)
inlinestaticprivate

Definition at line 442 of file mark-compact.h.

443  {
444  candidate->set_next_function_link(next_candidate);
445  }

Referenced by AddCandidate(), and EvictCandidate().

+ Here is the caller graph for this function:

◆ SetNextCandidate() [2/2]

static void v8::internal::CodeFlusher::SetNextCandidate ( SharedFunctionInfo candidate,
SharedFunctionInfo next_candidate 
)
inlinestaticprivate

Definition at line 457 of file mark-compact.h.

458  {
459  candidate->code()->set_gc_metadata(next_candidate);
460  }

◆ SetNextCodeMap()

static void v8::internal::CodeFlusher::SetNextCodeMap ( SharedFunctionInfo holder,
SharedFunctionInfo next_holder 
)
inlinestaticprivate

Definition at line 472 of file mark-compact.h.

473  {
474  FixedArray* code_map = FixedArray::cast(holder->optimized_code_map());
475  code_map->set(SharedFunctionInfo::kNextMapIndex, next_holder);
476  }

References v8::internal::SharedFunctionInfo::kNextMapIndex, and v8::internal::FixedArray::set().

Referenced by AddOptimizedCodeMap(), and EvictOptimizedCodeMap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ isolate_

◆ jsfunction_candidates_head_

JSFunction* v8::internal::CodeFlusher::jsfunction_candidates_head_
private

◆ optimized_code_map_holder_head_

SharedFunctionInfo* v8::internal::CodeFlusher::optimized_code_map_holder_head_
private

◆ shared_function_info_candidates_head_

SharedFunctionInfo* v8::internal::CodeFlusher::shared_function_info_candidates_head_
private

The documentation for this class was generated from the following files: