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

Issue 2707873002: Collect type profile for DevTools. (Closed)

Created:
3 years, 10 months ago by Franzi
Modified:
3 years, 9 months ago
CC:
v8-reviews_googlegroups.com, rmcilroy, Michael Hablich
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Collect type profile for DevTools Collect type information for JavaScript variables and display it in Chrome DevTools. Design Doc: https://docs.google.com/a/google.com/document/d/1O1uepXZXBI6IwiawTrYC3ohhiNgzkyTdjn3R8ysbYgk/edit?usp=sharing When debugging JavaScript, it’s helpful to know the type of a variable, parameter, and return values. JavaScript is dynamically typed, and for complex source code it’s often hard to infer types. With type profiling, we can provide type information to JavaScript developers. This CL is a proof of concept. It collects type profile for assignments and simply prints the types to stdout. The output looks something like this: #my_var1 #Object #number #string #number #undefined #string #Object #Object We use an extra slot in the feedback vector of assignments to carry the list of types for that assignment. The extra slot is only added when the flag --type-profile is given. Missing work: * Collect data for parameters and return values (currently only assignments). * Remove duplicates from the list of collected types and use a common base class. * Add line numbers or source position instead of the variable name. For now, has a test that compares the stdout of --type-profile in test/message. We will remove this test when --type-profile is fully integrated in the debugger protocol. Adding the test in test/inspector does not work, because the inspector test itself consists of JavaScript code that would convolute the output and be non-deterministic under stress. BUG=v8:5935 Review-Url: https://codereview.chromium.org/2707873002 Cr-Commit-Position: refs/heads/master@{#43866} Committed: https://chromium.googlesource.com/v8/v8/+/947a0437668ce21392358634494543a664c6b123

Patch Set 1 #

Patch Set 2 : Always turn on the flag for now #

Patch Set 3 : Delete dummy nexus call. #

Patch Set 4 : Delete printf. #

Patch Set 5 : Rebaseline and fix vector cctest. #

Patch Set 6 : Fix vector cctest. #

Patch Set 7 : Print all types seen so far for each assignment. #

Patch Set 8 : Rebaseline. #

Patch Set 9 : Add megamorphic handling. #

Patch Set 10 : Minor fixes. #

Patch Set 11 : Fix test. #

Patch Set 12 : Use constructor name if available. #

Total comments: 8

Patch Set 13 : Set slot size to 1. #

Patch Set 14 : Simplify Type profile feedback. #

Patch Set 15 : Simplify StateFromFeedback(). #

Patch Set 16 : Emit bytecode only if flag is set. #

Patch Set 17 : Fix unittest #

Patch Set 18 : Only make new register if flag is on. #

Patch Set 19 : Fix nullptr exception. #

Patch Set 20 : Small cleanups. #

Patch Set 21 : Fix feedback vector test back to its original checks. #

Patch Set 22 : Fix when we use type profile. #

Patch Set 23 : Rebase. #

Patch Set 24 : Rebase. #

Patch Set 25 : Cleanup variable names in test. #

Patch Set 26 : Add inspector test. #

Patch Set 27 : Simplify AssignFeedbackSlot(). #

Patch Set 28 : Clean up test. #

Patch Set 29 : [ast] Use BitField for boolean flag. #

Patch Set 30 : Add documentation and sprinkle consts around. #

Total comments: 15

Patch Set 31 : Address Yang's comments. #

Patch Set 32 : Add more exhaustive test case. #

Patch Set 33 : Check FeedbackMetadata to decide if we can collect type profile. #

Patch Set 34 : Fix DCHECK in FeedbackParameter JS Operator. #

Patch Set 35 : Delete unused constants. #

Patch Set 36 : Fix typo. #

Total comments: 2

Patch Set 37 : Use FeedbackMetadataIterator. #

Patch Set 38 : Delete unused var #

Total comments: 11

Patch Set 39 : Delete Opcode. #

Patch Set 40 : Use ToCString() instead of debug Print. #

Patch Set 41 : Collect type profile only for user JS. #

Patch Set 42 : Move tests to message instead of inspector tests. #

Patch Set 43 : Move tests to message instead of inspector tests. #

Patch Set 44 : Collect type profile only for user JS. #

Patch Set 45 : Throw in test to make message test work. Yikes. #

