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

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

Issue 25790004: - Fix typos and add comments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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/lib/string_buffer_patch.dart ('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 (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"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 int i = 0; 68 int i = 0;
69 while (i < functions.Length()) { 69 while (i < functions.Length()) {
70 HANDLESCOPE(isolate); 70 HANDLESCOPE(isolate);
71 function ^= functions.At(i); 71 function ^= functions.At(i);
72 JSONObject jsobj(&jsarr); 72 JSONObject jsobj(&jsarr);
73 script = function.script(); 73 script = function.script();
74 saved_url = script.url(); 74 saved_url = script.url();
75 jsobj.AddProperty("source", saved_url.ToCString()); 75 jsobj.AddProperty("source", saved_url.ToCString());
76 JSONArray hits_arr(&jsobj, "hits"); 76 JSONArray hits_arr(&jsobj, "hits");
77 77
78 // We stay within this loop while we are seeing functions from the same
79 // source URI.
78 while (i < functions.Length()) { 80 while (i < functions.Length()) {
79 function ^= functions.At(i); 81 function ^= functions.At(i);
80 script = function.script(); 82 script = function.script();
81 url = script.url(); 83 url = script.url();
82 if (!url.Equals(saved_url)) { 84 if (!url.Equals(saved_url)) {
83 break; 85 break;
84 } 86 }
85 CompileAndAdd(function, hits_arr); 87 CompileAndAdd(function, hits_arr);
86 i++; 88 i++;
87 } 89 }
88 } 90 }
89 91
90 GrowableObjectArray& closures = GrowableObjectArray::Handle( 92 GrowableObjectArray& closures =
91 cls.closures()); 93 GrowableObjectArray::Handle(cls.closures());
92 if (!closures.IsNull()) { 94 if (!closures.IsNull()) {
93 i = 0; 95 i = 0;
96 // We need to keep rechecking the length of the closures array, as handling
97 // a closure potentially adds new entries to the end.
94 while (i < closures.Length()) { 98 while (i < closures.Length()) {
95 HANDLESCOPE(isolate); 99 HANDLESCOPE(isolate);
96 function ^= closures.At(i); 100 function ^= closures.At(i);
97 JSONObject jsobj(&jsarr); 101 JSONObject jsobj(&jsarr);
98 script = function.script(); 102 script = function.script();
99 saved_url = script.url(); 103 saved_url = script.url();
100 jsobj.AddProperty("source", saved_url.ToCString()); 104 jsobj.AddProperty("source", saved_url.ToCString());
101 JSONArray hits_arr(&jsobj, "hits"); 105 JSONArray hits_arr(&jsobj, "hits");
102 106
107 // We stay within this loop while we are seeing functions from the same
108 // source URI.
103 while (i < closures.Length()) { 109 while (i < closures.Length()) {
104 function ^= closures.At(i); 110 function ^= closures.At(i);
105 script = function.script(); 111 script = function.script();
106 url = script.url(); 112 url = script.url();
107 if (!url.Equals(saved_url)) { 113 if (!url.Equals(saved_url)) {
108 break; 114 break;
109 } 115 }
110 CompileAndAdd(function, hits_arr); 116 CompileAndAdd(function, hits_arr);
111 i++; 117 i++;
112 } 118 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 void* file = (*file_open)(filename, true); 164 void* file = (*file_open)(filename, true);
159 if (file == NULL) { 165 if (file == NULL) {
160 OS::Print("Failed to write coverage file: %s\n", filename); 166 OS::Print("Failed to write coverage file: %s\n", filename);
161 return; 167 return;
162 } 168 }
163 (*file_write)(stream.buffer()->buf(), stream.buffer()->length(), file); 169 (*file_write)(stream.buffer()->buf(), stream.buffer()->length(), file);
164 (*file_close)(file); 170 (*file_close)(file);
165 } 171 }
166 172
167 } // namespace dart 173 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/string_buffer_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698