Commit 8e17c151 authored by jgruber's avatar jgruber Committed by Commit Bot

[coverage] Reduce the number of reported ranges

This CL adds a few transformations that clean up the set of reported
source ranges. Duplicates, empty, and uncovered ranges are removed, and
nested/consecutive ranges are merged if possible.

BUG=v8:6000

Change-Id: I421ee35ce8292cfe84c1eea4f653762cea5d909d
Reviewed-on: https://chromium-review.googlesource.com/558411Reviewed-by: 's avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46450}
parent 85b95a03
This diff is collapsed.
...@@ -370,7 +370,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled ...@@ -370,7 +370,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
functions : [ functions : [
[0] : { [0] : {
functionName : functionName :
isBlockCoverage : true isBlockCoverage : false
ranges : [ ranges : [
[0] : { [0] : {
count : 1 count : 1
...@@ -381,28 +381,13 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled ...@@ -381,28 +381,13 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
} }
[1] : { [1] : {
functionName : fib functionName : fib
isBlockCoverage : true isBlockCoverage : false
ranges : [ ranges : [
[0] : { [0] : {
count : 1 count : 1
endOffset : 73 endOffset : 73
startOffset : 1 startOffset : 1
} }
[1] : {
count : 8
endOffset : 41
startOffset : 32
}
[2] : {
count : 7
endOffset : 71
startOffset : 41
}
[3] : {
count : 0
endOffset : 73
startOffset : 71
}
] ]
} }
[2] : { [2] : {
...@@ -418,18 +403,13 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled ...@@ -418,18 +403,13 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
} }
[3] : { [3] : {
functionName : iife functionName : iife
isBlockCoverage : true isBlockCoverage : false
ranges : [ ranges : [
[0] : { [0] : {
count : 1 count : 1
endOffset : 208 endOffset : 208
startOffset : 177 startOffset : 177
} }
[1] : {
count : 0
endOffset : 208
startOffset : 206
}
] ]
} }
] ]
...@@ -440,7 +420,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled ...@@ -440,7 +420,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
functions : [ functions : [
[0] : { [0] : {
functionName : functionName :
isBlockCoverage : true isBlockCoverage : false
ranges : [ ranges : [
[0] : { [0] : {
count : 1 count : 1
...@@ -464,7 +444,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled ...@@ -464,7 +444,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
functions : [ functions : [
[0] : { [0] : {
functionName : functionName :
isBlockCoverage : true isBlockCoverage : false
ranges : [ ranges : [
[0] : { [0] : {
count : 1 count : 1
...@@ -475,28 +455,13 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled ...@@ -475,28 +455,13 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
} }
[1] : { [1] : {
functionName : fib functionName : fib
isBlockCoverage : true isBlockCoverage : false
ranges : [ ranges : [
[0] : { [0] : {
count : 1 count : 1
endOffset : 73 endOffset : 73
startOffset : 1 startOffset : 1
} }
[1] : {
count : 8
endOffset : 41
startOffset : 32
}
[2] : {
count : 7
endOffset : 71
startOffset : 41
}
[3] : {
count : 0
endOffset : 73
startOffset : 71
}
] ]
} }
[2] : { [2] : {
...@@ -512,18 +477,13 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled ...@@ -512,18 +477,13 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
} }
[3] : { [3] : {
functionName : iife functionName : iife
isBlockCoverage : true isBlockCoverage : false
ranges : [ ranges : [
[0] : { [0] : {
count : 1 count : 1
endOffset : 208 endOffset : 208
startOffset : 177 startOffset : 177
} }
[1] : {
count : 0
endOffset : 208
startOffset : 206
}
] ]
} }
] ]
...@@ -534,7 +494,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled ...@@ -534,7 +494,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
functions : [ functions : [
[0] : { [0] : {
functionName : functionName :
isBlockCoverage : true isBlockCoverage : false
ranges : [ ranges : [
[0] : { [0] : {
count : 1 count : 1
...@@ -949,11 +909,6 @@ Running test: testPreciseCountCoveragePartial ...@@ -949,11 +909,6 @@ Running test: testPreciseCountCoveragePartial
endOffset : 166 endOffset : 166
startOffset : 99 startOffset : 99
} }
[1] : {
count : 0
endOffset : 166
startOffset : 158
}
] ]
} }
] ]
......
...@@ -67,25 +67,14 @@ f(43); // 0650 ...@@ -67,25 +67,14 @@ f(43); // 0650
{"start":50,"end":551,"count":2}, {"start":50,"end":551,"count":2},
{"start":115,"end":203,"count":1}, {"start":115,"end":203,"count":1},
{"start":167,"end":171,"count":0}, {"start":167,"end":171,"count":0},
{"start":177,"end":181,"count":1},
{"start":181,"end":203,"count":1},
{"start":203,"end":265,"count":2},
{"start":265,"end":273,"count":1}, {"start":265,"end":273,"count":1},
{"start":279,"end":287,"count":1}, {"start":279,"end":287,"count":1},
{"start":287,"end":315,"count":2},
{"start":315,"end":319,"count":1}, {"start":315,"end":319,"count":1},
{"start":325,"end":329,"count":1}, {"start":325,"end":329,"count":1},
{"start":329,"end":363,"count":2},
{"start":363,"end":367,"count":0}, {"start":363,"end":367,"count":0},
{"start":373,"end":377,"count":2},
{"start":377,"end":413,"count":2},
{"start":413,"end":417,"count":0}, {"start":413,"end":417,"count":0},
{"start":417,"end":462,"count":2}, {"start":472,"end":476,"count":0}]
{"start":462,"end":466,"count":2},
{"start":472,"end":476,"count":0},
{"start":476,"end":512,"count":2},
{"start":512,"end":516,"count":2},
{"start":516,"end":551,"count":2}]
); );
TestCoverage( TestCoverage(
...@@ -102,9 +91,7 @@ TestCoverage( ...@@ -102,9 +91,7 @@ TestCoverage(
`, `,
[{"start":0,"end":399,"count":1}, [{"start":0,"end":399,"count":1},
{"start":1,"end":351,"count":1}, {"start":1,"end":351,"count":1},
{"start":62,"end":253,"count":1}, {"start":161,"end":351,"count":0}]
{"start":161,"end":253,"count":0},
{"start":253,"end":351,"count":0}]
); );
TestCoverage( TestCoverage(
...@@ -118,11 +105,7 @@ TestCoverage( ...@@ -118,11 +105,7 @@ TestCoverage(
`, `,
[{"start":0,"end":249,"count":1}, [{"start":0,"end":249,"count":1},
{"start":1,"end":201,"count":1}, {"start":1,"end":201,"count":1},
{"start":62,"end":67,"count":1}, {"start":124,"end":129,"count":0}]
{"start":67,"end":112,"count":1},
{"start":112,"end":118,"count":1},
{"start":124,"end":129,"count":0},
{"start":129,"end":201,"count":1}]
); );
TestCoverage( TestCoverage(
...@@ -145,18 +128,11 @@ function g() {} // 0000 ...@@ -145,18 +128,11 @@ function g() {} // 0000
{"start":0,"end":15,"count":36}, {"start":0,"end":15,"count":36},
{"start":51,"end":551,"count":1}, {"start":51,"end":551,"count":1},
{"start":131,"end":135,"count":12}, {"start":131,"end":135,"count":12},
{"start":135,"end":181,"count":1},
{"start":181,"end":253,"count":12}, {"start":181,"end":253,"count":12},
{"start":253,"end":330,"count":1},
{"start":330,"end":334,"count":0}, {"start":330,"end":334,"count":0},
{"start":334,"end":379,"count":1},
{"start":379,"end":385,"count":1},
{"start":385,"end":431,"count":1},
{"start":431,"end":503,"count":12}, {"start":431,"end":503,"count":12},
{"start":470,"end":474,"count":4}, {"start":470,"end":474,"count":4},
{"start":480,"end":484,"count":8}, {"start":480,"end":484,"count":8}]
{"start":484,"end":503,"count":12},
{"start":503,"end":551,"count":1}]
); );
TestCoverage( TestCoverage(
...@@ -175,13 +151,8 @@ function g() {} // 0000 ...@@ -175,13 +151,8 @@ function g() {} // 0000
{"start":0,"end":15,"count":36}, {"start":0,"end":15,"count":36},
{"start":51,"end":351,"count":1}, {"start":51,"end":351,"count":1},
{"start":181,"end":185,"count":12}, {"start":181,"end":185,"count":12},
{"start":185,"end":233,"count":1},
{"start":233,"end":237,"count":12}, {"start":233,"end":237,"count":12},
{"start":237,"end":277,"count":1}, {"start":277,"end":281,"count":12}]
{"start":277,"end":281,"count":12},
{"start":281,"end":311,"count":1},
{"start":311,"end":317,"count":1},
{"start":317,"end":351,"count":1}]
); );
TestCoverage( TestCoverage(
...@@ -197,12 +168,7 @@ function g() {} // 0000 ...@@ -197,12 +168,7 @@ function g() {} // 0000
[{"start":0,"end":299,"count":1}, [{"start":0,"end":299,"count":1},
{"start":0,"end":15,"count":13}, {"start":0,"end":15,"count":13},
{"start":51,"end":251,"count":1}, {"start":51,"end":251,"count":1},
{"start":131,"end":134,"count":12}, {"start":131,"end":134,"count":12}]
{"start":134,"end":181,"count":1},
{"start":181,"end":186,"count":1},
{"start":186,"end":231,"count":1},
{"start":231,"end":237,"count":1},
{"start":237,"end":251,"count":1}]
); );
TestCoverage( TestCoverage(
...@@ -233,13 +199,8 @@ TestCoverage( ...@@ -233,13 +199,8 @@ TestCoverage(
{"start":1,"end":951,"count":1}, {"start":1,"end":951,"count":1},
{"start":81,"end":253,"count":10}, {"start":81,"end":253,"count":10},
{"start":163,"end":253,"count":0}, {"start":163,"end":253,"count":0},
{"start":253,"end":361,"count":1},
{"start":361,"end":553,"count":1},
{"start":460,"end":553,"count":0}, {"start":460,"end":553,"count":0},
{"start":553,"end":661,"count":1}, {"start":761,"end":951,"count":0}]
{"start":661,"end":853,"count":1},
{"start":761,"end":853,"count":0},
{"start":853,"end":951,"count":0}]
); );
TestCoverage( TestCoverage(
...@@ -264,22 +225,11 @@ function g() {} // 0000 ...@@ -264,22 +225,11 @@ function g() {} // 0000
{"start":0,"end":15,"count":25}, {"start":0,"end":15,"count":25},
{"start":51,"end":651,"count":1}, {"start":51,"end":651,"count":1},
{"start":174,"end":178,"count":12}, {"start":174,"end":178,"count":12},
{"start":178,"end":224,"count":1},
{"start":224,"end":237,"count":12}, {"start":224,"end":237,"count":12},
{"start":237,"end":273,"count":1},
{"start":273,"end":277,"count":0}, {"start":273,"end":277,"count":0},
{"start":277,"end":322,"count":1},
{"start":322,"end":328,"count":1},
{"start":328,"end":412,"count":1},
{"start":412,"end":416,"count":12}, {"start":412,"end":416,"count":12},
{"start":416,"end":462,"count":1},
{"start":462,"end":475,"count":12}, {"start":462,"end":475,"count":12},
{"start":475,"end":562,"count":1}, {"start":620,"end":622,"count":0}]
{"start":562,"end":570,"count":1},
{"start":570,"end":612,"count":1},
{"start":612,"end":622,"count":1},
{"start":620,"end":622,"count":0},
{"start":622,"end":651,"count":1}]
); );
TestCoverage( TestCoverage(
...@@ -311,13 +261,8 @@ TestCoverage( ...@@ -311,13 +261,8 @@ TestCoverage(
{"start":1,"end":1001,"count":1}, {"start":1,"end":1001,"count":1},
{"start":117,"end":303,"count":10}, {"start":117,"end":303,"count":10},
{"start":213,"end":303,"count":0}, {"start":213,"end":303,"count":0},
{"start":303,"end":415,"count":1},
{"start":415,"end":603,"count":1},
{"start":510,"end":603,"count":0}, {"start":510,"end":603,"count":0},
{"start":603,"end":715,"count":1}, {"start":811,"end":1001,"count":0}]
{"start":715,"end":903,"count":1},
{"start":811,"end":903,"count":0},
{"start":903,"end":1001,"count":0}]
); );
TestCoverage( TestCoverage(
...@@ -349,13 +294,8 @@ TestCoverage( ...@@ -349,13 +294,8 @@ TestCoverage(
{"start":1,"end":1001,"count":1}, {"start":1,"end":1001,"count":1},
{"start":105,"end":303,"count":10}, {"start":105,"end":303,"count":10},
{"start":213,"end":303,"count":0}, {"start":213,"end":303,"count":0},
{"start":303,"end":405,"count":1},
{"start":405,"end":603,"count":1},
{"start":510,"end":603,"count":0}, {"start":510,"end":603,"count":0},
{"start":603,"end":705,"count":1}, {"start":811,"end":1001,"count":0}]
{"start":705,"end":903,"count":1},
{"start":811,"end":903,"count":0},
{"start":903,"end":1001,"count":0}]
); );
TestCoverage( TestCoverage(
......
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