Patch Set 46 : Explain why throw is needed in message test. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+411 lines, -11 lines) Patch
M src/ast/ast.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 2 chunks +11 lines, -1 line 0 comments Download
M src/ast/ast.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 chunk +6 lines, -1 line 0 comments Download
M src/ast/ast-numbering.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +2 lines, -1 line 0 comments Download
M src/ast/ast-numbering.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 5 chunks +11 lines, -5 lines 0 comments Download
M src/compiler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 43 1 chunk +16 lines, -1 line 0 comments Download
M src/compiler/bytecode-graph-builder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 chunk +16 lines, -0 lines 0 comments Download
M src/feedback-vector.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 4 chunks +32 lines, -0 lines 0 comments Download
M src/feedback-vector.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 5 chunks +61 lines, -1 line 0 comments Download
M src/feedback-vector-inl.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +3 lines, -1 line 0 comments Download
M src/ic/ic.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 2 chunks +2 lines, -0 lines 0 comments Download
M src/interpreter/bytecode-array-builder.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 chunk +5 lines, -0 lines 0 comments Download
M src/interpreter/bytecode-array-builder.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 chunk +7 lines, -0 lines 0 comments Download
M src/interpreter/bytecode-generator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 4 chunks +31 lines, -0 lines 0 comments Download
M src/interpreter/bytecodes.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 chunk +2 lines, -0 lines 0 comments Download
M src/interpreter/interpreter.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 chunk +13 lines, -0 lines 0 comments Download
M src/objects-printer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 1 chunk +1 line, -0 lines 0 comments Download
M src/runtime/runtime.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 chunk +1 line, -0 lines 0 comments Download
M src/runtime/runtime-object.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 1 chunk +26 lines, -0 lines 0 comments Download
A test/message/type-profile/collect-type-profile.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 1 chunk +34 lines, -0 lines 0 comments Download
A test/message/type-profile/collect-type-profile.out View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 1 chunk +125 lines, -0 lines 0 comments Download
M test/unittests/interpreter/bytecode-array-builder-unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 chunk +6 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 213 (174 generated)
Franzi
Hi Yang, Could you have a look if I'm on the right track please? Thanks, ...
3 years, 10 months ago (2017-02-21 15:53:08 UTC) #38
Yang
Looking good. Some comments. https://codereview.chromium.org/2707873002/diff/190001/src/feedback-vector-inl.h File src/feedback-vector-inl.h (right): https://codereview.chromium.org/2707873002/diff/190001/src/feedback-vector-inl.h#newcode71 src/feedback-vector-inl.h:71: return 2; Why do we ...
3 years, 10 months ago (2017-02-22 10:39:28 UTC) #47
Yang
I took a brief look, and it seems removing all feedback metadata and vectors during ...
3 years, 10 months ago (2017-02-22 11:41:11 UTC) #48
Franzi
https://codereview.chromium.org/2707873002/diff/190001/src/feedback-vector-inl.h File src/feedback-vector-inl.h (right): https://codereview.chromium.org/2707873002/diff/190001/src/feedback-vector-inl.h#newcode71 src/feedback-vector-inl.h:71: return 2; On 2017/02/22 10:39:28, Yang wrote: > Why ...
3 years, 9 months ago (2017-02-27 11:38:01 UTC) #71
Franzi
Hi Michael, Could you have a look at my Type Profile CL? Yang said you ...
3 years, 9 months ago (2017-03-08 13:28:18 UTC) #107
Franzi
Hi Michael, Could you have a look at my Type Profile CL? Yang said you ...
3 years, 9 months ago (2017-03-08 13:28:19 UTC) #108
Yang
Very nice. LGTM. Michael, please also take a look. My comments are supposed to kick ...
3 years, 9 months ago (2017-03-09 10:28:28 UTC) #111
mvstanton
This should help for now, and I'll look at the rest when you plug that ...
3 years, 9 months ago (2017-03-10 12:12:25 UTC) #114
Franzi
Yang, I addressed your comments. Left to do: Do not store collects_type_profile on the shared ...
3 years, 9 months ago (2017-03-10 12:14:29 UTC) #115
Franzi
Hi Michael, I deleted tha flags and instead iterate over the feedback metadata. Please take ...
3 years, 9 months ago (2017-03-10 14:33:50 UTC) #130
mvstanton
Velly nice, LGTM, one nit. I think it'd be good for Ross to have a ...
3 years, 9 months ago (2017-03-10 14:57:23 UTC) #131
Franzi
Thanks, fixed the nit. Ross, could you have a look at the interpreter part? Thanks ...
3 years, 9 months ago (2017-03-11 07:04:02 UTC) #135
rmcilroy
Nice, LGTM with a couple of questions. https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc File src/compiler/bytecode-graph-builder.cc (right): https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc#newcode814 src/compiler/bytecode-graph-builder.cc:814: const Operator* ...
3 years, 9 months ago (2017-03-13 10:50:59 UTC) #142
Franzi
Thanks for the reviews. I'm landing as is since all the nits will be changed ...
3 years, 9 months ago (2017-03-13 12:01:57 UTC) #143
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2707873002/710001
3 years, 9 months ago (2017-03-13 12:02:33 UTC) #146
rmcilroy
https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc File src/compiler/bytecode-graph-builder.cc (right): https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc#newcode814 src/compiler/bytecode-graph-builder.cc:814: const Operator* op = javascript()->CollectTypeProfile(feedback); On 2017/03/13 12:01:56, Franzi ...
3 years, 9 months ago (2017-03-13 12:05:45 UTC) #147
commit-bot: I haz the power
Try jobs failed on following builders: v8_presubmit on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_presubmit/builds/36442)
3 years, 9 months ago (2017-03-13 12:08:59 UTC) #149
Franzi
Hi Michi, Can I get a review for ast and compiler changes please? Thanks, Franzi
3 years, 9 months ago (2017-03-13 12:11:43 UTC) #151
Yang
On 2017/03/13 12:05:45, rmcilroy wrote: > https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc > File src/compiler/bytecode-graph-builder.cc (right): > > https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc#newcode814 > ...
3 years, 9 months ago (2017-03-13 12:15:21 UTC) #152
Michael Starzinger
https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc File src/compiler/bytecode-graph-builder.cc (right): https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc#newcode816 src/compiler/bytecode-graph-builder.cc:816: Node* node = NewNode(op, name, value); Do we ever ...
3 years, 9 months ago (2017-03-14 13:12:43 UTC) #153
Yang
https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc File src/compiler/bytecode-graph-builder.cc (right): https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc#newcode816 src/compiler/bytecode-graph-builder.cc:816: Node* node = NewNode(op, name, value); On 2017/03/14 13:12:43, ...
3 years, 9 months ago (2017-03-14 13:35:22 UTC) #154
Michael Starzinger
https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc File src/compiler/bytecode-graph-builder.cc (right): https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc#newcode816 src/compiler/bytecode-graph-builder.cc:816: Node* node = NewNode(op, name, value); On 2017/03/14 13:35:22, ...
3 years, 9 months ago (2017-03-14 13:41:38 UTC) #155
Franzi
https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc File src/compiler/bytecode-graph-builder.cc (right): https://codereview.chromium.org/2707873002/diff/710001/src/compiler/bytecode-graph-builder.cc#newcode816 src/compiler/bytecode-graph-builder.cc:816: Node* node = NewNode(op, name, value); On 2017/03/14 13:41:38, ...
3 years, 9 months ago (2017-03-14 15:55:11 UTC) #160
Michael Starzinger
LGTM on "compiler" and "ast". Thanks! Cool stuff.
3 years, 9 months ago (2017-03-14 16:03:17 UTC) #161
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2707873002/730001
3 years, 9 months ago (2017-03-14 16:09:55 UTC) #164
commit-bot: I haz the power
Committed patchset #39 (id:730001) as https://chromium.googlesource.com/v8/v8/+/0332bebde99d0f9a5a8326382f5f37cc26224ae0
3 years, 9 months ago (2017-03-14 16:12:07 UTC) #167
Michael Achenbach
A revert of this CL (patchset #39 id:730001) has been created in https://codereview.chromium.org/2749673003/ by machenbach@chromium.org. ...
3 years, 9 months ago (2017-03-14 16:40:40 UTC) #168
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2707873002/750001
3 years, 9 months ago (2017-03-14 20:43:04 UTC) #172
commit-bot: I haz the power
Committed patchset #40 (id:750001) as https://chromium.googlesource.com/v8/v8/+/6cf880f4b84c533d4bb139d33c1369e309d1c579
3 years, 9 months ago (2017-03-14 21:09:08 UTC) #175
Michael Achenbach
Hmmm, now the bot turned flaky: https://build.chromium.org/p/client.v8/builders/V8%20Linux%20gcc%204.8/builds/11863
3 years, 9 months ago (2017-03-14 21:28:04 UTC) #176
Franzi
A revert of this CL (patchset #40 id:750001) has been created in https://codereview.chromium.org/2754573002/ by franzih@chromium.org. ...
3 years, 9 months ago (2017-03-14 21:32:17 UTC) #177
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2707873002/750001
3 years, 9 months ago (2017-03-16 08:16:50 UTC) #180
commit-bot: I haz the power
Committed patchset #40 (id:750001) as https://chromium.googlesource.com/v8/v8/+/5c322873908a5b5c04552fc47d8d81f7603b5d11
3 years, 9 months ago (2017-03-16 08:42:53 UTC) #183
Franzi
A revert of this CL (patchset #40 id:750001) has been created in https://codereview.chromium.org/2747383004/ by franzih@chromium.org. ...
3 years, 9 months ago (2017-03-16 08:48:48 UTC) #184
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2707873002/770001
3 years, 9 months ago (2017-03-16 09:01:10 UTC) #188
commit-bot: I haz the power
Committed patchset #41 (id:770001) as https://chromium.googlesource.com/v8/v8/+/18c35e4958be6a70acc923bf10363eb9aaee5ce4
3 years, 9 months ago (2017-03-16 09:25:35 UTC) #191
Franzi
A revert of this CL (patchset #41 id:770001) has been created in https://codereview.chromium.org/2745413006/ by franzih@chromium.org. ...
3 years, 9 months ago (2017-03-16 09:59:04 UTC) #192
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2707873002/870001
3 years, 9 months ago (2017-03-16 13:58:59 UTC) #210
commit-bot: I haz the power
3 years, 9 months ago (2017-03-16 15:01:44 UTC) #213
Message was sent while issue was closed.
Committed patchset #46 (id:870001) as
https://chromium.googlesource.com/v8/v8/+/947a0437668ce21392358634494543a664c...

Powered by Google App Engine
This is Rietveld 408576698