Chromium Code Reviews| Index: test/cctest/test-feedback-vector.cc |
| diff --git a/test/cctest/test-feedback-vector.cc b/test/cctest/test-feedback-vector.cc |
| index b982c0f02b75a213484f24eeaee5d52b0ee4bf3f..c6ff79673663c90dbc5c239f943c6ed8f1e5c231 100644 |
| --- a/test/cctest/test-feedback-vector.cc |
| +++ b/test/cctest/test-feedback-vector.cc |
| @@ -416,9 +416,11 @@ TEST(ReferenceContextAllocatesNoSlots) { |
| // There should be two LOAD_ICs, one for a and one for y at the end. |
| Handle<TypeFeedbackVector> feedback_vector = |
| handle(f->shared()->feedback_vector(), isolate); |
| - CHECK_EQ(2, feedback_vector->ICSlots()); |
| - CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(0)) == Code::LOAD_IC); |
| - CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(1)) == Code::LOAD_IC); |
| + CHECK_EQ(FLAG_vector_stores ? 4 : 2, feedback_vector->ICSlots()); |
|
Jakob Kummerow
2015/09/03 11:27:40
suggestion:
if (FLAG_vector_stores) {
CHECK_EQ(
mvstanton
2015/09/03 15:25:27
I like it, done.
|
| + int index = FLAG_vector_stores ? 1 : 0; |
| + CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(index)) == Code::LOAD_IC); |
| + index = FLAG_vector_stores ? 3 : 1; |
| + CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(index)) == Code::LOAD_IC); |
| CompileRun( |
| "function testprop(x) {" |
| @@ -430,7 +432,7 @@ TEST(ReferenceContextAllocatesNoSlots) { |
| // There should be one LOAD_IC, for the load of a. |
| feedback_vector = handle(f->shared()->feedback_vector(), isolate); |
| - CHECK_EQ(1, feedback_vector->ICSlots()); |
| + CHECK_EQ(FLAG_vector_stores ? 2 : 1, feedback_vector->ICSlots()); |
| CompileRun( |
| "function testpropfunc(x) {" |
| @@ -444,11 +446,13 @@ TEST(ReferenceContextAllocatesNoSlots) { |
| // There should be 2 LOAD_ICs and 2 CALL_ICs. |
| feedback_vector = handle(f->shared()->feedback_vector(), isolate); |
| - CHECK_EQ(4, feedback_vector->ICSlots()); |
| + CHECK_EQ(FLAG_vector_stores ? 5 : 4, feedback_vector->ICSlots()); |
| CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(0)) == Code::CALL_IC); |
| CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(1)) == Code::LOAD_IC); |
| - CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(2)) == Code::CALL_IC); |
| - CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(3)) == Code::LOAD_IC); |
| + CHECK(feedback_vector->GetKind( |
| + FeedbackVectorICSlot(FLAG_vector_stores ? 3 : 2)) == Code::CALL_IC); |
|
Jakob Kummerow
2015/09/03 11:27:40
suggestion:
int slot = 0;
CHECK(...(FeedbackVecto
mvstanton
2015/09/03 15:25:27
Allow me to follow up on this suggestion in a foll
|
| + CHECK(feedback_vector->GetKind( |
| + FeedbackVectorICSlot(FLAG_vector_stores ? 4 : 3)) == Code::LOAD_IC); |
| CompileRun( |
| "function testkeyedprop(x) {" |
| @@ -462,10 +466,10 @@ TEST(ReferenceContextAllocatesNoSlots) { |
| // There should be 1 LOAD_ICs for the load of a, and one KEYED_LOAD_IC for the |
| // load of x[0] in the return statement. |
| feedback_vector = handle(f->shared()->feedback_vector(), isolate); |
| - CHECK_EQ(2, feedback_vector->ICSlots()); |
| + CHECK_EQ(FLAG_vector_stores ? 3 : 2, feedback_vector->ICSlots()); |
| CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(0)) == Code::LOAD_IC); |
| - CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(1)) == |
| - Code::KEYED_LOAD_IC); |
| + CHECK(feedback_vector->GetKind(FeedbackVectorICSlot( |
| + FLAG_vector_stores ? 2 : 1)) == Code::KEYED_LOAD_IC); |
| CompileRun( |
| "function testcompound(x) {" |
| @@ -478,9 +482,41 @@ TEST(ReferenceContextAllocatesNoSlots) { |
| // There should be 3 LOAD_ICs, for load of a and load of x.old and x.young. |
| feedback_vector = handle(f->shared()->feedback_vector(), isolate); |
| - CHECK_EQ(3, feedback_vector->ICSlots()); |
| + CHECK_EQ(FLAG_vector_stores ? 6 : 3, feedback_vector->ICSlots()); |
| CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(0)) == Code::LOAD_IC); |
| - CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(1)) == Code::LOAD_IC); |
| - CHECK(feedback_vector->GetKind(FeedbackVectorICSlot(2)) == Code::LOAD_IC); |
| + CHECK(feedback_vector->GetKind( |
| + FeedbackVectorICSlot(FLAG_vector_stores ? 4 : 1)) == Code::LOAD_IC); |
| + CHECK(feedback_vector->GetKind( |
| + FeedbackVectorICSlot(FLAG_vector_stores ? 5 : 2)) == Code::LOAD_IC); |
| +} |
| + |
| + |
| +TEST(VectorStoreICBasic) { |
| + if (i::FLAG_always_opt) return; |
| + if (!i::FLAG_vector_stores) return; |
| + |
| + CcTest::InitializeVM(); |
| + LocalContext context; |
| + v8::HandleScope scope(context->GetIsolate()); |
| + Isolate* isolate = CcTest::i_isolate(); |
| + |
| + // Function f has 3 LoadICs, one for each o, but the ICs share the same |
|
Jakob Kummerow
2015/09/03 11:27:40
lolwut?
mvstanton
2015/09/03 15:25:27
Cosmically weird comment removed :).
|
| + // feedback vector IC slot. |
| + CompileRun( |
| + "function f(a) {" |
| + " a.foo = 5;" |
| + "}" |
| + "var a = { foo: 3 };" |
| + "f(a);" |
| + "f(a);" |
| + "f(a);"); |
| + Handle<JSFunction> f = GetFunction("f"); |
| + // There should be one IC slot. |
| + Handle<TypeFeedbackVector> feedback_vector = |
| + Handle<TypeFeedbackVector>(f->shared()->feedback_vector(), isolate); |
| + CHECK_EQ(1, feedback_vector->ICSlots()); |
| + FeedbackVectorICSlot slot(0); |
| + StoreICNexus nexus(feedback_vector, slot); |
| + CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); |
| } |
| } |