Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Unified Diff: test/cctest/test-heap.cc

Issue 1363883002: Version 4.6.85.21 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.6
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x87/builtins-x87.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/x87/builtins-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698