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

Unified Diff: test/cctest/compiler/test-run-intrinsics.cc

Issue 1031383002: Add %_IncrementStatsCounter intrinsic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/runtime/runtime-internal.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/runtime/runtime-internal.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698