335c8ad009
JavaScript is a dynamically typed language. But most code is written with fixed types in mind. When debugging JavaScript, it is helpful to know the types of variables and parameters at runtime. It is often hard to infer types for complex code. Type profiling provides this information at runtime. Node.js uses the inspector protocol. This CL allows Node.js users to access and analyse type profile for via Node modules or the in-procress api. Type Profile helps developers to analyze their code for correctness and performance. Design doc: https://docs.google.com/a/google.com/document/d/1O1uepXZXBI6IwiawTrYC3ohhiNgzkyTdjn3R8ysbYgk/edit?usp=sharing Add `takeTypeProfile` to the inspector protocol. It returns a list of TypeProfileForScripts, which in turn contains the type profile for each function. We can use TypeProfile data to annotate JavaScript code. Sample script with data from TypeProfile: function f(/*Object, number, undefined*/a, /*Array, number, null*/b, /*boolean, Object, symbol*/c) { return 'bye'; /*string*/}; f({}, [], true); f(3, 2.3, {a: 42}); f(undefined, null, Symbol('hello'));/*string*/ Bug: v8:5933 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: I626bfb886b752f90b9c86cc6953601558b18b60d Reviewed-on: https://chromium-review.googlesource.com/508588 Commit-Queue: Franziska Hinkelmann <franzih@chromium.org> Reviewed-by: Pavel Feldman <pfeldman@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Reviewed-by: Marja Hölttä <marja@chromium.org> Cr-Commit-Position: refs/heads/master@{#47920}
28 lines
723 B
Plaintext
28 lines
723 B
Plaintext
# Copyright 2016 the V8 project authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
{
|
|
'variables': {
|
|
'files': [
|
|
'./console/',
|
|
'./cpu-profiler/',
|
|
'./debugger/',
|
|
'./heap-profiler/',
|
|
'./inspector.status',
|
|
'./json-parse-expected.txt',
|
|
'./json-parse.js',
|
|
'./protocol-test.js',
|
|
'./runtime/',
|
|
'./sessions/',
|
|
'./testcfg.py',
|
|
'./type-profiler/',
|
|
'../../src/inspector/injected-script-source.js',
|
|
'<(PRODUCT_DIR)/inspector-test<(EXECUTABLE_SUFFIX)',
|
|
],
|
|
},
|
|
'includes': [
|
|
'../../src/base.isolate',
|
|
'../../tools/testrunner/testrunner.isolate',
|
|
],
|
|
}
|