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

Side by Side Diff: src/debug/debug-coverage.cc

Issue 2744613006: [object] Add Script::IsUserJavaScript(). (Closed)
Patch Set: Rebase. 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/debug/debug.cc ('k') | src/messages.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 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 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 "src/debug/debug-coverage.h" 5 #include "src/debug/debug-coverage.h"
6 6
7 #include "src/base/hashmap.h" 7 #include "src/base/hashmap.h"
8 #include "src/deoptimizer.h" 8 #include "src/deoptimizer.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 if (reset_count) vector->clear_invocation_count(); 87 if (reset_count) vector->clear_invocation_count();
88 counter_map.Add(shared, count); 88 counter_map.Add(shared, count);
89 } 89 }
90 } 90 }
91 91
92 // Iterate shared function infos of every script and build a mapping 92 // Iterate shared function infos of every script and build a mapping
93 // between source ranges and invocation counts. 93 // between source ranges and invocation counts.
94 Coverage* result = new Coverage(); 94 Coverage* result = new Coverage();
95 Script::Iterator scripts(isolate); 95 Script::Iterator scripts(isolate);
96 while (Script* script = scripts.Next()) { 96 while (Script* script = scripts.Next()) {
97 // Dismiss non-user scripts. 97 if (!script->IsUserJavaScript()) continue;
98 if (script->type() != Script::TYPE_NORMAL) continue;
99 98
100 // Create and add new script data. 99 // Create and add new script data.
101 Handle<Script> script_handle(script, isolate); 100 Handle<Script> script_handle(script, isolate);
102 result->emplace_back(isolate, script_handle); 101 result->emplace_back(isolate, script_handle);
103 std::vector<CoverageFunction>* functions = &result->back().functions; 102 std::vector<CoverageFunction>* functions = &result->back().functions;
104 103
105 std::vector<SharedFunctionInfo*> sorted; 104 std::vector<SharedFunctionInfo*> sorted;
106 105
107 { 106 {
108 // Sort functions by start position, from outer to inner functions. 107 // Sort functions by start position, from outer to inner functions.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 ArrayList::New(isolate, static_cast<int>(vectors.size())); 148 ArrayList::New(isolate, static_cast<int>(vectors.size()));
150 for (const auto& vector : vectors) list = ArrayList::Add(list, vector); 149 for (const auto& vector : vectors) list = ArrayList::Add(list, vector);
151 isolate->SetCodeCoverageList(*list); 150 isolate->SetCodeCoverageList(*list);
152 } else { 151 } else {
153 isolate->SetCodeCoverageList(isolate->heap()->undefined_value()); 152 isolate->SetCodeCoverageList(isolate->heap()->undefined_value());
154 } 153 }
155 } 154 }
156 155
157 } // namespace internal 156 } // namespace internal
158 } // namespace v8 157 } // namespace v8
OLDNEW
« no previous file with comments | « src/debug/debug.cc ('k') | src/messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698