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

Side by Side Diff: runtime/vm/coverage.cc

Issue 294943008: - Landing https://codereview.chromium.org/293963008/ (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/dart_entry.cc » ('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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/coverage.h" 5 #include "vm/coverage.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
11 #include "vm/json_stream.h" 11 #include "vm/json_stream.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 #include "vm/object_store.h" 13 #include "vm/object_store.h"
14 14
15 namespace dart { 15 namespace dart {
16 16
17 DEFINE_FLAG(charp, coverage_dir, NULL, 17 DEFINE_FLAG(charp, coverage_dir, NULL,
18 "Enable writing coverage data into specified directory."); 18 "Enable writing coverage data into specified directory.");
19 19
20 20
21 void CodeCoverage::CompileAndAdd(const Function& function, 21 void CodeCoverage::CompileAndAdd(const Function& function,
22 const JSONArray& hits_arr) { 22 const JSONArray& hits_arr) {
23 Isolate* isolate = Isolate::Current();
23 if (!function.HasCode()) { 24 if (!function.HasCode()) {
24 // If the function should not be compiled or if the compilation failed, 25 // If the function should not be compiled or if the compilation failed,
25 // then just skip this method. 26 // then just skip this method.
26 // TODO(iposva): Maybe we should skip synthesized methods in general too. 27 // TODO(iposva): Maybe we should skip synthesized methods in general too.
27 if (function.is_abstract() || function.IsRedirectingFactory()) { 28 if (function.is_abstract() || function.IsRedirectingFactory()) {
28 return; 29 return;
29 } 30 }
30 if (function.IsNonImplicitClosureFunction() && 31 if (function.IsNonImplicitClosureFunction() &&
31 (function.context_scope() == ContextScope::null())) { 32 (function.context_scope() == ContextScope::null())) {
32 // TODO(iposva): This can arise if we attempt to compile an inner function 33 // TODO(iposva): This can arise if we attempt to compile an inner function
33 // before we have compiled its enclosing function or if the enclosing 34 // before we have compiled its enclosing function or if the enclosing
34 // function failed to compile. 35 // function failed to compile.
35 OS::Print("### Coverage skipped compiling: %s\n", function.ToCString()); 36 OS::Print("### Coverage skipped compiling: %s\n", function.ToCString());
36 return; 37 return;
37 } 38 }
38 const Error& err = Error::Handle(Compiler::CompileFunction(function)); 39 const Error& err = Error::Handle(
40 isolate, Compiler::CompileFunction(isolate, function));
39 if (!err.IsNull()) { 41 if (!err.IsNull()) {
40 OS::Print("### Coverage failed compiling:\n%s\n", err.ToErrorCString()); 42 OS::Print("### Coverage failed compiling:\n%s\n", err.ToErrorCString());
41 return; 43 return;
42 } 44 }
43 } 45 }
44 ASSERT(function.HasCode()); 46 ASSERT(function.HasCode());
45 47
46 Isolate* isolate = Isolate::Current();
47 // Print the hit counts for all IC datas. 48 // Print the hit counts for all IC datas.
48 const Script& script = Script::Handle(function.script()); 49 const Script& script = Script::Handle(function.script());
49 const Code& code = Code::Handle(function.unoptimized_code()); 50 const Code& code = Code::Handle(function.unoptimized_code());
50 const Array& ic_array = Array::Handle(code.ExtractTypeFeedbackArray()); 51 const Array& ic_array = Array::Handle(code.ExtractTypeFeedbackArray());
51 const PcDescriptors& descriptors = PcDescriptors::Handle( 52 const PcDescriptors& descriptors = PcDescriptors::Handle(
52 code.pc_descriptors()); 53 code.pc_descriptors());
53 ICData& ic_data = ICData::Handle(); 54 ICData& ic_data = ICData::Handle();
54 55
55 for (int j = 0; j < descriptors.Length(); j++) { 56 for (int j = 0; j < descriptors.Length(); j++) {
56 HANDLESCOPE(isolate); 57 HANDLESCOPE(isolate);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // functions. 196 // functions.
196 PrintClass(cls, jsarr); 197 PrintClass(cls, jsarr);
197 } 198 }
198 } 199 }
199 } 200 }
200 } 201 }
201 } 202 }
202 203
203 204
204 } // namespace dart 205 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/dart_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698