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

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

Issue 1041863002: Use counter for legacy const. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ready for review 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
« src/parser.cc ('K') | « src/parser.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-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 5b19746f937b043524f77b260d7ad32de8ed295c..69690261932d8eba45a3827d0227bc4ecdcb61a6 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -3441,6 +3441,25 @@ TEST(UseAsmUseCount) {
}
+TEST(UseConstLegacyCount) {
+ i::Isolate* isolate = CcTest::i_isolate();
+ i::HandleScope scope(isolate);
+ LocalContext env;
+ int use_counts[v8::Isolate::kUseCounterFeatureCount] = {};
+ global_use_counts = use_counts;
+ CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback);
+ CompileRun(
+ "const x = 1;\n"
+ "var foo = 1;\n"
+ "const y = 1;\n"
+ "function bar() {\n"
+ " const z = 1; var baz = 1;\n"
+ " function q() { const k = 42; }\n"
+ "}");
+ CHECK_EQ(4, use_counts[v8::Isolate::kLegacyConst]);
+}
+
+
TEST(ErrorsArrowFunctions) {
// Tests that parser and preparser generate the same kind of errors
// on invalid arrow function syntax.
« src/parser.cc ('K') | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698