OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 cur_line++; | 48 cur_line++; |
49 } | 49 } |
50 tkit.Advance(); | 50 tkit.Advance(); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 void CodeCoverage::CompileAndAdd(const Function& function, | 55 void CodeCoverage::CompileAndAdd(const Function& function, |
56 const JSONArray& hits_arr, | 56 const JSONArray& hits_arr, |
57 const GrowableArray<intptr_t>& pos_to_line) { | 57 const GrowableArray<intptr_t>& pos_to_line) { |
58 Isolate* isolate = Isolate::Current(); | 58 Thread* thread = Thread::Current(); |
| 59 Zone* zone = thread->zone(); |
| 60 Isolate* isolate = thread->isolate(); |
59 if (!function.HasCode()) { | 61 if (!function.HasCode()) { |
60 // If the function should not be compiled or if the compilation failed, | 62 // If the function should not be compiled or if the compilation failed, |
61 // then just skip this method. | 63 // then just skip this method. |
62 // TODO(iposva): Maybe we should skip synthesized methods in general too. | 64 // TODO(iposva): Maybe we should skip synthesized methods in general too. |
63 if (function.is_abstract() || function.IsRedirectingFactory()) { | 65 if (function.is_abstract() || function.IsRedirectingFactory()) { |
64 return; | 66 return; |
65 } | 67 } |
66 if (function.IsNonImplicitClosureFunction() && | 68 if (function.IsNonImplicitClosureFunction() && |
67 (function.context_scope() == ContextScope::null())) { | 69 (function.context_scope() == ContextScope::null())) { |
68 // TODO(iposva): This can arise if we attempt to compile an inner function | 70 // TODO(iposva): This can arise if we attempt to compile an inner function |
69 // before we have compiled its enclosing function or if the enclosing | 71 // before we have compiled its enclosing function or if the enclosing |
70 // function failed to compile. | 72 // function failed to compile. |
71 return; | 73 return; |
72 } | 74 } |
73 const Error& err = Error::Handle( | 75 const Error& err = Error::Handle( |
74 isolate, Compiler::CompileFunction(isolate, function)); | 76 zone, Compiler::CompileFunction(thread, function)); |
75 if (!err.IsNull()) { | 77 if (!err.IsNull()) { |
76 return; | 78 return; |
77 } | 79 } |
78 } | 80 } |
79 ASSERT(function.HasCode()); | 81 ASSERT(function.HasCode()); |
80 | 82 |
81 // Print the hit counts for all IC datas. | 83 // Print the hit counts for all IC datas. |
82 ZoneGrowableArray<const ICData*>* ic_data_array = | 84 ZoneGrowableArray<const ICData*>* ic_data_array = |
83 new(isolate) ZoneGrowableArray<const ICData*>(); | 85 new(zone) ZoneGrowableArray<const ICData*>(); |
84 function.RestoreICDataMap(ic_data_array); | 86 function.RestoreICDataMap(ic_data_array); |
85 const Code& code = Code::Handle(function.unoptimized_code()); | 87 const Code& code = Code::Handle(function.unoptimized_code()); |
86 const PcDescriptors& descriptors = PcDescriptors::Handle( | 88 const PcDescriptors& descriptors = PcDescriptors::Handle( |
87 code.pc_descriptors()); | 89 code.pc_descriptors()); |
88 | 90 |
89 const intptr_t begin_pos = function.token_pos(); | 91 const intptr_t begin_pos = function.token_pos(); |
90 const intptr_t end_pos = function.end_token_pos(); | 92 const intptr_t end_pos = function.end_token_pos(); |
91 intptr_t last_line = -1; | 93 intptr_t last_line = -1; |
92 intptr_t last_count = 0; | 94 intptr_t last_count = 0; |
93 // Only IC based calls have counting. | 95 // Only IC based calls have counting. |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 cls = it.GetNextClass(); | 282 cls = it.GetNextClass(); |
281 ASSERT(!cls.IsNull()); | 283 ASSERT(!cls.IsNull()); |
282 PrintClass(lib, cls, jsarr, filter); | 284 PrintClass(lib, cls, jsarr, filter); |
283 } | 285 } |
284 } | 286 } |
285 } | 287 } |
286 } | 288 } |
287 | 289 |
288 | 290 |
289 } // namespace dart | 291 } // namespace dart |
OLD | NEW |