From 283791d250fe8cce64e1d973116faf92ddd304e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marja=20H=C3=B6ltt=C3=A4?= Date: Fri, 7 Oct 2022 14:40:05 +0200 Subject: [PATCH] [inspector] Remove Type Profiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://docs.google.com/document/d/1dJHFRXKE4NUchvYweuyzsolXDEWACr-jJZEPyC6f9EQ/edit?usp=sharing Change-Id: Ie5b30db30d55ba701a336d8a59dbff7771276e96 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3936281 Reviewed-by: Leszek Swirski Reviewed-by: Maya Lekova Commit-Queue: Marja Hölttä Reviewed-by: Benedikt Meurer Cr-Commit-Position: refs/heads/main@{#83593} --- BUILD.bazel | 2 - BUILD.gn | 2 - include/js_protocol-1.3.json | 46 ----- include/js_protocol.pdl | 36 ---- src/baseline/baseline-compiler.cc | 8 - src/codegen/compiler.cc | 2 - src/compiler/bytecode-graph-builder.cc | 14 -- src/debug/debug-coverage.cc | 11 +- src/debug/debug-interface.cc | 43 ----- src/debug/debug-interface.h | 61 ------ src/debug/debug-type-profile.cc | 121 ------------ src/debug/debug-type-profile.h | 46 ----- src/debug/interface-types.h | 5 - src/diagnostics/objects-printer.cc | 1 - src/execution/isolate.h | 5 - src/execution/local-isolate.cc | 5 - src/execution/local-isolate.h | 2 - src/inspector/v8-profiler-agent-impl.cc | 75 -------- src/inspector/v8-profiler-agent-impl.h | 6 - src/interpreter/bytecode-array-builder.cc | 5 - src/interpreter/bytecode-array-builder.h | 4 - src/interpreter/bytecode-generator.cc | 14 -- src/interpreter/bytecodes.h | 2 - src/interpreter/interpreter-generator.cc | 12 -- src/maglev/maglev-graph-builder.cc | 8 - src/objects/feedback-vector-inl.h | 1 - src/objects/feedback-vector.cc | 168 +---------------- src/objects/feedback-vector.h | 28 --- src/objects/js-function.cc | 1 - src/parsing/parse-info.cc | 31 +-- src/parsing/parse-info.h | 7 +- src/runtime/runtime-object.cc | 29 --- src/runtime/runtime.h | 1 - test/inspector/inspector.status | 16 -- .../type-profile-disable-expected.txt | 9 - .../type-profiler/type-profile-disable.js | 45 ----- .../type-profiler/type-profile-expected.txt | 9 - .../type-profile-start-stop-expected.txt | 51 ----- .../type-profiler/type-profile-start-stop.js | 176 ------------------ .../type-profile-with-classes-expected.txt | 16 -- .../type-profile-with-classes.js | 41 ---- ...pe-profile-with-to-string-tag-expected.txt | 17 -- .../type-profile-with-to-string-tag.js | 44 ----- test/inspector/type-profiler/type-profile.js | 37 ---- ...-type-profile-undefined-feedback-vector.js | 11 -- .../bytecode-array-builder-unittest.cc | 4 - 46 files changed, 15 insertions(+), 1263 deletions(-) delete mode 100644 src/debug/debug-type-profile.cc delete mode 100644 src/debug/debug-type-profile.h delete mode 100644 test/inspector/type-profiler/type-profile-disable-expected.txt delete mode 100644 test/inspector/type-profiler/type-profile-disable.js delete mode 100644 test/inspector/type-profiler/type-profile-expected.txt delete mode 100644 test/inspector/type-profiler/type-profile-start-stop-expected.txt delete mode 100644 test/inspector/type-profiler/type-profile-start-stop.js delete mode 100644 test/inspector/type-profiler/type-profile-with-classes-expected.txt delete mode 100644 test/inspector/type-profiler/type-profile-with-classes.js delete mode 100644 test/inspector/type-profiler/type-profile-with-to-string-tag-expected.txt delete mode 100644 test/inspector/type-profiler/type-profile-with-to-string-tag.js delete mode 100644 test/inspector/type-profiler/type-profile.js delete mode 100644 test/mjsunit/collect-type-profile-undefined-feedback-vector.js diff --git a/BUILD.bazel b/BUILD.bazel index d0b6a9beb7..f9013ae944 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1270,8 +1270,6 @@ filegroup( "src/debug/debug-scopes.h", "src/debug/debug-stack-trace-iterator.cc", "src/debug/debug-stack-trace-iterator.h", - "src/debug/debug-type-profile.cc", - "src/debug/debug-type-profile.h", "src/debug/debug.cc", "src/debug/debug.h", "src/debug/interface-types.h", diff --git a/BUILD.gn b/BUILD.gn index 783a7af691..b822b0be4c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -2949,7 +2949,6 @@ v8_header_set("v8_internal_headers") { "src/debug/debug-scope-iterator.h", "src/debug/debug-scopes.h", "src/debug/debug-stack-trace-iterator.h", - "src/debug/debug-type-profile.h", "src/debug/debug.h", "src/debug/interface-types.h", "src/debug/liveedit-diff.h", @@ -4373,7 +4372,6 @@ v8_source_set("v8_base_without_compiler") { "src/debug/debug-scope-iterator.cc", "src/debug/debug-scopes.cc", "src/debug/debug-stack-trace-iterator.cc", - "src/debug/debug-type-profile.cc", "src/debug/debug.cc", "src/debug/liveedit-diff.cc", "src/debug/liveedit.cc", diff --git a/include/js_protocol-1.3.json b/include/js_protocol-1.3.json index ea573d11a6..a998d4611d 100644 --- a/include/js_protocol-1.3.json +++ b/include/js_protocol-1.3.json @@ -946,34 +946,6 @@ { "name": "url", "type": "string", "description": "JavaScript script name or url." }, { "name": "functions", "type": "array", "items": { "$ref": "FunctionCoverage" }, "description": "Functions contained in the script that has coverage data." } ] - }, - { "id": "TypeObject", - "type": "object", - "description": "Describes a type collected during runtime.", - "properties": [ - { "name": "name", "type": "string", "description": "Name of a type collected with type profiling." } - ], - "experimental": true - }, - { "id": "TypeProfileEntry", - "type": "object", - "description": "Source offset and types for a parameter or return value.", - "properties": [ - { "name": "offset", "type": "integer", "description": "Source offset of the parameter or end of function for return values." }, - { "name": "types", "type": "array", "items": {"$ref": "TypeObject"}, "description": "The types for this parameter or return value."} - ], - "experimental": true - }, - { - "id": "ScriptTypeProfile", - "type": "object", - "description": "Type profile data collected during runtime for a JavaScript script.", - "properties": [ - { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "JavaScript script id." }, - { "name": "url", "type": "string", "description": "JavaScript script name or url." }, - { "name": "entries", "type": "array", "items": { "$ref": "TypeProfileEntry" }, "description": "Type profile entries for parameters and return values of the functions in the script." } - ], - "experimental": true } ], "commands": [ @@ -1024,24 +996,6 @@ { "name": "result", "type": "array", "items": { "$ref": "ScriptCoverage" }, "description": "Coverage data for the current isolate." } ], "description": "Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection." - }, - { - "name": "startTypeProfile", - "description": "Enable type profile.", - "experimental": true - }, - { - "name": "stopTypeProfile", - "description": "Disable type profile. Disabling releases type profile data collected so far.", - "experimental": true - }, - { - "name": "takeTypeProfile", - "returns": [ - { "name": "result", "type": "array", "items": { "$ref": "ScriptTypeProfile" }, "description": "Type profile for all scripts since startTypeProfile() was turned on." } - ], - "description": "Collect type profile.", - "experimental": true } ], "events": [ diff --git a/include/js_protocol.pdl b/include/js_protocol.pdl index 2d56043552..b3b97fa117 100644 --- a/include/js_protocol.pdl +++ b/include/js_protocol.pdl @@ -918,30 +918,6 @@ domain Profiler # Functions contained in the script that has coverage data. array of FunctionCoverage functions - # Describes a type collected during runtime. - experimental type TypeObject extends object - properties - # Name of a type collected with type profiling. - string name - - # Source offset and types for a parameter or return value. - experimental type TypeProfileEntry extends object - properties - # Source offset of the parameter or end of function for return values. - integer offset - # The types for this parameter or return value. - array of TypeObject types - - # Type profile data collected during runtime for a JavaScript script. - experimental type ScriptTypeProfile extends object - properties - # JavaScript script id. - Runtime.ScriptId scriptId - # JavaScript script name or url. - string url - # Type profile entries for parameters and return values of the functions in the script. - array of TypeProfileEntry entries - command disable command enable @@ -976,9 +952,6 @@ domain Profiler # Monotonically increasing time (in seconds) when the coverage update was taken in the backend. number timestamp - # Enable type profile. - experimental command startTypeProfile - command stop returns # Recorded profile. @@ -988,9 +961,6 @@ domain Profiler # executing optimized code. command stopPreciseCoverage - # Disable type profile. Disabling releases type profile data collected so far. - experimental command stopTypeProfile - # Collect coverage data for the current isolate, and resets execution counters. Precise code # coverage needs to have started. command takePreciseCoverage @@ -1000,12 +970,6 @@ domain Profiler # Monotonically increasing time (in seconds) when the coverage update was taken in the backend. number timestamp - # Collect type profile. - experimental command takeTypeProfile - returns - # Type profile for all scripts since startTypeProfile() was turned on. - array of ScriptTypeProfile result - event consoleProfileFinished parameters string id diff --git a/src/baseline/baseline-compiler.cc b/src/baseline/baseline-compiler.cc index eafc384c69..7eb3097cd0 100644 --- a/src/baseline/baseline-compiler.cc +++ b/src/baseline/baseline-compiler.cc @@ -967,14 +967,6 @@ void BaselineCompiler::VisitDefineKeyedOwnPropertyInLiteral() { IndexAsTagged(3)); // slot } -void BaselineCompiler::VisitCollectTypeProfile() { - SaveAccumulatorScope accumulator_scope(&basm_); - CallRuntime(Runtime::kCollectTypeProfile, - IntAsSmi(0), // position - kInterpreterAccumulatorRegister, // value - FeedbackVector()); // feedback vector -} - void BaselineCompiler::VisitAdd() { CallBuiltin( RegisterOperand(0), kInterpreterAccumulatorRegister, Index(1)); diff --git a/src/codegen/compiler.cc b/src/codegen/compiler.cc index ccd5697241..5431deb83e 100644 --- a/src/codegen/compiler.cc +++ b/src/codegen/compiler.cc @@ -3282,8 +3282,6 @@ MaybeHandle CompileScriptOnMainThread( if (!maybe_script.ToHandle(&script)) { script = NewScript(isolate, &parse_info, source, script_details, natives); } - DCHECK_IMPLIES(parse_info.flags().collect_type_profile(), - script->IsUserJavaScript()); DCHECK_EQ(parse_info.flags().is_repl_mode(), script->is_repl_mode()); return Compiler::CompileToplevel(&parse_info, script, isolate, diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc index e9afe672ea..f43199cd37 100644 --- a/src/compiler/bytecode-graph-builder.cc +++ b/src/compiler/bytecode-graph-builder.cc @@ -1672,20 +1672,6 @@ void BytecodeGraphBuilder::VisitDefineKeyedOwnPropertyInLiteral() { environment()->RecordAfterState(node, Environment::kAttachFrameState); } -void BytecodeGraphBuilder::VisitCollectTypeProfile() { - PrepareEagerCheckpoint(); - - Node* position = - jsgraph()->Constant(bytecode_iterator().GetImmediateOperand(0)); - Node* value = environment()->LookupAccumulator(); - Node* vector = jsgraph()->Constant(feedback_vector()); - - const Operator* op = javascript()->CallRuntime(Runtime::kCollectTypeProfile); - - Node* node = NewNode(op, position, value, vector); - environment()->RecordAfterState(node, Environment::kAttachFrameState); -} - void BytecodeGraphBuilder::VisitLdaContextSlot() { const Operator* op = javascript()->LoadContext( bytecode_iterator().GetUnsignedImmediateOperand(2), diff --git a/src/debug/debug-coverage.cc b/src/debug/debug-coverage.cc index 623e557fd2..c434cede65 100644 --- a/src/debug/debug-coverage.cc +++ b/src/debug/debug-coverage.cc @@ -605,9 +605,8 @@ std::unique_ptr Coverage::CollectPrecise(Isolate* isolate) { DCHECK(!isolate->is_best_effort_code_coverage()); std::unique_ptr result = Collect(isolate, isolate->code_coverage_mode()); - if (!isolate->is_collecting_type_profile() && - (isolate->is_precise_binary_code_coverage() || - isolate->is_block_binary_code_coverage())) { + if (isolate->is_precise_binary_code_coverage() || + isolate->is_block_binary_code_coverage()) { // We do not have to hold onto feedback vectors for invocations we already // reported. So we can reset the list. isolate->SetFeedbackVectorsForProfilingTools( @@ -766,10 +765,8 @@ void Coverage::SelectMode(Isolate* isolate, debug::CoverageMode mode) { // following coverage recording (without reloads) will be at function // granularity. isolate->debug()->RemoveAllCoverageInfos(); - if (!isolate->is_collecting_type_profile()) { - isolate->SetFeedbackVectorsForProfilingTools( - ReadOnlyRoots(isolate).undefined_value()); - } + isolate->SetFeedbackVectorsForProfilingTools( + ReadOnlyRoots(isolate).undefined_value()); break; case debug::CoverageMode::kBlockBinary: case debug::CoverageMode::kBlockCount: diff --git a/src/debug/debug-interface.cc b/src/debug/debug-interface.cc index 26c88c450b..510e874b1a 100644 --- a/src/debug/debug-interface.cc +++ b/src/debug/debug-interface.cc @@ -14,7 +14,6 @@ #include "src/debug/debug-evaluate.h" #include "src/debug/debug-property-iterator.h" #include "src/debug/debug-stack-trace-iterator.h" -#include "src/debug/debug-type-profile.h" #include "src/debug/debug.h" #include "src/execution/vm-state-inl.h" #include "src/heap/heap.h" @@ -1317,48 +1316,6 @@ void Coverage::SelectMode(Isolate* isolate, CoverageMode mode) { i::Coverage::SelectMode(reinterpret_cast(isolate), mode); } -int TypeProfile::Entry::SourcePosition() const { return entry_->position; } - -std::vector> TypeProfile::Entry::Types() const { - std::vector> result; - for (const internal::Handle& type : entry_->types) { - result.emplace_back(ToApiHandle(type)); - } - return result; -} - -TypeProfile::ScriptData::ScriptData( - size_t index, std::shared_ptr type_profile) - : script_(&type_profile->at(index)), - type_profile_(std::move(type_profile)) {} - -Local