Commit ed93e7c2 authored by yangguo's avatar yangguo Committed by Commit bot

[debug] use best effort coverage when enabling precise coverage.

We used to clear invocation counts when enabling precise coverage.
This is not necessary, and we could continue to use the existing
invocation counts on the heap. The old behavior can be achieved
by explicitly resetting the counts by polling coverage data.

R=jgruber@chromium.org,caseq@chromium.org
BUG=v8:5808

Review-Url: https://codereview.chromium.org/2768453002
Cr-Commit-Position: refs/heads/master@{#43964}
parent 48e08319
......@@ -140,7 +140,6 @@ void Coverage::TogglePrecise(Isolate* isolate, bool enable) {
FeedbackVector* vector = FeedbackVector::cast(current_obj);
SharedFunctionInfo* shared = vector->shared_function_info();
if (!shared->IsSubjectToDebugging()) continue;
vector->clear_invocation_count();
vectors.emplace_back(vector, isolate);
}
}
......@@ -149,13 +148,6 @@ void Coverage::TogglePrecise(Isolate* isolate, bool enable) {
ArrayList::New(isolate, static_cast<int>(vectors.size()));
for (const auto& vector : vectors) list = ArrayList::Add(list, vector);
isolate->SetCodeCoverageList(*list);
// Increment count for functions currently on the stack. We won't observe
// entry of these functions, but we know they have coverage.
for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) {
JSFunction* function = it.frame()->function();
if (!function->shared()->IsSubjectToDebugging()) continue;
function->feedback_vector()->increment_invocation_count();
}
} else {
isolate->SetCodeCoverageList(isolate->heap()->undefined_value());
}
......
......@@ -98,11 +98,6 @@ int FeedbackVector::invocation_count() const {
return Smi::cast(get(kInvocationCountIndex))->value();
}
void FeedbackVector::increment_invocation_count() {
int count = invocation_count() + 1;
if (Smi::IsValid(count)) set(kInvocationCountIndex, Smi::FromInt(count));
}
void FeedbackVector::clear_invocation_count() {
set(kInvocationCountIndex, Smi::kZero);
}
......
......@@ -299,7 +299,6 @@ class FeedbackVector : public FixedArray {
inline FeedbackMetadata* metadata() const;
inline SharedFunctionInfo* shared_function_info() const;
inline int invocation_count() const;
inline void increment_invocation_count();
inline void clear_invocation_count();
// Conversion from a slot to an integer index to the underlying array.
......
......@@ -11,7 +11,7 @@ Running test: testPreciseBaseline
functionName : fib
ranges : [
[0] : {
count : 0
count : 15
endOffset : 73
startOffset : 1
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment