Index: test/cctest/heap/test-heap.cc |
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc |
index a4cbed3d95007336897cff8e4af2293995fa9ff2..ada4869feaf8ef21c88d9c4ee5ac2adcd5fc41c7 100644 |
--- a/test/cctest/heap/test-heap.cc |
+++ b/test/cctest/heap/test-heap.cc |
@@ -3678,6 +3678,39 @@ |
} |
+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"); |
+ i::Handle<JSReceiver> maybe_apply = |
+ v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)); |
+ apply = i::Handle<JSFunction>::cast(maybe_apply); |
+ i::Handle<TypeFeedbackVector> vector(apply->shared()->feedback_vector()); |
+ FeedbackVectorHelper feedback_helper(vector); |
+ CHECK_EQ(1, feedback_helper.slot_count()); |
+ 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(); |