Index: test/cctest/compiler/test-run-intrinsics.cc |
diff --git a/test/cctest/compiler/test-run-intrinsics.cc b/test/cctest/compiler/test-run-intrinsics.cc |
index 65a180c11a054c90df8faf6cda636f55a9359202..411d63da2de6d8cac14b0eb947889b8fbe11c4e8 100644 |
--- a/test/cctest/compiler/test-run-intrinsics.cc |
+++ b/test/cctest/compiler/test-run-intrinsics.cc |
@@ -49,6 +49,32 @@ TEST(HeapObjectGetMap) { |
} |
+#define COUNTER_NAME "hurz" |
+ |
+static int* LookupCounter(const char* name) { |
+ static int counter = 1234; |
+ return strcmp(name, COUNTER_NAME) == 0 ? &counter : nullptr; |
+} |
+ |
+ |
+TEST(IncrementStatsCounter) { |
+ FLAG_turbo_deoptimization = true; |
+ FLAG_native_code_counters = true; |
+ reinterpret_cast<v8::Isolate*>(CcTest::InitIsolateOnce()) |
+ ->SetCounterFunction(LookupCounter); |
+ FunctionTester T( |
+ "(function() { %_IncrementStatsCounter(\"" COUNTER_NAME "\"); })", flags); |
+ StatsCounter counter(T.main_isolate(), COUNTER_NAME); |
+ if (!counter.Enabled()) return; |
+ |
+ int old_value = *counter.GetInternalPointer(); |
+ T.CheckCall(T.undefined()); |
+ CHECK_EQ(old_value + 1, *counter.GetInternalPointer()); |
+} |
+ |
+#undef COUNTER_NAME |
+ |
+ |
TEST(IsArray) { |
FLAG_turbo_deoptimization = true; |
FunctionTester T("(function(a) { return %_IsArray(a); })", flags); |