Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 1575559d38261ea41d1125377b18ee13f89c1353..d607d27ecd36580f6cb9611c97215cb91aaa6f39 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -21782,12 +21782,15 @@ int* LookupCounter(const char* name) { |
const char* kMegamorphicTestProgram = |
"function CreateClass(name) {\n" |
" var src = \n" |
- " ` function ${name}() {};` +\n" |
+ " ` function ${name}() { this.a = 0; };` +\n" |
" ` ${name}.prototype.foo = function() {};` +\n" |
" ` ${name};\\n`;\n" |
" return (0, eval)(src);\n" |
"}\n" |
- "function fooify(obj) { obj.foo(); };\n" |
+ "function trigger_ics(obj, v) {\n" |
+ " obj.foo();\n" |
+ " obj.a = v;\n" |
+ "};\n" |
"var objs = [];\n" |
"for (var i = 0; i < 50; i++) {\n" |
" var Class = CreateClass('Class' + i);\n" |
@@ -21796,7 +21799,7 @@ const char* kMegamorphicTestProgram = |
"}\n" |
"for (var i = 0; i < 1000; i++) {\n" |
" for (var obj of objs) {\n" |
- " fooify(obj);\n" |
+ " trigger_ics(obj, i);\n" |
" }\n" |
"}\n"; |
@@ -21832,6 +21835,7 @@ void TestStubCache(bool primary) { |
i::CodeStub::LoadICTF, i::CodeStub::LoadICTrampolineTF, |
i::CodeStub::KeyedLoadIC, i::CodeStub::KeyedLoadICTrampoline, |
i::CodeStub::StoreIC, i::CodeStub::StoreICTrampoline, |
+ i::CodeStub::StoreICTF, i::CodeStub::StoreICTrampolineTF, |
i::CodeStub::KeyedStoreIC, i::CodeStub::KeyedStoreICTrampoline, |
}; |
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
@@ -21852,17 +21856,18 @@ void TestStubCache(bool primary) { |
int updates = updates_counter - initial_updates; |
const int kClassesCount = 50; |
const int kIterationsCount = 1000; |
- CHECK_LE(kClassesCount, updates); |
+ const int kICKinds = 2; // LoadIC and StoreIC |
+ CHECK_LE(kClassesCount * kICKinds, updates); |
// Check that updates and misses counts are bounded. |
// If there are too many updates then most likely the stub cache does not |
// work properly. |
- CHECK_LE(updates, kClassesCount * 2); |
- CHECK_LE(1, misses); |
- CHECK_LE(misses, kClassesCount * 2); |
+ CHECK_LE(updates, kClassesCount * 2 * kICKinds); |
+ CHECK_LE(kICKinds, misses); |
+ CHECK_LE(misses, kClassesCount * 2 * kICKinds); |
// 2 is for PREMONOMORPHIC and MONOMORPHIC states, |
// 4 is for POLYMORPHIC states, |
// and all the others probes are for MEGAMORPHIC state. |
- CHECK_EQ(kIterationsCount * kClassesCount - 2 - 4, probes); |
+ CHECK_EQ((kIterationsCount * kClassesCount - 2 - 4) * kICKinds, probes); |
} |
isolate->Dispose(); |
} |
@@ -21871,21 +21876,33 @@ void TestStubCache(bool primary) { |
UNINITIALIZED_TEST(PrimaryStubCache) { |
i::FLAG_tf_load_ic_stub = false; |
+#if !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_X87 |
Jakob Kummerow
2016/09/26 23:32:30
Why is this still platform specific?
Igor Sheludko
2016/09/27 06:46:05
Forgot to cleanup. Done.
|
+ i::FLAG_tf_store_ic_stub = false; |
+#endif |
TestStubCache(true); |
} |
UNINITIALIZED_TEST(SecondaryStubCache) { |
i::FLAG_tf_load_ic_stub = false; |
+#if !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_X87 |
+ i::FLAG_tf_store_ic_stub = false; |
+#endif |
TestStubCache(false); |
} |
UNINITIALIZED_TEST(PrimaryStubCacheTF) { |
i::FLAG_tf_load_ic_stub = true; |
+#if !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_X87 |
+ i::FLAG_tf_store_ic_stub = true; |
+#endif |
TestStubCache(true); |
} |
UNINITIALIZED_TEST(SecondaryStubCacheTF) { |
i::FLAG_tf_load_ic_stub = true; |
+#if !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_X87 |
+ i::FLAG_tf_store_ic_stub = true; |
+#endif |
TestStubCache(false); |
} |