Revert "[heap] Remove clearing of caches and counter of shared function info in"
This reverts commit 8580529302
.
Reason for revert: increased memory usage on benchmarks.
BUG=chromium:747806
Original change's description:
> [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: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#46796}
TBR=ulan@chromium.org,mlippautz@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: chromium:694255
Change-Id: Id28551ce8378820b0272721b7efb388727c442d4
Reviewed-on: https://chromium-review.googlesource.com/584288
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46864}
This commit is contained in:
parent
796566093c
commit
6e3d7ee6cb
@ -179,6 +179,18 @@ class ConcurrentMarkingVisitor final
|
|||||||
return 0;
|
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) {
|
int VisitTransitionArray(Map* map, TransitionArray* object) {
|
||||||
// TODO(ulan): implement iteration of strong fields.
|
// TODO(ulan): implement iteration of strong fields.
|
||||||
bailout_.Push(object);
|
bailout_.Push(object);
|
||||||
|
@ -1063,15 +1063,6 @@ 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.
|
// Marks the object black and pushes it on the marking stack.
|
||||||
V8_INLINE void MarkObject(HeapObject* host, HeapObject* object) {
|
V8_INLINE void MarkObject(HeapObject* host, HeapObject* object) {
|
||||||
collector_->MarkObject(host, object);
|
collector_->MarkObject(host, object);
|
||||||
|
@ -277,6 +277,18 @@ int MarkingVisitor<ConcreteVisitor>::VisitJSWeakCollection(
|
|||||||
return size;
|
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>
|
template <typename ConcreteVisitor>
|
||||||
int MarkingVisitor<ConcreteVisitor>::VisitBytecodeArray(Map* map,
|
int MarkingVisitor<ConcreteVisitor>::VisitBytecodeArray(Map* map,
|
||||||
BytecodeArray* array) {
|
BytecodeArray* array) {
|
||||||
|
@ -119,6 +119,7 @@ class MarkingVisitor : public HeapVisitor<int, ConcreteVisitor> {
|
|||||||
V8_INLINE int VisitTransitionArray(Map* map, TransitionArray* object);
|
V8_INLINE int VisitTransitionArray(Map* map, TransitionArray* object);
|
||||||
V8_INLINE int VisitNativeContext(Map* map, Context* object);
|
V8_INLINE int VisitNativeContext(Map* map, Context* object);
|
||||||
V8_INLINE int VisitJSWeakCollection(Map* map, JSWeakCollection* 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 VisitBytecodeArray(Map* map, BytecodeArray* object);
|
||||||
V8_INLINE int VisitCode(Map* map, Code* object);
|
V8_INLINE int VisitCode(Map* map, Code* object);
|
||||||
V8_INLINE int VisitMap(Map* map, Map* object);
|
V8_INLINE int VisitMap(Map* map, Map* object);
|
||||||
|
@ -2223,6 +2223,52 @@ TEST(InstanceOfStubWriteBarrier) {
|
|||||||
CcTest::CollectGarbage(OLD_SPACE);
|
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) {
|
TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) {
|
||||||
FLAG_stress_compaction = false;
|
FLAG_stress_compaction = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user