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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 2062203002: Parser: Report use counts once per feature (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Improve commit message Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3551 matching lines...) Expand 10 before | Expand all | Expand 10 after
3562 3562
3563 TEST(UseAsmUseCount) { 3563 TEST(UseAsmUseCount) {
3564 i::Isolate* isolate = CcTest::i_isolate(); 3564 i::Isolate* isolate = CcTest::i_isolate();
3565 i::HandleScope scope(isolate); 3565 i::HandleScope scope(isolate);
3566 LocalContext env; 3566 LocalContext env;
3567 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; 3567 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {};
3568 global_use_counts = use_counts; 3568 global_use_counts = use_counts;
3569 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); 3569 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback);
3570 CompileRun("\"use asm\";\n" 3570 CompileRun("\"use asm\";\n"
3571 "var foo = 1;\n" 3571 "var foo = 1;\n"
3572 "\"use asm\";\n" // Only the first one counts.
3573 "function bar() { \"use asm\"; var baz = 1; }"); 3572 "function bar() { \"use asm\"; var baz = 1; }");
3574 // Optimizing will double-count because the source is parsed twice. 3573 CHECK_LT(0, use_counts[v8::Isolate::kUseAsm]);
3575 CHECK_EQ(i::FLAG_always_opt ? 4 : 2, use_counts[v8::Isolate::kUseAsm]);
3576 } 3574 }
3577 3575
3578 3576
3579 TEST(StrictModeUseCount) { 3577 TEST(StrictModeUseCount) {
3580 i::Isolate* isolate = CcTest::i_isolate(); 3578 i::Isolate* isolate = CcTest::i_isolate();
3581 i::HandleScope scope(isolate); 3579 i::HandleScope scope(isolate);
3582 LocalContext env; 3580 LocalContext env;
3583 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {}; 3581 int use_counts[v8::Isolate::kUseCounterFeatureCount] = {};
3584 global_use_counts = use_counts; 3582 global_use_counts = use_counts;
3585 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback); 3583 CcTest::isolate()->SetUseCounterCallback(MockUseCounterCallback);
(...skipping 4198 matching lines...) Expand 10 before | Expand all | Expand 10 after
7784 NULL}; 7782 NULL};
7785 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; 7783 static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait};
7786 // The preparser doesn't enforce the restriction, so turn it off. 7784 // The preparser doesn't enforce the restriction, so turn it off.
7787 bool test_preparser = false; 7785 bool test_preparser = false;
7788 RunParserSyncTest(block_context_data, error_data, kError, NULL, 0, 7786 RunParserSyncTest(block_context_data, error_data, kError, NULL, 0,
7789 always_flags, arraysize(always_flags), NULL, 0, false, 7787 always_flags, arraysize(always_flags), NULL, 0, false,
7790 test_preparser); 7788 test_preparser);
7791 RunParserSyncTest(top_level_context_data, error_data, kSuccess, NULL, 0, 7789 RunParserSyncTest(top_level_context_data, error_data, kSuccess, NULL, 0,
7792 always_flags, arraysize(always_flags)); 7790 always_flags, arraysize(always_flags));
7793 } 7791 }
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698