Commit 85805293 authored by Ulan Degenbaev's avatar Ulan Degenbaev Committed by Commit Bot

[heap] Remove clearing of caches and counter of shared function info in

marking visitors.

This makes incremental and concurrent visitors of share function infos
side-effect free.

BUG=chromium:694255

Change-Id: I85ee7bac17f17bdbc101ef64ecfb46020b5b3458
Reviewed-on: https://chromium-review.googlesource.com/574851
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46796}
parent b30ea164
......@@ -186,18 +186,6 @@ class ConcurrentMarkingVisitor final
return 0;
}
int VisitSharedFunctionInfo(Map* map, SharedFunctionInfo* object) {
if (ObjectMarking::IsGrey<AccessMode::ATOMIC>(object,
marking_state(object))) {
int size = SharedFunctionInfo::BodyDescriptorWeak::SizeOf(map, object);
VisitMapPointer(object, object->map_slot());
SharedFunctionInfo::BodyDescriptorWeak::IterateBody(object, size, this);
// Resetting of IC age counter is done on the main thread.
bailout_.Push(object);
}
return 0;
}
int VisitTransitionArray(Map* map, TransitionArray* object) {
// TODO(ulan): implement iteration of strong fields.
bailout_.Push(object);
......
......@@ -1063,6 +1063,15 @@ class MarkCompactMarkingVisitor final
}
}
int VisitSharedFunctionInfo(Map* map, SharedFunctionInfo* sfi) {
if (sfi->ic_age() != heap_->global_ic_age()) {
sfi->ResetForNewContext(heap_->global_ic_age());
}
int size = SharedFunctionInfo::BodyDescriptor::SizeOf(map, sfi);
SharedFunctionInfo::BodyDescriptor::IterateBody(sfi, size, this);
return size;
}
// Marks the object black and pushes it on the marking stack.
V8_INLINE void MarkObject(HeapObject* host, HeapObject* object) {
collector_->MarkObject(host, object);
......
......@@ -277,18 +277,6 @@ int MarkingVisitor<ConcreteVisitor>::VisitJSWeakCollection(
return size;
}
template <typename ConcreteVisitor>
int MarkingVisitor<ConcreteVisitor>::VisitSharedFunctionInfo(
Map* map, SharedFunctionInfo* sfi) {
ConcreteVisitor* visitor = static_cast<ConcreteVisitor*>(this);
if (sfi->ic_age() != heap_->global_ic_age()) {
sfi->ResetForNewContext(heap_->global_ic_age());
}
int size = SharedFunctionInfo::BodyDescriptor::SizeOf(map, sfi);
SharedFunctionInfo::BodyDescriptor::IterateBody(sfi, size, visitor);
return size;
}
template <typename ConcreteVisitor>
int MarkingVisitor<ConcreteVisitor>::VisitBytecodeArray(Map* map,
BytecodeArray* array) {
......
......@@ -123,7 +123,6 @@ class MarkingVisitor : public HeapVisitor<int, ConcreteVisitor> {
V8_INLINE int VisitTransitionArray(Map* map, TransitionArray* object);
V8_INLINE int VisitNativeContext(Map* map, Context* object);
V8_INLINE int VisitJSWeakCollection(Map* map, JSWeakCollection* object);
V8_INLINE int VisitSharedFunctionInfo(Map* map, SharedFunctionInfo* object);
V8_INLINE int VisitBytecodeArray(Map* map, BytecodeArray* object);
V8_INLINE int VisitCode(Map* map, Code* object);
V8_INLINE int VisitMap(Map* map, Map* object);
......
......@@ -2222,52 +2222,6 @@ TEST(InstanceOfStubWriteBarrier) {
CcTest::CollectGarbage(OLD_SPACE);
}
TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {
if (!FLAG_incremental_marking) return;
FLAG_stress_compaction = false;
FLAG_stress_incremental_marking = false;
FLAG_allow_natives_syntax = true;
#ifdef VERIFY_HEAP
FLAG_verify_heap = true;
#endif
CcTest::InitializeVM();
if (!CcTest::i_isolate()->use_optimizer()) return;
v8::HandleScope outer_scope(CcTest::isolate());
v8::Local<v8::Context> ctx = CcTest::isolate()->GetCurrentContext();
{
v8::HandleScope scope(CcTest::isolate());
CompileRun(
"function f () {"
" var s = 0;"
" for (var i = 0; i < 100; i++) s += i;"
" return s;"
"}"
"f(); f();"
"%OptimizeFunctionOnNextCall(f);"
"f();");
}
i::Handle<JSFunction> f = i::Handle<JSFunction>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked())));
CHECK(f->IsOptimized());
// Make sure incremental marking it not running.
CcTest::heap()->incremental_marking()->Stop();
CcTest::heap()->StartIncrementalMarking(i::Heap::kNoGCFlags,
i::GarbageCollectionReason::kTesting);
// The following calls will increment CcTest::heap()->global_ic_age().
CcTest::isolate()->ContextDisposedNotification();
heap::SimulateIncrementalMarking(CcTest::heap());
CcTest::CollectAllGarbage();
CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age());
CHECK_EQ(0, f->shared()->opt_count());
CHECK_EQ(0, f->shared()->profiler_ticks());
}
TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) {
FLAG_stress_compaction = false;
......
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