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 @@
F(MC_MARK_MAIN) \
F(MC_MARK_ROOTS) \
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_ROOTS) \
F(MC_MARK_WEAK_CLOSURE_HARMONY) \
......
......@@ -697,7 +697,7 @@ void GCTracer::PrintNVP() const {
"mark.roots=%.1f "
"mark.main=%.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_roots=%.1f "
"mark.weak_closure.harmony=%.1f "
......@@ -791,7 +791,7 @@ void GCTracer::PrintNVP() const {
current_.scopes[Scope::MC_MARK_ROOTS],
current_.scopes[Scope::MC_MARK_MAIN],
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_ROOTS],
current_.scopes[Scope::MC_MARK_WEAK_CLOSURE_HARMONY],
......
......@@ -516,16 +516,16 @@ void Heap::PrintRetainingPath(HeapObject* target, RetainingPathOption option) {
HeapObject* object = target;
std::vector<std::pair<HeapObject*, bool>> retaining_path;
Root root = Root::kUnknown;
bool ephemeral = false;
bool ephemeron = false;
while (true) {
retaining_path.push_back(std::make_pair(object, ephemeral));
if (option == RetainingPathOption::kTrackEphemeralPath &&
ephemeral_retainer_.count(object)) {
object = ephemeral_retainer_[object];
ephemeral = true;
retaining_path.push_back(std::make_pair(object, ephemeron));
if (option == RetainingPathOption::kTrackEphemeronPath &&
ephemeron_retainer_.count(object)) {
object = ephemeron_retainer_[object];
ephemeron = true;
} else if (retainer_.count(object)) {
object = retainer_[object];
ephemeral = false;
ephemeron = false;
} else {
if (retaining_root_.count(object)) {
root = retaining_root_[object];
......@@ -536,11 +536,11 @@ void Heap::PrintRetainingPath(HeapObject* target, RetainingPathOption option) {
int distance = static_cast<int>(retaining_path.size());
for (auto node : retaining_path) {
HeapObject* object = node.first;
bool ephemeral = node.second;
bool ephemeron = node.second;
PrintF("\n");
PrintF("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
PrintF("Distance from root %d%s: ", distance,
ephemeral ? " (ephemeral)" : "");
ephemeron ? " (ephemeron)" : "");
object->ShortPrint();
PrintF("\n");
#ifdef OBJECT_PRINT
......@@ -561,20 +561,20 @@ void Heap::AddRetainer(HeapObject* retainer, HeapObject* object) {
RetainingPathOption option = RetainingPathOption::kDefault;
if (IsRetainingPathTarget(object, &option)) {
// Check if the retaining path was already printed in
// AddEphemeralRetainer().
if (ephemeral_retainer_.count(object) == 0 ||
// AddEphemeronRetainer().
if (ephemeron_retainer_.count(object) == 0 ||
option == RetainingPathOption::kDefault) {
PrintRetainingPath(object, option);
}
}
}
void Heap::AddEphemeralRetainer(HeapObject* retainer, HeapObject* object) {
if (ephemeral_retainer_.count(object)) return;
ephemeral_retainer_[object] = retainer;
void Heap::AddEphemeronRetainer(HeapObject* retainer, HeapObject* object) {
if (ephemeron_retainer_.count(object)) return;
ephemeron_retainer_[object] = retainer;
RetainingPathOption option = RetainingPathOption::kDefault;
if (IsRetainingPathTarget(object, &option) &&
option == RetainingPathOption::kTrackEphemeralPath) {
option == RetainingPathOption::kTrackEphemeronPath) {
// Check if the retaining path was already printed in AddRetainer().
if (retainer_.count(object) == 0) {
PrintRetainingPath(object, option);
......@@ -635,7 +635,7 @@ void Heap::GarbageCollectionPrologue() {
UpdateNewSpaceAllocationCounter();
if (FLAG_track_retaining_path) {
retainer_.clear();
ephemeral_retainer_.clear();
ephemeron_retainer_.clear();
retaining_root_.clear();
}
}
......
......@@ -474,7 +474,7 @@ enum class FixedArrayVisitationMode { kRegular, kIncremental };
enum class TraceRetainingPathMode { kEnabled, kDisabled };
enum class RetainingPathOption { kDefault, kTrackEphemeralPath };
enum class RetainingPathOption { kDefault, kTrackEphemeronPath };
enum class GarbageCollectionReason {
kUnknown = 0,
......@@ -2177,7 +2177,7 @@ class Heap {
// ===========================================================================
void AddRetainer(HeapObject* retainer, HeapObject* object);
void AddEphemeralRetainer(HeapObject* retainer, HeapObject* object);
void AddEphemeronRetainer(HeapObject* retainer, HeapObject* object);
void AddRetainingRoot(Root root, HeapObject* object);
// Returns true if the given object is a target of retaining path tracking.
// Stores the option corresponding to the object in the provided *option.
......@@ -2469,7 +2469,7 @@ class Heap {
std::map<HeapObject*, Root> retaining_root_;
// If an object is retained by an ephemeron, then the retaining key of the
// 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
// stores the option of the corresponding target.
std::map<int, RetainingPathOption> retaining_path_target_option_;
......
......@@ -1472,7 +1472,7 @@ void MarkCompactCollector::ProcessMarkingWorklist() {
DCHECK(marking_worklist()->IsBailoutEmpty());
}
void MarkCompactCollector::ProcessEphemeralMarking() {
void MarkCompactCollector::ProcessEphemeronMarking() {
DCHECK(marking_worklist()->IsEmpty());
bool work_to_do = true;
while (work_to_do) {
......@@ -1587,8 +1587,8 @@ void MarkCompactCollector::MarkLiveObjects() {
// harmony weak maps.
{
TRACE_GC(heap()->tracer(),
GCTracer::Scope::MC_MARK_WEAK_CLOSURE_EPHEMERAL);
ProcessEphemeralMarking();
GCTracer::Scope::MC_MARK_WEAK_CLOSURE_EPHEMERON);
ProcessEphemeronMarking();
DCHECK(marking_worklist()->IsEmpty());
}
......@@ -1617,10 +1617,10 @@ void MarkCompactCollector::MarkLiveObjects() {
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);
ProcessEphemeralMarking();
ProcessEphemeronMarking();
{
TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_EPILOGUE);
heap()->local_embedder_heap_tracer()->TraceEpilogue();
......@@ -1866,7 +1866,7 @@ void MarkCompactCollector::ProcessWeakCollections() {
EphemeronHashTable::EntryToValueIndex(i));
if (V8_UNLIKELY(FLAG_track_retaining_path) &&
(*value_slot)->IsHeapObject()) {
heap()->AddEphemeralRetainer(heap_object,
heap()->AddEphemeronRetainer(heap_object,
HeapObject::cast(*value_slot));
}
visitor.VisitPointer(table, value_slot);
......
......@@ -675,7 +675,7 @@ class MarkCompactCollector final : public MarkCompactCollectorBase {
void MarkStringTable(ObjectVisitor* visitor);
// 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
// deoptimization, then treat embedded pointers in the code as strong as
......
......@@ -620,13 +620,13 @@ RUNTIME_FUNCTION(Runtime_DebugTrackRetainingPath) {
RetainingPathOption option = RetainingPathOption::kDefault;
if (args.length() == 2) {
CONVERT_ARG_HANDLE_CHECKED(String, str, 1);
const char track_ephemeral_path[] = "track-ephemeral-path";
if (str->IsOneByteEqualTo(STATIC_CHAR_VECTOR(track_ephemeral_path))) {
option = RetainingPathOption::kTrackEphemeralPath;
const char track_ephemeron_path[] = "track-ephemeron-path";
if (str->IsOneByteEqualTo(STATIC_CHAR_VECTOR(track_ephemeron_path))) {
option = RetainingPathOption::kTrackEphemeronPath;
} else if (str->length() != 0) {
PrintF("Unexpected second argument of DebugTrackRetainingPath.\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);
......
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