Commit 226adea4 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

[cleanup] Refactor out enums from debug-interface.h

Moved CoverageMode and TypeProfileMode enums to interface-types.h
to save one include in isolate.h. This reduces the expanded lines of code
count by ~45k.

Bug: v8:8834

R=yangguo@chromium.org

Change-Id: I399fe8cf66b1aec79bcb5831afd46a74e358244d
Reviewed-on: https://chromium-review.googlesource.com/c/1489072Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59886}
parent 834c4b35
...@@ -9811,7 +9811,7 @@ debug::Coverage debug::Coverage::CollectBestEffort(Isolate* isolate) { ...@@ -9811,7 +9811,7 @@ debug::Coverage debug::Coverage::CollectBestEffort(Isolate* isolate) {
i::Coverage::CollectBestEffort(reinterpret_cast<i::Isolate*>(isolate))); i::Coverage::CollectBestEffort(reinterpret_cast<i::Isolate*>(isolate)));
} }
void debug::Coverage::SelectMode(Isolate* isolate, debug::Coverage::Mode mode) { void debug::Coverage::SelectMode(Isolate* isolate, debug::CoverageMode mode) {
i::Coverage::SelectMode(reinterpret_cast<i::Isolate*>(isolate), mode); i::Coverage::SelectMode(reinterpret_cast<i::Isolate*>(isolate), mode);
} }
...@@ -9851,7 +9851,7 @@ debug::TypeProfile debug::TypeProfile::Collect(Isolate* isolate) { ...@@ -9851,7 +9851,7 @@ debug::TypeProfile debug::TypeProfile::Collect(Isolate* isolate) {
} }
void debug::TypeProfile::SelectMode(Isolate* isolate, void debug::TypeProfile::SelectMode(Isolate* isolate,
debug::TypeProfile::Mode mode) { debug::TypeProfileMode mode) {
i::TypeProfile::SelectMode(reinterpret_cast<i::Isolate*>(isolate), mode); i::TypeProfile::SelectMode(reinterpret_cast<i::Isolate*>(isolate), mode);
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "include/v8-testing.h" #include "include/v8-testing.h"
#include "src/contexts.h" #include "src/contexts.h"
#include "src/debug/debug-interface.h"
#include "src/detachable-vector.h" #include "src/detachable-vector.h"
#include "src/heap/factory.h" #include "src/heap/factory.h"
#include "src/isolate.h" #include "src/isolate.h"
...@@ -28,6 +27,12 @@ namespace internal { ...@@ -28,6 +27,12 @@ namespace internal {
class JSArrayBufferView; class JSArrayBufferView;
} // namespace internal } // namespace internal
namespace debug {
class GeneratorObject;
class Script;
class WeakMap;
} // namespace debug
// Constants used in the implementation of the API. The most natural thing // Constants used in the implementation of the API. The most natural thing
// would usually be to place these with the classes that use them, but // would usually be to place these with the classes that use them, but
// we want to keep them out of v8.h because it is an externally // we want to keep them out of v8.h because it is an externally
......
...@@ -2960,7 +2960,7 @@ int Shell::RunMain(Isolate* isolate, int argc, char* argv[], bool last_run) { ...@@ -2960,7 +2960,7 @@ int Shell::RunMain(Isolate* isolate, int argc, char* argv[], bool last_run) {
{ {
SetWaitUntilDone(isolate, false); SetWaitUntilDone(isolate, false);
if (options.lcov_file) { if (options.lcov_file) {
debug::Coverage::SelectMode(isolate, debug::Coverage::kBlockCount); debug::Coverage::SelectMode(isolate, debug::CoverageMode::kBlockCount);
} }
HandleScope scope(isolate); HandleScope scope(isolate);
Local<Context> context = CreateEvaluationContext(isolate); Local<Context> context = CreateEvaluationContext(isolate);
......
...@@ -375,20 +375,20 @@ void ResetAllBlockCounts(SharedFunctionInfo shared) { ...@@ -375,20 +375,20 @@ void ResetAllBlockCounts(SharedFunctionInfo shared) {
} }
} }
bool IsBlockMode(debug::Coverage::Mode mode) { bool IsBlockMode(debug::CoverageMode mode) {
switch (mode) { switch (mode) {
case debug::Coverage::kBlockBinary: case debug::CoverageMode::kBlockBinary:
case debug::Coverage::kBlockCount: case debug::CoverageMode::kBlockCount:
return true; return true;
default: default:
return false; return false;
} }
} }
bool IsBinaryMode(debug::Coverage::Mode mode) { bool IsBinaryMode(debug::CoverageMode mode) {
switch (mode) { switch (mode) {
case debug::Coverage::kBlockBinary: case debug::CoverageMode::kBlockBinary:
case debug::Coverage::kPreciseBinary: case debug::CoverageMode::kPreciseBinary:
return true; return true;
default: default:
return false; return false;
...@@ -396,14 +396,14 @@ bool IsBinaryMode(debug::Coverage::Mode mode) { ...@@ -396,14 +396,14 @@ bool IsBinaryMode(debug::Coverage::Mode mode) {
} }
void CollectBlockCoverage(CoverageFunction* function, SharedFunctionInfo info, void CollectBlockCoverage(CoverageFunction* function, SharedFunctionInfo info,
debug::Coverage::Mode mode) { debug::CoverageMode mode) {
DCHECK(IsBlockMode(mode)); DCHECK(IsBlockMode(mode));
function->has_block_coverage = true; function->has_block_coverage = true;
function->blocks = GetSortedBlockData(info); function->blocks = GetSortedBlockData(info);
// If in binary mode, only report counts of 0/1. // If in binary mode, only report counts of 0/1.
if (mode == debug::Coverage::kBlockBinary) ClampToBinary(function); if (mode == debug::CoverageMode::kBlockBinary) ClampToBinary(function);
// Remove singleton ranges with the same start position as a full range and // Remove singleton ranges with the same start position as a full range and
// throw away their counts. // throw away their counts.
...@@ -456,20 +456,21 @@ std::unique_ptr<Coverage> Coverage::CollectPrecise(Isolate* isolate) { ...@@ -456,20 +456,21 @@ std::unique_ptr<Coverage> Coverage::CollectPrecise(Isolate* isolate) {
} }
std::unique_ptr<Coverage> Coverage::CollectBestEffort(Isolate* isolate) { std::unique_ptr<Coverage> Coverage::CollectBestEffort(Isolate* isolate) {
return Collect(isolate, v8::debug::Coverage::kBestEffort); return Collect(isolate, v8::debug::CoverageMode::kBestEffort);
} }
std::unique_ptr<Coverage> Coverage::Collect( std::unique_ptr<Coverage> Coverage::Collect(
Isolate* isolate, v8::debug::Coverage::Mode collectionMode) { Isolate* isolate, v8::debug::CoverageMode collectionMode) {
SharedToCounterMap counter_map; SharedToCounterMap counter_map;
const bool reset_count = collectionMode != v8::debug::Coverage::kBestEffort; const bool reset_count =
collectionMode != v8::debug::CoverageMode::kBestEffort;
switch (isolate->code_coverage_mode()) { switch (isolate->code_coverage_mode()) {
case v8::debug::Coverage::kBlockBinary: case v8::debug::CoverageMode::kBlockBinary:
case v8::debug::Coverage::kBlockCount: case v8::debug::CoverageMode::kBlockCount:
case v8::debug::Coverage::kPreciseBinary: case v8::debug::CoverageMode::kPreciseBinary:
case v8::debug::Coverage::kPreciseCount: { case v8::debug::CoverageMode::kPreciseCount: {
// Feedback vectors are already listed to prevent losing them to GC. // Feedback vectors are already listed to prevent losing them to GC.
DCHECK(isolate->factory() DCHECK(isolate->factory()
->feedback_vectors_for_profiling_tools() ->feedback_vectors_for_profiling_tools()
...@@ -486,11 +487,11 @@ std::unique_ptr<Coverage> Coverage::Collect( ...@@ -486,11 +487,11 @@ std::unique_ptr<Coverage> Coverage::Collect(
} }
break; break;
} }
case v8::debug::Coverage::kBestEffort: { case v8::debug::CoverageMode::kBestEffort: {
DCHECK(!isolate->factory() DCHECK(!isolate->factory()
->feedback_vectors_for_profiling_tools() ->feedback_vectors_for_profiling_tools()
->IsArrayList()); ->IsArrayList());
DCHECK_EQ(v8::debug::Coverage::kBestEffort, collectionMode); DCHECK_EQ(v8::debug::CoverageMode::kBestEffort, collectionMode);
HeapIterator heap_iterator(isolate->heap()); HeapIterator heap_iterator(isolate->heap());
for (HeapObject current_obj = heap_iterator.next(); for (HeapObject current_obj = heap_iterator.next();
!current_obj.is_null(); current_obj = heap_iterator.next()) { !current_obj.is_null(); current_obj = heap_iterator.next()) {
...@@ -544,15 +545,15 @@ std::unique_ptr<Coverage> Coverage::Collect( ...@@ -544,15 +545,15 @@ std::unique_ptr<Coverage> Coverage::Collect(
} }
if (count != 0) { if (count != 0) {
switch (collectionMode) { switch (collectionMode) {
case v8::debug::Coverage::kBlockCount: case v8::debug::CoverageMode::kBlockCount:
case v8::debug::Coverage::kPreciseCount: case v8::debug::CoverageMode::kPreciseCount:
break; break;
case v8::debug::Coverage::kBlockBinary: case v8::debug::CoverageMode::kBlockBinary:
case v8::debug::Coverage::kPreciseBinary: case v8::debug::CoverageMode::kPreciseBinary:
count = info->has_reported_binary_coverage() ? 0 : 1; count = info->has_reported_binary_coverage() ? 0 : 1;
info->set_has_reported_binary_coverage(true); info->set_has_reported_binary_coverage(true);
break; break;
case v8::debug::Coverage::kBestEffort: case v8::debug::CoverageMode::kBestEffort:
count = 1; count = 1;
break; break;
} }
...@@ -583,9 +584,9 @@ std::unique_ptr<Coverage> Coverage::Collect( ...@@ -583,9 +584,9 @@ std::unique_ptr<Coverage> Coverage::Collect(
return result; return result;
} }
void Coverage::SelectMode(Isolate* isolate, debug::Coverage::Mode mode) { void Coverage::SelectMode(Isolate* isolate, debug::CoverageMode mode) {
switch (mode) { switch (mode) {
case debug::Coverage::kBestEffort: case debug::CoverageMode::kBestEffort:
// Note that DevTools switches back to best-effort coverage once the // Note that DevTools switches back to best-effort coverage once the
// recording is stopped. Since we delete coverage infos at that point, any // recording is stopped. Since we delete coverage infos at that point, any
// following coverage recording (without reloads) will be at function // following coverage recording (without reloads) will be at function
...@@ -596,10 +597,10 @@ void Coverage::SelectMode(Isolate* isolate, debug::Coverage::Mode mode) { ...@@ -596,10 +597,10 @@ void Coverage::SelectMode(Isolate* isolate, debug::Coverage::Mode mode) {
ReadOnlyRoots(isolate).undefined_value()); ReadOnlyRoots(isolate).undefined_value());
} }
break; break;
case debug::Coverage::kBlockBinary: case debug::CoverageMode::kBlockBinary:
case debug::Coverage::kBlockCount: case debug::CoverageMode::kBlockCount:
case debug::Coverage::kPreciseBinary: case debug::CoverageMode::kPreciseBinary:
case debug::Coverage::kPreciseCount: { case debug::CoverageMode::kPreciseCount: {
HandleScope scope(isolate); HandleScope scope(isolate);
// Remove all optimized function. Optimized and inlined functions do not // Remove all optimized function. Optimized and inlined functions do not
......
...@@ -58,11 +58,11 @@ class Coverage : public std::vector<CoverageScript> { ...@@ -58,11 +58,11 @@ class Coverage : public std::vector<CoverageScript> {
static std::unique_ptr<Coverage> CollectBestEffort(Isolate* isolate); static std::unique_ptr<Coverage> CollectBestEffort(Isolate* isolate);
// Select code coverage mode. // Select code coverage mode.
static void SelectMode(Isolate* isolate, debug::Coverage::Mode mode); static void SelectMode(Isolate* isolate, debug::CoverageMode mode);
private: private:
static std::unique_ptr<Coverage> Collect( static std::unique_ptr<Coverage> Collect(
Isolate* isolate, v8::debug::Coverage::Mode collectionMode); Isolate* isolate, v8::debug::CoverageMode collectionMode);
Coverage() = default; Coverage() = default;
}; };
......
...@@ -225,25 +225,6 @@ class V8_EXPORT_PRIVATE Coverage { ...@@ -225,25 +225,6 @@ class V8_EXPORT_PRIVATE Coverage {
public: public:
MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(Coverage); MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(Coverage);
enum Mode {
// Make use of existing information in feedback vectors on the heap.
// Only return a yes/no result. Optimization and GC are not affected.
// Collecting best effort coverage does not reset counters.
kBestEffort,
// Disable optimization and prevent feedback vectors from being garbage
// collected in order to preserve precise invocation counts. Collecting
// precise count coverage resets counters to get incremental updates.
kPreciseCount,
// We are only interested in a yes/no result for the function. Optimization
// and GC can be allowed once a function has been invoked. Collecting
// precise binary coverage resets counters for incremental updates.
kPreciseBinary,
// Similar to the precise coverage modes but provides coverage at a
// lower granularity. Design doc: goo.gl/lA2swZ.
kBlockCount,
kBlockBinary,
};
// Forward declarations. // Forward declarations.
class ScriptData; class ScriptData;
class FunctionData; class FunctionData;
...@@ -310,7 +291,7 @@ class V8_EXPORT_PRIVATE Coverage { ...@@ -310,7 +291,7 @@ class V8_EXPORT_PRIVATE Coverage {
static Coverage CollectPrecise(Isolate* isolate); static Coverage CollectPrecise(Isolate* isolate);
static Coverage CollectBestEffort(Isolate* isolate); static Coverage CollectBestEffort(Isolate* isolate);
static void SelectMode(Isolate* isolate, Mode mode); static void SelectMode(Isolate* isolate, CoverageMode mode);
size_t ScriptCount() const; size_t ScriptCount() const;
ScriptData GetScriptData(size_t i) const; ScriptData GetScriptData(size_t i) const;
...@@ -329,10 +310,6 @@ class V8_EXPORT_PRIVATE TypeProfile { ...@@ -329,10 +310,6 @@ class V8_EXPORT_PRIVATE TypeProfile {
public: public:
MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(TypeProfile); MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(TypeProfile);
enum Mode {
kNone,
kCollect,
};
class ScriptData; // Forward declaration. class ScriptData; // Forward declaration.
class V8_EXPORT_PRIVATE Entry { class V8_EXPORT_PRIVATE Entry {
...@@ -372,7 +349,7 @@ class V8_EXPORT_PRIVATE TypeProfile { ...@@ -372,7 +349,7 @@ class V8_EXPORT_PRIVATE TypeProfile {
static TypeProfile Collect(Isolate* isolate); static TypeProfile Collect(Isolate* isolate);
static void SelectMode(Isolate* isolate, Mode mode); static void SelectMode(Isolate* isolate, TypeProfileMode mode);
size_t ScriptCount() const; size_t ScriptCount() const;
ScriptData GetScriptData(size_t i) const; ScriptData GetScriptData(size_t i) const;
......
...@@ -71,10 +71,10 @@ std::unique_ptr<TypeProfile> TypeProfile::Collect(Isolate* isolate) { ...@@ -71,10 +71,10 @@ std::unique_ptr<TypeProfile> TypeProfile::Collect(Isolate* isolate) {
return result; return result;
} }
void TypeProfile::SelectMode(Isolate* isolate, debug::TypeProfile::Mode mode) { void TypeProfile::SelectMode(Isolate* isolate, debug::TypeProfileMode mode) {
HandleScope handle_scope(isolate); HandleScope handle_scope(isolate);
if (mode == debug::TypeProfile::Mode::kNone) { if (mode == debug::TypeProfileMode::kNone) {
if (!isolate->factory() if (!isolate->factory()
->feedback_vectors_for_profiling_tools() ->feedback_vectors_for_profiling_tools()
->IsUndefined(isolate)) { ->IsUndefined(isolate)) {
...@@ -106,7 +106,7 @@ void TypeProfile::SelectMode(Isolate* isolate, debug::TypeProfile::Mode mode) { ...@@ -106,7 +106,7 @@ void TypeProfile::SelectMode(Isolate* isolate, debug::TypeProfile::Mode mode) {
} }
} }
} else { } else {
DCHECK_EQ(debug::TypeProfile::Mode::kCollect, mode); DCHECK_EQ(debug::TypeProfileMode::kCollect, mode);
isolate->MaybeInitializeVectorListFromHeap(); isolate->MaybeInitializeVectorListFromHeap();
} }
isolate->set_type_profile_mode(mode); isolate->set_type_profile_mode(mode);
......
...@@ -34,7 +34,7 @@ struct TypeProfileScript { ...@@ -34,7 +34,7 @@ struct TypeProfileScript {
class TypeProfile : public std::vector<TypeProfileScript> { class TypeProfile : public std::vector<TypeProfileScript> {
public: public:
static std::unique_ptr<TypeProfile> Collect(Isolate* isolate); static std::unique_ptr<TypeProfile> Collect(Isolate* isolate);
static void SelectMode(Isolate* isolate, debug::TypeProfile::Mode mode); static void SelectMode(Isolate* isolate, debug::TypeProfileMode mode);
private: private:
TypeProfile() = default; TypeProfile() = default;
......
...@@ -86,6 +86,30 @@ enum BreakLocationType { ...@@ -86,6 +86,30 @@ enum BreakLocationType {
kCommonBreakLocation kCommonBreakLocation
}; };
enum class CoverageMode {
// Make use of existing information in feedback vectors on the heap.
// Only return a yes/no result. Optimization and GC are not affected.
// Collecting best effort coverage does not reset counters.
kBestEffort,
// Disable optimization and prevent feedback vectors from being garbage
// collected in order to preserve precise invocation counts. Collecting
// precise count coverage resets counters to get incremental updates.
kPreciseCount,
// We are only interested in a yes/no result for the function. Optimization
// and GC can be allowed once a function has been invoked. Collecting
// precise binary coverage resets counters for incremental updates.
kPreciseBinary,
// Similar to the precise coverage modes but provides coverage at a
// lower granularity. Design doc: goo.gl/lA2swZ.
kBlockCount,
kBlockBinary,
};
enum class TypeProfileMode {
kNone,
kCollect,
};
class V8_EXPORT_PRIVATE BreakLocation : public Location { class V8_EXPORT_PRIVATE BreakLocation : public Location {
public: public:
BreakLocation(int line_number, int column_number, BreakLocationType type) BreakLocation(int line_number, int column_number, BreakLocationType type)
......
...@@ -304,9 +304,10 @@ Response V8ProfilerAgentImpl::startPreciseCoverage(Maybe<bool> callCount, ...@@ -304,9 +304,10 @@ Response V8ProfilerAgentImpl::startPreciseCoverage(Maybe<bool> callCount,
// each function recompiled after the BlockCount mode has been set); and // each function recompiled after the BlockCount mode has been set); and
// function-granularity coverage data otherwise. // function-granularity coverage data otherwise.
typedef v8::debug::Coverage C; typedef v8::debug::Coverage C;
C::Mode mode = callCountValue typedef v8::debug::CoverageMode Mode;
? (detailedValue ? C::kBlockCount : C::kPreciseCount) Mode mode = callCountValue
: (detailedValue ? C::kBlockBinary : C::kPreciseBinary); ? (detailedValue ? Mode::kBlockCount : Mode::kPreciseCount)
: (detailedValue ? Mode::kBlockBinary : Mode::kPreciseBinary);
C::SelectMode(m_isolate, mode); C::SelectMode(m_isolate, mode);
return Response::OK(); return Response::OK();
} }
...@@ -316,7 +317,8 @@ Response V8ProfilerAgentImpl::stopPreciseCoverage() { ...@@ -316,7 +317,8 @@ Response V8ProfilerAgentImpl::stopPreciseCoverage() {
m_state->setBoolean(ProfilerAgentState::preciseCoverageStarted, false); m_state->setBoolean(ProfilerAgentState::preciseCoverageStarted, false);
m_state->setBoolean(ProfilerAgentState::preciseCoverageCallCount, false); m_state->setBoolean(ProfilerAgentState::preciseCoverageCallCount, false);
m_state->setBoolean(ProfilerAgentState::preciseCoverageDetailed, false); m_state->setBoolean(ProfilerAgentState::preciseCoverageDetailed, false);
v8::debug::Coverage::SelectMode(m_isolate, v8::debug::Coverage::kBestEffort); v8::debug::Coverage::SelectMode(m_isolate,
v8::debug::CoverageMode::kBestEffort);
return Response::OK(); return Response::OK();
} }
...@@ -461,13 +463,14 @@ typeProfileToProtocol(V8InspectorImpl* inspector, ...@@ -461,13 +463,14 @@ typeProfileToProtocol(V8InspectorImpl* inspector,
Response V8ProfilerAgentImpl::startTypeProfile() { Response V8ProfilerAgentImpl::startTypeProfile() {
m_state->setBoolean(ProfilerAgentState::typeProfileStarted, true); m_state->setBoolean(ProfilerAgentState::typeProfileStarted, true);
v8::debug::TypeProfile::SelectMode(m_isolate, v8::debug::TypeProfile::SelectMode(m_isolate,
v8::debug::TypeProfile::kCollect); v8::debug::TypeProfileMode::kCollect);
return Response::OK(); return Response::OK();
} }
Response V8ProfilerAgentImpl::stopTypeProfile() { Response V8ProfilerAgentImpl::stopTypeProfile() {
m_state->setBoolean(ProfilerAgentState::typeProfileStarted, false); m_state->setBoolean(ProfilerAgentState::typeProfileStarted, false);
v8::debug::TypeProfile::SelectMode(m_isolate, v8::debug::TypeProfile::kNone); v8::debug::TypeProfile::SelectMode(m_isolate,
v8::debug::TypeProfileMode::kNone);
return Response::OK(); return Response::OK();
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "src/base/macros.h" #include "src/base/macros.h"
#include "src/builtins/builtins.h" #include "src/builtins/builtins.h"
#include "src/contexts.h" #include "src/contexts.h"
#include "src/debug/debug-interface.h" #include "src/debug/interface-types.h"
#include "src/execution.h" #include "src/execution.h"
#include "src/futex-emulation.h" #include "src/futex-emulation.h"
#include "src/globals.h" #include "src/globals.h"
...@@ -50,6 +50,7 @@ class RandomNumberGenerator; ...@@ -50,6 +50,7 @@ class RandomNumberGenerator;
namespace debug { namespace debug {
class ConsoleDelegate; class ConsoleDelegate;
class AsyncEventDelegate;
} }
namespace internal { namespace internal {
...@@ -359,47 +360,47 @@ V8_EXPORT_PRIVATE void FreeCurrentEmbeddedBlob(); ...@@ -359,47 +360,47 @@ V8_EXPORT_PRIVATE void FreeCurrentEmbeddedBlob();
typedef std::vector<HeapObject> DebugObjectCache; typedef std::vector<HeapObject> DebugObjectCache;
#define ISOLATE_INIT_LIST(V) \ #define ISOLATE_INIT_LIST(V) \
/* Assembler state. */ \ /* Assembler state. */ \
V(FatalErrorCallback, exception_behavior, nullptr) \ V(FatalErrorCallback, exception_behavior, nullptr) \
V(OOMErrorCallback, oom_behavior, nullptr) \ V(OOMErrorCallback, oom_behavior, nullptr) \
V(LogEventCallback, event_logger, nullptr) \ V(LogEventCallback, event_logger, nullptr) \
V(AllowCodeGenerationFromStringsCallback, allow_code_gen_callback, nullptr) \ V(AllowCodeGenerationFromStringsCallback, allow_code_gen_callback, nullptr) \
V(AllowWasmCodeGenerationCallback, allow_wasm_code_gen_callback, nullptr) \ V(AllowWasmCodeGenerationCallback, allow_wasm_code_gen_callback, nullptr) \
V(ExtensionCallback, wasm_module_callback, &NoExtension) \ V(ExtensionCallback, wasm_module_callback, &NoExtension) \
V(ExtensionCallback, wasm_instance_callback, &NoExtension) \ V(ExtensionCallback, wasm_instance_callback, &NoExtension) \
V(WasmStreamingCallback, wasm_streaming_callback, nullptr) \ V(WasmStreamingCallback, wasm_streaming_callback, nullptr) \
V(WasmThreadsEnabledCallback, wasm_threads_enabled_callback, nullptr) \ V(WasmThreadsEnabledCallback, wasm_threads_enabled_callback, nullptr) \
/* State for Relocatable. */ \ /* State for Relocatable. */ \
V(Relocatable*, relocatable_top, nullptr) \ V(Relocatable*, relocatable_top, nullptr) \
V(DebugObjectCache*, string_stream_debug_object_cache, nullptr) \ V(DebugObjectCache*, string_stream_debug_object_cache, nullptr) \
V(Object, string_stream_current_security_token, Object()) \ V(Object, string_stream_current_security_token, Object()) \
V(const intptr_t*, api_external_references, nullptr) \ V(const intptr_t*, api_external_references, nullptr) \
V(AddressToIndexHashMap*, external_reference_map, nullptr) \ V(AddressToIndexHashMap*, external_reference_map, nullptr) \
V(HeapObjectToIndexHashMap*, root_index_map, nullptr) \ V(HeapObjectToIndexHashMap*, root_index_map, nullptr) \
V(MicrotaskQueue*, default_microtask_queue, nullptr) \ V(MicrotaskQueue*, default_microtask_queue, nullptr) \
V(CompilationStatistics*, turbo_statistics, nullptr) \ V(CompilationStatistics*, turbo_statistics, nullptr) \
V(CodeTracer*, code_tracer, nullptr) \ V(CodeTracer*, code_tracer, nullptr) \
V(uint32_t, per_isolate_assert_data, 0xFFFFFFFFu) \ V(uint32_t, per_isolate_assert_data, 0xFFFFFFFFu) \
V(PromiseRejectCallback, promise_reject_callback, nullptr) \ V(PromiseRejectCallback, promise_reject_callback, nullptr) \
V(const v8::StartupData*, snapshot_blob, nullptr) \ V(const v8::StartupData*, snapshot_blob, nullptr) \
V(int, code_and_metadata_size, 0) \ V(int, code_and_metadata_size, 0) \
V(int, bytecode_and_metadata_size, 0) \ V(int, bytecode_and_metadata_size, 0) \
V(int, external_script_source_size, 0) \ V(int, external_script_source_size, 0) \
/* true if being profiled. Causes collection of extra compile info. */ \ /* true if being profiled. Causes collection of extra compile info. */ \
V(bool, is_profiling, false) \ V(bool, is_profiling, false) \
/* true if a trace is being formatted through Error.prepareStackTrace. */ \ /* true if a trace is being formatted through Error.prepareStackTrace. */ \
V(bool, formatting_stack_trace, false) \ V(bool, formatting_stack_trace, false) \
/* Perform side effect checks on function call and API callbacks. */ \ /* Perform side effect checks on function call and API callbacks. */ \
V(DebugInfo::ExecutionMode, debug_execution_mode, DebugInfo::kBreakpoints) \ V(DebugInfo::ExecutionMode, debug_execution_mode, DebugInfo::kBreakpoints) \
/* Current code coverage mode */ \ /* Current code coverage mode */ \
V(debug::Coverage::Mode, code_coverage_mode, debug::Coverage::kBestEffort) \ V(debug::CoverageMode, code_coverage_mode, debug::CoverageMode::kBestEffort) \
V(debug::TypeProfile::Mode, type_profile_mode, debug::TypeProfile::kNone) \ V(debug::TypeProfileMode, type_profile_mode, debug::TypeProfileMode::kNone) \
V(int, last_stack_frame_info_id, 0) \ V(int, last_stack_frame_info_id, 0) \
V(int, last_console_context_id, 0) \ V(int, last_console_context_id, 0) \
V(v8_inspector::V8Inspector*, inspector, nullptr) \ V(v8_inspector::V8Inspector*, inspector, nullptr) \
V(bool, next_v8_call_is_safe_for_termination, false) \ V(bool, next_v8_call_is_safe_for_termination, false) \
V(bool, only_terminate_in_safe_scope, false) \ V(bool, only_terminate_in_safe_scope, false) \
V(bool, detailed_source_positions_for_profiling, FLAG_detailed_line_info) V(bool, detailed_source_positions_for_profiling, FLAG_detailed_line_info)
#define THREAD_LOCAL_TOP_ACCESSOR(type, name) \ #define THREAD_LOCAL_TOP_ACCESSOR(type, name) \
...@@ -1048,23 +1049,23 @@ class Isolate final : private HiddenFactory { ...@@ -1048,23 +1049,23 @@ class Isolate final : private HiddenFactory {
bool NeedsDetailedOptimizedCodeLineInfo() const; bool NeedsDetailedOptimizedCodeLineInfo() const;
bool is_best_effort_code_coverage() const { bool is_best_effort_code_coverage() const {
return code_coverage_mode() == debug::Coverage::kBestEffort; return code_coverage_mode() == debug::CoverageMode::kBestEffort;
} }
bool is_precise_count_code_coverage() const { bool is_precise_count_code_coverage() const {
return code_coverage_mode() == debug::Coverage::kPreciseCount; return code_coverage_mode() == debug::CoverageMode::kPreciseCount;
} }
bool is_precise_binary_code_coverage() const { bool is_precise_binary_code_coverage() const {
return code_coverage_mode() == debug::Coverage::kPreciseBinary; return code_coverage_mode() == debug::CoverageMode::kPreciseBinary;
} }
bool is_block_count_code_coverage() const { bool is_block_count_code_coverage() const {
return code_coverage_mode() == debug::Coverage::kBlockCount; return code_coverage_mode() == debug::CoverageMode::kBlockCount;
} }
bool is_block_binary_code_coverage() const { bool is_block_binary_code_coverage() const {
return code_coverage_mode() == debug::Coverage::kBlockBinary; return code_coverage_mode() == debug::CoverageMode::kBlockBinary;
} }
bool is_block_code_coverage() const { bool is_block_code_coverage() const {
...@@ -1072,7 +1073,7 @@ class Isolate final : private HiddenFactory { ...@@ -1072,7 +1073,7 @@ class Isolate final : private HiddenFactory {
} }
bool is_collecting_type_profile() const { bool is_collecting_type_profile() const {
return type_profile_mode() == debug::TypeProfile::kCollect; return type_profile_mode() == debug::TypeProfileMode::kCollect;
} }
// Collect feedback vectors with data for code coverage or type profile. // Collect feedback vectors with data for code coverage or type profile.
......
...@@ -723,16 +723,16 @@ RUNTIME_FUNCTION(Runtime_DebugCollectCoverage) { ...@@ -723,16 +723,16 @@ RUNTIME_FUNCTION(Runtime_DebugCollectCoverage) {
RUNTIME_FUNCTION(Runtime_DebugTogglePreciseCoverage) { RUNTIME_FUNCTION(Runtime_DebugTogglePreciseCoverage) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
CONVERT_BOOLEAN_ARG_CHECKED(enable, 0); CONVERT_BOOLEAN_ARG_CHECKED(enable, 0);
Coverage::SelectMode(isolate, enable ? debug::Coverage::kPreciseCount Coverage::SelectMode(isolate, enable ? debug::CoverageMode::kPreciseCount
: debug::Coverage::kBestEffort); : debug::CoverageMode::kBestEffort);
return ReadOnlyRoots(isolate).undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_DebugToggleBlockCoverage) { RUNTIME_FUNCTION(Runtime_DebugToggleBlockCoverage) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
CONVERT_BOOLEAN_ARG_CHECKED(enable, 0); CONVERT_BOOLEAN_ARG_CHECKED(enable, 0);
Coverage::SelectMode(isolate, enable ? debug::Coverage::kBlockCount Coverage::SelectMode(isolate, enable ? debug::CoverageMode::kBlockCount
: debug::Coverage::kBestEffort); : debug::CoverageMode::kBestEffort);
return ReadOnlyRoots(isolate).undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
......
...@@ -4037,7 +4037,8 @@ TEST(DebugCoverage) { ...@@ -4037,7 +4037,8 @@ TEST(DebugCoverage) {
LocalContext env; LocalContext env;
v8::Isolate* isolate = env->GetIsolate(); v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
v8::debug::Coverage::SelectMode(isolate, v8::debug::Coverage::kPreciseCount); v8::debug::Coverage::SelectMode(isolate,
v8::debug::CoverageMode::kPreciseCount);
v8::Local<v8::String> source = v8_str( v8::Local<v8::String> source = v8_str(
"function f() {\n" "function f() {\n"
"}\n" "}\n"
...@@ -4092,7 +4093,8 @@ TEST(DebugCoverageWithCoverageOutOfScope) { ...@@ -4092,7 +4093,8 @@ TEST(DebugCoverageWithCoverageOutOfScope) {
LocalContext env; LocalContext env;
v8::Isolate* isolate = env->GetIsolate(); v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
v8::debug::Coverage::SelectMode(isolate, v8::debug::Coverage::kPreciseCount); v8::debug::Coverage::SelectMode(isolate,
v8::debug::CoverageMode::kPreciseCount);
v8::Local<v8::String> source = v8_str( v8::Local<v8::String> source = v8_str(
"function f() {\n" "function f() {\n"
"}\n" "}\n"
...@@ -4163,7 +4165,8 @@ TEST(DebugCoverageWithScriptDataOutOfScope) { ...@@ -4163,7 +4165,8 @@ TEST(DebugCoverageWithScriptDataOutOfScope) {
LocalContext env; LocalContext env;
v8::Isolate* isolate = env->GetIsolate(); v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
v8::debug::Coverage::SelectMode(isolate, v8::debug::Coverage::kPreciseCount); v8::debug::Coverage::SelectMode(isolate,
v8::debug::CoverageMode::kPreciseCount);
v8::Local<v8::String> source = v8_str( v8::Local<v8::String> source = v8_str(
"function f() {\n" "function f() {\n"
"}\n" "}\n"
......
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