Commit 1cf4c3a9 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

Rename Ephemeral to Ephemeron

Emphasize this code handles ephemerons (key-value pairs)
and not ephemeral objects (short-lived objects).

Bug: chromium:844008
Change-Id: I1dbf97f69ea5d17b1eb446d92dffef0cc3d5d08f
Reviewed-on: https://chromium-review.googlesource.com/1095101Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@google.com>
Cr-Commit-Position: refs/heads/master@{#53628}
parent 6fd25bc6
...@@ -334,7 +334,7 @@ ...@@ -334,7 +334,7 @@
F(MC_MARK_MAIN) \ F(MC_MARK_MAIN) \
F(MC_MARK_ROOTS) \ F(MC_MARK_ROOTS) \
F(MC_MARK_WEAK_CLOSURE) \ F(MC_MARK_WEAK_CLOSURE) \
F(MC_MARK_WEAK_CLOSURE_EPHEMERAL) \ F(MC_MARK_WEAK_CLOSURE_EPHEMERON) \
F(MC_MARK_WEAK_CLOSURE_WEAK_HANDLES) \ F(MC_MARK_WEAK_CLOSURE_WEAK_HANDLES) \
F(MC_MARK_WEAK_CLOSURE_WEAK_ROOTS) \ F(MC_MARK_WEAK_CLOSURE_WEAK_ROOTS) \
F(MC_MARK_WEAK_CLOSURE_HARMONY) \ F(MC_MARK_WEAK_CLOSURE_HARMONY) \
......
...@@ -697,7 +697,7 @@ void GCTracer::PrintNVP() const { ...@@ -697,7 +697,7 @@ void GCTracer::PrintNVP() const {
"mark.roots=%.1f " "mark.roots=%.1f "
"mark.main=%.1f " "mark.main=%.1f "
"mark.weak_closure=%.1f " "mark.weak_closure=%.1f "
"mark.weak_closure.ephemeral=%.1f " "mark.weak_closure.ephemeron=%.1f "
"mark.weak_closure.weak_handles=%.1f " "mark.weak_closure.weak_handles=%.1f "
"mark.weak_closure.weak_roots=%.1f " "mark.weak_closure.weak_roots=%.1f "
"mark.weak_closure.harmony=%.1f " "mark.weak_closure.harmony=%.1f "
...@@ -791,7 +791,7 @@ void GCTracer::PrintNVP() const { ...@@ -791,7 +791,7 @@ void GCTracer::PrintNVP() const {
current_.scopes[Scope::MC_MARK_ROOTS], current_.scopes[Scope::MC_MARK_ROOTS],
current_.scopes[Scope::MC_MARK_MAIN], current_.scopes[Scope::MC_MARK_MAIN],
current_.scopes[Scope::MC_MARK_WEAK_CLOSURE], current_.scopes[Scope::MC_MARK_WEAK_CLOSURE],
current_.scopes[Scope::MC_MARK_WEAK_CLOSURE_EPHEMERAL], current_.scopes[Scope::MC_MARK_WEAK_CLOSURE_EPHEMERON],
current_.scopes[Scope::MC_MARK_WEAK_CLOSURE_WEAK_HANDLES], current_.scopes[Scope::MC_MARK_WEAK_CLOSURE_WEAK_HANDLES],
current_.scopes[Scope::MC_MARK_WEAK_CLOSURE_WEAK_ROOTS], current_.scopes[Scope::MC_MARK_WEAK_CLOSURE_WEAK_ROOTS],
current_.scopes[Scope::MC_MARK_WEAK_CLOSURE_HARMONY], current_.scopes[Scope::MC_MARK_WEAK_CLOSURE_HARMONY],
......
...@@ -516,16 +516,16 @@ void Heap::PrintRetainingPath(HeapObject* target, RetainingPathOption option) { ...@@ -516,16 +516,16 @@ void Heap::PrintRetainingPath(HeapObject* target, RetainingPathOption option) {
HeapObject* object = target; HeapObject* object = target;
std::vector<std::pair<HeapObject*, bool>> retaining_path; std::vector<std::pair<HeapObject*, bool>> retaining_path;
Root root = Root::kUnknown; Root root = Root::kUnknown;
bool ephemeral = false; bool ephemeron = false;
while (true) { while (true) {
retaining_path.push_back(std::make_pair(object, ephemeral)); retaining_path.push_back(std::make_pair(object, ephemeron));
if (option == RetainingPathOption::kTrackEphemeralPath && if (option == RetainingPathOption::kTrackEphemeronPath &&
ephemeral_retainer_.count(object)) { ephemeron_retainer_.count(object)) {
object = ephemeral_retainer_[object]; object = ephemeron_retainer_[object];
ephemeral = true; ephemeron = true;
} else if (retainer_.count(object)) { } else if (retainer_.count(object)) {
object = retainer_[object]; object = retainer_[object];
ephemeral = false; ephemeron = false;
} else { } else {
if (retaining_root_.count(object)) { if (retaining_root_.count(object)) {
root = retaining_root_[object]; root = retaining_root_[object];
...@@ -536,11 +536,11 @@ void Heap::PrintRetainingPath(HeapObject* target, RetainingPathOption option) { ...@@ -536,11 +536,11 @@ void Heap::PrintRetainingPath(HeapObject* target, RetainingPathOption option) {
int distance = static_cast<int>(retaining_path.size()); int distance = static_cast<int>(retaining_path.size());
for (auto node : retaining_path) { for (auto node : retaining_path) {
HeapObject* object = node.first; HeapObject* object = node.first;
bool ephemeral = node.second; bool ephemeron = node.second;
PrintF("\n"); PrintF("\n");
PrintF("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"); PrintF("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
PrintF("Distance from root %d%s: ", distance, PrintF("Distance from root %d%s: ", distance,
ephemeral ? " (ephemeral)" : ""); ephemeron ? " (ephemeron)" : "");
object->ShortPrint(); object->ShortPrint();
PrintF("\n"); PrintF("\n");
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
...@@ -561,20 +561,20 @@ void Heap::AddRetainer(HeapObject* retainer, HeapObject* object) { ...@@ -561,20 +561,20 @@ void Heap::AddRetainer(HeapObject* retainer, HeapObject* object) {
RetainingPathOption option = RetainingPathOption::kDefault; RetainingPathOption option = RetainingPathOption::kDefault;
if (IsRetainingPathTarget(object, &option)) { if (IsRetainingPathTarget(object, &option)) {
// Check if the retaining path was already printed in // Check if the retaining path was already printed in
// AddEphemeralRetainer(). // AddEphemeronRetainer().
if (ephemeral_retainer_.count(object) == 0 || if (ephemeron_retainer_.count(object) == 0 ||
option == RetainingPathOption::kDefault) { option == RetainingPathOption::kDefault) {
PrintRetainingPath(object, option); PrintRetainingPath(object, option);
} }
} }
} }
void Heap::AddEphemeralRetainer(HeapObject* retainer, HeapObject* object) { void Heap::AddEphemeronRetainer(HeapObject* retainer, HeapObject* object) {
if (ephemeral_retainer_.count(object)) return; if (ephemeron_retainer_.count(object)) return;
ephemeral_retainer_[object] = retainer; ephemeron_retainer_[object] = retainer;
RetainingPathOption option = RetainingPathOption::kDefault; RetainingPathOption option = RetainingPathOption::kDefault;
if (IsRetainingPathTarget(object, &option) && if (IsRetainingPathTarget(object, &option) &&
option == RetainingPathOption::kTrackEphemeralPath) { option == RetainingPathOption::kTrackEphemeronPath) {
// Check if the retaining path was already printed in AddRetainer(). // Check if the retaining path was already printed in AddRetainer().
if (retainer_.count(object) == 0) { if (retainer_.count(object) == 0) {
PrintRetainingPath(object, option); PrintRetainingPath(object, option);
...@@ -635,7 +635,7 @@ void Heap::GarbageCollectionPrologue() { ...@@ -635,7 +635,7 @@ void Heap::GarbageCollectionPrologue() {
UpdateNewSpaceAllocationCounter(); UpdateNewSpaceAllocationCounter();
if (FLAG_track_retaining_path) { if (FLAG_track_retaining_path) {
retainer_.clear(); retainer_.clear();
ephemeral_retainer_.clear(); ephemeron_retainer_.clear();
retaining_root_.clear(); retaining_root_.clear();
} }
} }
......
...@@ -474,7 +474,7 @@ enum class FixedArrayVisitationMode { kRegular, kIncremental }; ...@@ -474,7 +474,7 @@ enum class FixedArrayVisitationMode { kRegular, kIncremental };
enum class TraceRetainingPathMode { kEnabled, kDisabled }; enum class TraceRetainingPathMode { kEnabled, kDisabled };
enum class RetainingPathOption { kDefault, kTrackEphemeralPath }; enum class RetainingPathOption { kDefault, kTrackEphemeronPath };
enum class GarbageCollectionReason { enum class GarbageCollectionReason {
kUnknown = 0, kUnknown = 0,
...@@ -2177,7 +2177,7 @@ class Heap { ...@@ -2177,7 +2177,7 @@ class Heap {
// =========================================================================== // ===========================================================================
void AddRetainer(HeapObject* retainer, HeapObject* object); void AddRetainer(HeapObject* retainer, HeapObject* object);
void AddEphemeralRetainer(HeapObject* retainer, HeapObject* object); void AddEphemeronRetainer(HeapObject* retainer, HeapObject* object);
void AddRetainingRoot(Root root, HeapObject* object); void AddRetainingRoot(Root root, HeapObject* object);
// Returns true if the given object is a target of retaining path tracking. // Returns true if the given object is a target of retaining path tracking.
// Stores the option corresponding to the object in the provided *option. // Stores the option corresponding to the object in the provided *option.
...@@ -2469,7 +2469,7 @@ class Heap { ...@@ -2469,7 +2469,7 @@ class Heap {
std::map<HeapObject*, Root> retaining_root_; std::map<HeapObject*, Root> retaining_root_;
// If an object is retained by an ephemeron, then the retaining key of the // If an object is retained by an ephemeron, then the retaining key of the
// ephemeron is stored in this map. // ephemeron is stored in this map.
std::map<HeapObject*, HeapObject*> ephemeral_retainer_; std::map<HeapObject*, HeapObject*> ephemeron_retainer_;
// For each index inthe retaining_path_targets_ array this map // For each index inthe retaining_path_targets_ array this map
// stores the option of the corresponding target. // stores the option of the corresponding target.
std::map<int, RetainingPathOption> retaining_path_target_option_; std::map<int, RetainingPathOption> retaining_path_target_option_;
......
...@@ -1472,7 +1472,7 @@ void MarkCompactCollector::ProcessMarkingWorklist() { ...@@ -1472,7 +1472,7 @@ void MarkCompactCollector::ProcessMarkingWorklist() {
DCHECK(marking_worklist()->IsBailoutEmpty()); DCHECK(marking_worklist()->IsBailoutEmpty());
} }
void MarkCompactCollector::ProcessEphemeralMarking() { void MarkCompactCollector::ProcessEphemeronMarking() {
DCHECK(marking_worklist()->IsEmpty()); DCHECK(marking_worklist()->IsEmpty());
bool work_to_do = true; bool work_to_do = true;
while (work_to_do) { while (work_to_do) {
...@@ -1587,8 +1587,8 @@ void MarkCompactCollector::MarkLiveObjects() { ...@@ -1587,8 +1587,8 @@ void MarkCompactCollector::MarkLiveObjects() {
// harmony weak maps. // harmony weak maps.
{ {
TRACE_GC(heap()->tracer(), TRACE_GC(heap()->tracer(),
GCTracer::Scope::MC_MARK_WEAK_CLOSURE_EPHEMERAL); GCTracer::Scope::MC_MARK_WEAK_CLOSURE_EPHEMERON);
ProcessEphemeralMarking(); ProcessEphemeronMarking();
DCHECK(marking_worklist()->IsEmpty()); DCHECK(marking_worklist()->IsEmpty());
} }
...@@ -1617,10 +1617,10 @@ void MarkCompactCollector::MarkLiveObjects() { ...@@ -1617,10 +1617,10 @@ void MarkCompactCollector::MarkLiveObjects() {
ProcessMarkingWorklist(); ProcessMarkingWorklist();
} }
// Repeat ephemeral processing from the newly marked objects. // Repeat ephemeron processing from the newly marked objects.
{ {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WEAK_CLOSURE_HARMONY); TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WEAK_CLOSURE_HARMONY);
ProcessEphemeralMarking(); ProcessEphemeronMarking();
{ {
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_EPILOGUE); TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_EPILOGUE);
heap()->local_embedder_heap_tracer()->TraceEpilogue(); heap()->local_embedder_heap_tracer()->TraceEpilogue();
...@@ -1866,7 +1866,7 @@ void MarkCompactCollector::ProcessWeakCollections() { ...@@ -1866,7 +1866,7 @@ void MarkCompactCollector::ProcessWeakCollections() {
EphemeronHashTable::EntryToValueIndex(i)); EphemeronHashTable::EntryToValueIndex(i));
if (V8_UNLIKELY(FLAG_track_retaining_path) && if (V8_UNLIKELY(FLAG_track_retaining_path) &&
(*value_slot)->IsHeapObject()) { (*value_slot)->IsHeapObject()) {
heap()->AddEphemeralRetainer(heap_object, heap()->AddEphemeronRetainer(heap_object,
HeapObject::cast(*value_slot)); HeapObject::cast(*value_slot));
} }
visitor.VisitPointer(table, value_slot); visitor.VisitPointer(table, value_slot);
......
...@@ -675,7 +675,7 @@ class MarkCompactCollector final : public MarkCompactCollectorBase { ...@@ -675,7 +675,7 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
void MarkStringTable(ObjectVisitor* visitor); void MarkStringTable(ObjectVisitor* visitor);
// Marks object reachable from harmony weak maps and wrapper tracing. // Marks object reachable from harmony weak maps and wrapper tracing.
void ProcessEphemeralMarking(); void ProcessEphemeronMarking();
// If the call-site of the top optimized code was not prepared for // If the call-site of the top optimized code was not prepared for
// deoptimization, then treat embedded pointers in the code as strong as // deoptimization, then treat embedded pointers in the code as strong as
......
...@@ -620,13 +620,13 @@ RUNTIME_FUNCTION(Runtime_DebugTrackRetainingPath) { ...@@ -620,13 +620,13 @@ RUNTIME_FUNCTION(Runtime_DebugTrackRetainingPath) {
RetainingPathOption option = RetainingPathOption::kDefault; RetainingPathOption option = RetainingPathOption::kDefault;
if (args.length() == 2) { if (args.length() == 2) {
CONVERT_ARG_HANDLE_CHECKED(String, str, 1); CONVERT_ARG_HANDLE_CHECKED(String, str, 1);
const char track_ephemeral_path[] = "track-ephemeral-path"; const char track_ephemeron_path[] = "track-ephemeron-path";
if (str->IsOneByteEqualTo(STATIC_CHAR_VECTOR(track_ephemeral_path))) { if (str->IsOneByteEqualTo(STATIC_CHAR_VECTOR(track_ephemeron_path))) {
option = RetainingPathOption::kTrackEphemeralPath; option = RetainingPathOption::kTrackEphemeronPath;
} else if (str->length() != 0) { } else if (str->length() != 0) {
PrintF("Unexpected second argument of DebugTrackRetainingPath.\n"); PrintF("Unexpected second argument of DebugTrackRetainingPath.\n");
PrintF("Expected an empty string or '%s', got '%s'.\n", PrintF("Expected an empty string or '%s', got '%s'.\n",
track_ephemeral_path, str->ToCString().get()); track_ephemeron_path, str->ToCString().get());
} }
} }
isolate->heap()->AddRetainingPathTarget(object, option); isolate->heap()->AddRetainingPathTarget(object, option);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment