| Index: test/cctest/test-heap.cc
|
| diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
|
| index a79fbdcc55f8b765521db6269872566652fe3ada..5d568e25c13534b84c1ddfea196a8cafc1921af5 100644
|
| --- a/test/cctest/test-heap.cc
|
| +++ b/test/cctest/test-heap.cc
|
| @@ -3872,8 +3872,14 @@ static void CheckVectorIC(Handle<JSFunction> f, int ic_slot_index,
|
| Handle<TypeFeedbackVector> vector =
|
| Handle<TypeFeedbackVector>(f->shared()->feedback_vector());
|
| FeedbackVectorICSlot slot(ic_slot_index);
|
| - LoadICNexus nexus(vector, slot);
|
| - CHECK(nexus.StateFromFeedback() == desired_state);
|
| + if (vector->GetKind(slot) == Code::LOAD_IC) {
|
| + LoadICNexus nexus(vector, slot);
|
| + CHECK(nexus.StateFromFeedback() == desired_state);
|
| + } else {
|
| + CHECK(vector->GetKind(slot) == Code::KEYED_LOAD_IC);
|
| + KeyedLoadICNexus nexus(vector, slot);
|
| + CHECK(nexus.StateFromFeedback() == desired_state);
|
| + }
|
| }
|
|
|
|
|
| @@ -3886,6 +3892,38 @@ static void CheckVectorICCleared(Handle<JSFunction> f, int ic_slot_index) {
|
| }
|
|
|
|
|
| +TEST(ICInBuiltInIsClearedAppropriately) {
|
| + if (i::FLAG_always_opt) return;
|
| + CcTest::InitializeVM();
|
| + v8::HandleScope scope(CcTest::isolate());
|
| +
|
| + Handle<JSFunction> apply;
|
| + {
|
| + LocalContext env;
|
| + v8::Local<v8::Value> res = CompileRun("Function.apply");
|
| + Handle<JSObject> maybe_apply =
|
| + v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
| + apply = Handle<JSFunction>::cast(maybe_apply);
|
| + TypeFeedbackVector* vector = apply->shared()->feedback_vector();
|
| + CHECK(vector->ICSlots() == 1);
|
| + CheckVectorIC(apply, 0, UNINITIALIZED);
|
| + CompileRun(
|
| + "function b(a1, a2, a3) { return a1 + a2 + a3; }"
|
| + "function fun(bar) { bar.apply({}, [1, 2, 3]); };"
|
| + "fun(b); fun(b)");
|
| + CheckVectorIC(apply, 0, MONOMORPHIC);
|
| + }
|
| +
|
| + // Fire context dispose notification.
|
| + CcTest::isolate()->ContextDisposedNotification();
|
| + SimulateIncrementalMarking(CcTest::heap());
|
| + CcTest::heap()->CollectAllGarbage();
|
| +
|
| + // The IC in apply has been cleared, ready to learn again.
|
| + CheckVectorIC(apply, 0, PREMONOMORPHIC);
|
| +}
|
| +
|
| +
|
| TEST(IncrementalMarkingPreservesMonomorphicConstructor) {
|
| if (i::FLAG_always_opt) return;
|
| CcTest::InitializeVM();
|
| @@ -6441,6 +6479,5 @@ TEST(ContextMeasure) {
|
| CHECK_LE(measure.Count(), count_upper_limit);
|
| CHECK_LE(measure.Size(), size_upper_limit);
|
| }
|
| -
|
| } // namespace internal
|
| } // namespace v8
|
|
|