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

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

Issue 1342013003: Vector ICs: Hook up vectors in platform builtins to their SharedFunctionInfos. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Test and remaining ports. 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/x64/builtins-x64.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 da2f6abfe443c6b243a9133a40cfe2868d5db43d..f82db16e9576dfa2c35e0a3a822b3a9ca947d0cf 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -3909,8 +3909,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);
+ }
}
@@ -3923,6 +3929,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();
@@ -6645,9 +6683,12 @@ TEST(SharedFunctionInfoIterator) {
// Shared function infos without a script (API functions or C++ builtins)
// are not returned by the iterator because they are not created from a
// script. They are not interesting for type feedback vector anyways.
+
+ // TODO(mvstanton): There are builtins that use type feedback vectors,
+ // consider adding these to the iterator.
SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj);
if (shared->script()->IsUndefined()) {
- CHECK_EQ(0, shared->feedback_vector()->ICSlots());
+ CHECK(shared->native() || 0 == shared->feedback_vector()->ICSlots());
} else {
sfi_count++;
}
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698