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

Side by Side Diff: src/d8.cc

Issue 2766573003: [debug] introduce precise binary code coverage. (Closed)
Patch Set: fix test Created 3 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 unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | src/debug/debug-coverage.h » ('j') | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <errno.h> 5 #include <errno.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <string.h> 7 #include <string.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 std::ofstream dispatch_counters_stream( 1685 std::ofstream dispatch_counters_stream(
1686 i::FLAG_trace_ignition_dispatches_output_file); 1686 i::FLAG_trace_ignition_dispatches_output_file);
1687 dispatch_counters_stream << *String::Utf8Value( 1687 dispatch_counters_stream << *String::Utf8Value(
1688 JSON::Stringify(context, dispatch_counters).ToLocalChecked()); 1688 JSON::Stringify(context, dispatch_counters).ToLocalChecked());
1689 } 1689 }
1690 1690
1691 // Write coverage data in LCOV format. See man page for geninfo(1). 1691 // Write coverage data in LCOV format. See man page for geninfo(1).
1692 void Shell::WriteLcovData(v8::Isolate* isolate, const char* file) { 1692 void Shell::WriteLcovData(v8::Isolate* isolate, const char* file) {
1693 if (!file) return; 1693 if (!file) return;
1694 HandleScope handle_scope(isolate); 1694 HandleScope handle_scope(isolate);
1695 debug::Coverage coverage = debug::Coverage::Collect(isolate, false); 1695 debug::Coverage coverage = debug::Coverage::CollectPrecise(isolate);
1696 std::ofstream sink(file, std::ofstream::app); 1696 std::ofstream sink(file, std::ofstream::app);
1697 for (size_t i = 0; i < coverage.ScriptCount(); i++) { 1697 for (size_t i = 0; i < coverage.ScriptCount(); i++) {
1698 debug::Coverage::ScriptData script_data = coverage.GetScriptData(i); 1698 debug::Coverage::ScriptData script_data = coverage.GetScriptData(i);
1699 Local<debug::Script> script = script_data.GetScript(); 1699 Local<debug::Script> script = script_data.GetScript();
1700 // Skip unnamed scripts. 1700 // Skip unnamed scripts.
1701 Local<String> name; 1701 Local<String> name;
1702 if (!script->Name().ToLocal(&name)) continue; 1702 if (!script->Name().ToLocal(&name)) continue;
1703 std::string file_name = ToSTLString(name); 1703 std::string file_name = ToSTLString(name);
1704 // Skip scripts not backed by a file. 1704 // Skip scripts not backed by a file.
1705 if (!std::ifstream(file_name).good()) continue; 1705 if (!std::ifstream(file_name).good()) continue;
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
3050 } 3050 }
3051 3051
3052 } // namespace v8 3052 } // namespace v8
3053 3053
3054 3054
3055 #ifndef GOOGLE3 3055 #ifndef GOOGLE3
3056 int main(int argc, char* argv[]) { 3056 int main(int argc, char* argv[]) {
3057 return v8::Shell::Main(argc, argv); 3057 return v8::Shell::Main(argc, argv);
3058 } 3058 }
3059 #endif 3059 #endif
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/debug/debug-coverage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698