update v8 header files
This commit is contained in:
parent
f661a892b0
commit
a3a417ca85
|
|
@ -1,9 +0,0 @@
|
||||||
include_rules = [
|
|
||||||
"+libplatform/libplatform-export.h",
|
|
||||||
]
|
|
||||||
|
|
||||||
specific_include_rules = {
|
|
||||||
"libplatform\.h": [
|
|
||||||
"+libplatform/v8-tracing.h",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
@ -23,8 +23,6 @@ class Mutex;
|
||||||
namespace platform {
|
namespace platform {
|
||||||
namespace tracing {
|
namespace tracing {
|
||||||
|
|
||||||
class PerfettoTracingController;
|
|
||||||
|
|
||||||
const int kTraceMaxNumArgs = 2;
|
const int kTraceMaxNumArgs = 2;
|
||||||
|
|
||||||
class V8_PLATFORM_EXPORT TraceObject {
|
class V8_PLATFORM_EXPORT TraceObject {
|
||||||
|
|
@ -240,11 +238,6 @@ class V8_PLATFORM_EXPORT TracingController
|
||||||
TracingController();
|
TracingController();
|
||||||
~TracingController() override;
|
~TracingController() override;
|
||||||
void Initialize(TraceBuffer* trace_buffer);
|
void Initialize(TraceBuffer* trace_buffer);
|
||||||
#ifdef V8_USE_PERFETTO
|
|
||||||
// Must be called before StartTracing() if V8_USE_PERFETTO is true. Provides
|
|
||||||
// the output stream for the JSON trace data.
|
|
||||||
void InitializeForPerfetto(std::ostream* output_stream);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// v8::TracingController implementation.
|
// v8::TracingController implementation.
|
||||||
const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
|
const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
|
||||||
|
|
@ -287,11 +280,6 @@ class V8_PLATFORM_EXPORT TracingController
|
||||||
std::unique_ptr<base::Mutex> mutex_;
|
std::unique_ptr<base::Mutex> mutex_;
|
||||||
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
|
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
|
||||||
std::atomic_bool recording_{false};
|
std::atomic_bool recording_{false};
|
||||||
#ifdef V8_USE_PERFETTO
|
|
||||||
std::atomic_bool perfetto_recording_{false};
|
|
||||||
std::unique_ptr<PerfettoTracingController> perfetto_tracing_controller_;
|
|
||||||
std::ostream* output_stream_ = nullptr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Disallow copy and assign
|
// Disallow copy and assign
|
||||||
TracingController(const TracingController&) = delete;
|
TracingController(const TracingController&) = delete;
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ class V8_EXPORT V8ContextInfo {
|
||||||
|
|
||||||
static int executionContextId(v8::Local<v8::Context> context);
|
static int executionContextId(v8::Local<v8::Context> context);
|
||||||
|
|
||||||
|
private:
|
||||||
// Disallow copying and allocating this one.
|
// Disallow copying and allocating this one.
|
||||||
enum NotNullTagEnum { NotNullLiteral };
|
enum NotNullTagEnum { NotNullLiteral };
|
||||||
void* operator new(size_t) = delete;
|
void* operator new(size_t) = delete;
|
||||||
|
|
@ -130,11 +131,7 @@ class V8_EXPORT V8InspectorSession {
|
||||||
// Dispatching protocol messages.
|
// Dispatching protocol messages.
|
||||||
static bool canDispatchMethod(const StringView& method);
|
static bool canDispatchMethod(const StringView& method);
|
||||||
virtual void dispatchProtocolMessage(const StringView& message) = 0;
|
virtual void dispatchProtocolMessage(const StringView& message) = 0;
|
||||||
virtual V8_DEPRECATED("Use state() instead",
|
virtual std::unique_ptr<StringBuffer> stateJSON() = 0;
|
||||||
std::unique_ptr<StringBuffer> stateJSON()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
virtual std::vector<uint8_t> state() = 0;
|
|
||||||
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
||||||
supportedDomains() = 0;
|
supportedDomains() = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,32 +48,28 @@ const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
|
||||||
template <size_t tagged_ptr_size>
|
template <size_t tagged_ptr_size>
|
||||||
struct SmiTagging;
|
struct SmiTagging;
|
||||||
|
|
||||||
constexpr intptr_t kIntptrAllBitsSet = intptr_t{-1};
|
|
||||||
constexpr uintptr_t kUintptrAllBitsSet =
|
|
||||||
static_cast<uintptr_t>(kIntptrAllBitsSet);
|
|
||||||
|
|
||||||
// Smi constants for systems where tagged pointer is a 32-bit value.
|
// Smi constants for systems where tagged pointer is a 32-bit value.
|
||||||
template <>
|
template <>
|
||||||
struct SmiTagging<4> {
|
struct SmiTagging<4> {
|
||||||
enum { kSmiShiftSize = 0, kSmiValueSize = 31 };
|
enum { kSmiShiftSize = 0, kSmiValueSize = 31 };
|
||||||
|
|
||||||
static constexpr intptr_t kSmiMinValue =
|
|
||||||
static_cast<intptr_t>(kUintptrAllBitsSet << (kSmiValueSize - 1));
|
|
||||||
static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1);
|
|
||||||
|
|
||||||
V8_INLINE static int SmiToInt(const internal::Address value) {
|
V8_INLINE static int SmiToInt(const internal::Address value) {
|
||||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||||
// Shift down (requires >> to be sign extending).
|
// Shift down (requires >> to be sign extending).
|
||||||
return static_cast<int>(static_cast<intptr_t>(value)) >> shift_bits;
|
return static_cast<int>(static_cast<intptr_t>(value)) >> shift_bits;
|
||||||
}
|
}
|
||||||
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
|
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
|
||||||
// Is value in range [kSmiMinValue, kSmiMaxValue].
|
// To be representable as an tagged small integer, the two
|
||||||
// Use unsigned operations in order to avoid undefined behaviour in case of
|
// most-significant bits of 'value' must be either 00 or 11 due to
|
||||||
// signed integer overflow.
|
// sign-extension. To check this we add 01 to the two
|
||||||
return (static_cast<uintptr_t>(value) -
|
// most-significant bits, and check if the most-significant bit is 0.
|
||||||
static_cast<uintptr_t>(kSmiMinValue)) <=
|
//
|
||||||
(static_cast<uintptr_t>(kSmiMaxValue) -
|
// CAUTION: The original code below:
|
||||||
static_cast<uintptr_t>(kSmiMinValue));
|
// bool result = ((value + 0x40000000) & 0x80000000) == 0;
|
||||||
|
// may lead to incorrect results according to the C language spec, and
|
||||||
|
// in fact doesn't work correctly with gcc4.1.1 in some cases: The
|
||||||
|
// compiler may produce undefined results in case of signed integer
|
||||||
|
// overflow. The computation must be done w/ unsigned ints.
|
||||||
|
return static_cast<uintptr_t>(value) + 0x40000000U < 0x80000000U;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -81,11 +77,6 @@ struct SmiTagging<4> {
|
||||||
template <>
|
template <>
|
||||||
struct SmiTagging<8> {
|
struct SmiTagging<8> {
|
||||||
enum { kSmiShiftSize = 31, kSmiValueSize = 32 };
|
enum { kSmiShiftSize = 31, kSmiValueSize = 32 };
|
||||||
|
|
||||||
static constexpr intptr_t kSmiMinValue =
|
|
||||||
static_cast<intptr_t>(kUintptrAllBitsSet << (kSmiValueSize - 1));
|
|
||||||
static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1);
|
|
||||||
|
|
||||||
V8_INLINE static int SmiToInt(const internal::Address value) {
|
V8_INLINE static int SmiToInt(const internal::Address value) {
|
||||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||||
// Shift down and throw away top 32 bits.
|
// Shift down and throw away top 32 bits.
|
||||||
|
|
@ -107,15 +98,15 @@ const int kApiTaggedSize = kApiSystemPointerSize;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
|
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
|
||||||
using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
|
typedef SmiTagging<kApiInt32Size> PlatformSmiTagging;
|
||||||
#else
|
#else
|
||||||
using PlatformSmiTagging = SmiTagging<kApiTaggedSize>;
|
typedef SmiTagging<kApiTaggedSize> PlatformSmiTagging;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
|
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
|
||||||
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
|
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
|
||||||
const int kSmiMinValue = static_cast<int>(PlatformSmiTagging::kSmiMinValue);
|
const int kSmiMinValue = (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
|
||||||
const int kSmiMaxValue = static_cast<int>(PlatformSmiTagging::kSmiMaxValue);
|
const int kSmiMaxValue = -(kSmiMinValue + 1);
|
||||||
constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
|
constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
|
||||||
constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
|
constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
|
||||||
|
|
||||||
|
|
@ -174,6 +165,8 @@ class Internals {
|
||||||
static const int kNodeStateMask = 0x7;
|
static const int kNodeStateMask = 0x7;
|
||||||
static const int kNodeStateIsWeakValue = 2;
|
static const int kNodeStateIsWeakValue = 2;
|
||||||
static const int kNodeStateIsPendingValue = 3;
|
static const int kNodeStateIsPendingValue = 3;
|
||||||
|
static const int kNodeIsIndependentShift = 3;
|
||||||
|
static const int kNodeIsActiveShift = 4;
|
||||||
|
|
||||||
static const int kFirstNonstringType = 0x40;
|
static const int kFirstNonstringType = 0x40;
|
||||||
static const int kOddballType = 0x43;
|
static const int kOddballType = 0x43;
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ class TaskRunner {
|
||||||
TaskRunner() = default;
|
TaskRunner() = default;
|
||||||
virtual ~TaskRunner() = default;
|
virtual ~TaskRunner() = default;
|
||||||
|
|
||||||
|
private:
|
||||||
TaskRunner(const TaskRunner&) = delete;
|
TaskRunner(const TaskRunner&) = delete;
|
||||||
TaskRunner& operator=(const TaskRunner&) = delete;
|
TaskRunner& operator=(const TaskRunner&) = delete;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
#ifndef V8_V8_PROFILER_H_
|
#ifndef V8_V8_PROFILER_H_
|
||||||
#define V8_V8_PROFILER_H_
|
#define V8_V8_PROFILER_H_
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "v8.h" // NOLINT(build/include)
|
#include "v8.h" // NOLINT(build/include)
|
||||||
|
|
@ -298,53 +297,6 @@ enum CpuProfilingMode {
|
||||||
kCallerLineNumbers,
|
kCallerLineNumbers,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Determines how names are derived for functions sampled.
|
|
||||||
enum CpuProfilingNamingMode {
|
|
||||||
// Use the immediate name of functions at compilation time.
|
|
||||||
kStandardNaming,
|
|
||||||
// Use more verbose naming for functions without names, inferred from scope
|
|
||||||
// where possible.
|
|
||||||
kDebugNaming,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Optional profiling attributes.
|
|
||||||
*/
|
|
||||||
class V8_EXPORT CpuProfilingOptions {
|
|
||||||
public:
|
|
||||||
// Indicates that the sample buffer size should not be explicitly limited.
|
|
||||||
static const unsigned kNoSampleLimit = UINT_MAX;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \param mode Type of computation of stack frame line numbers.
|
|
||||||
* \param max_samples The maximum number of samples that should be recorded by
|
|
||||||
* the profiler. Samples obtained after this limit will be
|
|
||||||
* discarded.
|
|
||||||
* \param sampling_interval_us controls the profile-specific target
|
|
||||||
* sampling interval. The provided sampling
|
|
||||||
* interval will be snapped to the next lowest
|
|
||||||
* non-zero multiple of the profiler's sampling
|
|
||||||
* interval, set via SetSamplingInterval(). If
|
|
||||||
* zero, the sampling interval will be equal to
|
|
||||||
* the profiler's sampling interval.
|
|
||||||
*/
|
|
||||||
CpuProfilingOptions(CpuProfilingMode mode = kLeafNodeLineNumbers,
|
|
||||||
unsigned max_samples = kNoSampleLimit,
|
|
||||||
int sampling_interval_us = 0)
|
|
||||||
: mode_(mode),
|
|
||||||
max_samples_(max_samples),
|
|
||||||
sampling_interval_us_(sampling_interval_us) {}
|
|
||||||
|
|
||||||
CpuProfilingMode mode() const { return mode_; }
|
|
||||||
unsigned max_samples() const { return max_samples_; }
|
|
||||||
int sampling_interval_us() const { return sampling_interval_us_; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
CpuProfilingMode mode_;
|
|
||||||
unsigned max_samples_;
|
|
||||||
int sampling_interval_us_;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for controlling CPU profiling. Instance of the
|
* Interface for controlling CPU profiling. Instance of the
|
||||||
* profiler can be created using v8::CpuProfiler::New method.
|
* profiler can be created using v8::CpuProfiler::New method.
|
||||||
|
|
@ -356,8 +308,7 @@ class V8_EXPORT CpuProfiler {
|
||||||
* initialized. The profiler object must be disposed after use by calling
|
* initialized. The profiler object must be disposed after use by calling
|
||||||
* |Dispose| method.
|
* |Dispose| method.
|
||||||
*/
|
*/
|
||||||
static CpuProfiler* New(Isolate* isolate,
|
static CpuProfiler* New(Isolate* isolate);
|
||||||
CpuProfilingNamingMode = kDebugNaming);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronously collect current stack sample in all profilers attached to
|
* Synchronously collect current stack sample in all profilers attached to
|
||||||
|
|
@ -388,26 +339,18 @@ class V8_EXPORT CpuProfiler {
|
||||||
void SetUsePreciseSampling(bool);
|
void SetUsePreciseSampling(bool);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts collecting a CPU profile. Title may be an empty string. Several
|
* Starts collecting CPU profile. Title may be an empty string. It
|
||||||
* profiles may be collected at once. Attempts to start collecting several
|
* is allowed to have several profiles being collected at
|
||||||
* profiles with the same title are silently ignored.
|
* once. Attempts to start collecting several profiles with the same
|
||||||
*/
|
* title are silently ignored. While collecting a profile, functions
|
||||||
void StartProfiling(Local<String> title, CpuProfilingOptions options);
|
* from all security contexts are included in it. The token-based
|
||||||
|
* filtering is only performed when querying for a profile.
|
||||||
/**
|
|
||||||
* Starts profiling with the same semantics as above, except with expanded
|
|
||||||
* parameters.
|
|
||||||
*
|
*
|
||||||
* |record_samples| parameter controls whether individual samples should
|
* |record_samples| parameter controls whether individual samples should
|
||||||
* be recorded in addition to the aggregated tree.
|
* be recorded in addition to the aggregated tree.
|
||||||
*
|
|
||||||
* |max_samples| controls the maximum number of samples that should be
|
|
||||||
* recorded by the profiler. Samples obtained after this limit will be
|
|
||||||
* discarded.
|
|
||||||
*/
|
*/
|
||||||
void StartProfiling(
|
void StartProfiling(Local<String> title, CpuProfilingMode mode,
|
||||||
Local<String> title, CpuProfilingMode mode, bool record_samples = false,
|
bool record_samples = false);
|
||||||
unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
|
|
||||||
/**
|
/**
|
||||||
* The same as StartProfiling above, but the CpuProfilingMode defaults to
|
* The same as StartProfiling above, but the CpuProfilingMode defaults to
|
||||||
* kLeafNodeLineNumbers mode, which was the previous default behavior of the
|
* kLeafNodeLineNumbers mode, which was the previous default behavior of the
|
||||||
|
|
@ -448,6 +391,7 @@ class V8_EXPORT CpuProfiler {
|
||||||
CpuProfiler& operator=(const CpuProfiler&);
|
CpuProfiler& operator=(const CpuProfiler&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HeapSnapshotEdge represents a directed connection between heap
|
* HeapSnapshotEdge represents a directed connection between heap
|
||||||
* graph nodes: from retainers to retained nodes.
|
* graph nodes: from retainers to retained nodes.
|
||||||
|
|
@ -798,6 +742,7 @@ class V8_EXPORT EmbedderGraph {
|
||||||
*/
|
*/
|
||||||
virtual const char* NamePrefix() { return nullptr; }
|
virtual const char* NamePrefix() { return nullptr; }
|
||||||
|
|
||||||
|
private:
|
||||||
Node(const Node&) = delete;
|
Node(const Node&) = delete;
|
||||||
Node& operator=(const Node&) = delete;
|
Node& operator=(const Node&) = delete;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,14 @@ class PersistentValueMapBase {
|
||||||
return SetReturnValueFromVal(&returnValue, Traits::Get(&impl_, key));
|
return SetReturnValueFromVal(&returnValue, Traits::Get(&impl_, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call V8::RegisterExternallyReferencedObject with the map value for given
|
||||||
|
* key.
|
||||||
|
*/
|
||||||
|
V8_DEPRECATED(
|
||||||
|
"Used TracedGlobal and EmbedderHeapTracer::RegisterEmbedderReference",
|
||||||
|
inline void RegisterExternallyReferencedObject(K& key));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return value for key and remove it from the map.
|
* Return value for key and remove it from the map.
|
||||||
*/
|
*/
|
||||||
|
|
@ -344,6 +352,16 @@ class PersistentValueMapBase {
|
||||||
const char* label_;
|
const char* label_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename K, typename V, typename Traits>
|
||||||
|
inline void
|
||||||
|
PersistentValueMapBase<K, V, Traits>::RegisterExternallyReferencedObject(
|
||||||
|
K& key) {
|
||||||
|
assert(Contains(key));
|
||||||
|
V8::RegisterExternallyReferencedObject(
|
||||||
|
reinterpret_cast<internal::Address*>(FromVal(Traits::Get(&impl_, key))),
|
||||||
|
reinterpret_cast<internal::Isolate*>(GetIsolate()));
|
||||||
|
}
|
||||||
|
|
||||||
template <typename K, typename V, typename Traits>
|
template <typename K, typename V, typename Traits>
|
||||||
class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
|
class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@
|
||||||
// NOTE these macros are used by some of the tool scripts and the build
|
// NOTE these macros are used by some of the tool scripts and the build
|
||||||
// system so their names cannot be changed without changing the scripts.
|
// system so their names cannot be changed without changing the scripts.
|
||||||
#define V8_MAJOR_VERSION 7
|
#define V8_MAJOR_VERSION 7
|
||||||
#define V8_MINOR_VERSION 6
|
#define V8_MINOR_VERSION 5
|
||||||
#define V8_BUILD_NUMBER 0
|
#define V8_BUILD_NUMBER 288
|
||||||
#define V8_PATCH_LEVEL 0
|
#define V8_PATCH_LEVEL 22
|
||||||
|
|
||||||
// Use 1 for candidates and 0 otherwise.
|
// Use 1 for candidates and 0 otherwise.
|
||||||
// (Boolean macro values are not supported by all preprocessors.)
|
// (Boolean macro values are not supported by all preprocessors.)
|
||||||
#define V8_IS_CANDIDATE_VERSION 1
|
#define V8_IS_CANDIDATE_VERSION 0
|
||||||
|
|
||||||
#endif // V8_INCLUDE_VERSION_H_
|
#endif // V8_INCLUDE_VERSION_H_
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ class ExternalString;
|
||||||
class Isolate;
|
class Isolate;
|
||||||
class LocalEmbedderHeapTracer;
|
class LocalEmbedderHeapTracer;
|
||||||
class MicrotaskQueue;
|
class MicrotaskQueue;
|
||||||
|
class NeverReadOnlySpaceObject;
|
||||||
struct ScriptStreamingData;
|
struct ScriptStreamingData;
|
||||||
template<typename T> class CustomArguments;
|
template<typename T> class CustomArguments;
|
||||||
class PropertyCallbackArguments;
|
class PropertyCallbackArguments;
|
||||||
|
|
@ -544,6 +545,38 @@ template <class T> class PersistentBase {
|
||||||
*/
|
*/
|
||||||
V8_INLINE void AnnotateStrongRetainer(const char* label);
|
V8_INLINE void AnnotateStrongRetainer(const char* label);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows the embedder to tell the v8 garbage collector that a certain object
|
||||||
|
* is alive. Only allowed when the embedder is asked to trace its heap by
|
||||||
|
* EmbedderHeapTracer.
|
||||||
|
*/
|
||||||
|
V8_DEPRECATED(
|
||||||
|
"Used TracedGlobal and EmbedderHeapTracer::RegisterEmbedderReference",
|
||||||
|
V8_INLINE void RegisterExternalReference(Isolate* isolate) const);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks the reference to this object independent. Garbage collector is free
|
||||||
|
* to ignore any object groups containing this object. Weak callback for an
|
||||||
|
* independent handle should not assume that it will be preceded by a global
|
||||||
|
* GC prologue callback or followed by a global GC epilogue callback.
|
||||||
|
*/
|
||||||
|
V8_DEPRECATED(
|
||||||
|
"Weak objects are always considered independent. "
|
||||||
|
"Use TracedGlobal when trying to use EmbedderHeapTracer. "
|
||||||
|
"Use a strong handle when trying to keep an object alive.",
|
||||||
|
V8_INLINE void MarkIndependent());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks the reference to this object as active. The scavenge garbage
|
||||||
|
* collection should not reclaim the objects marked as active, even if the
|
||||||
|
* object held by the handle is otherwise unreachable.
|
||||||
|
*
|
||||||
|
* This bit is cleared after the each garbage collection pass.
|
||||||
|
*/
|
||||||
|
V8_DEPRECATED("Use TracedGlobal.", V8_INLINE void MarkActive());
|
||||||
|
|
||||||
|
V8_DEPRECATED("See MarkIndependent.", V8_INLINE bool IsIndependent() const);
|
||||||
|
|
||||||
/** Returns true if the handle's reference is weak. */
|
/** Returns true if the handle's reference is weak. */
|
||||||
V8_INLINE bool IsWeak() const;
|
V8_INLINE bool IsWeak() const;
|
||||||
|
|
||||||
|
|
@ -1900,11 +1933,6 @@ class V8_EXPORT StackFrame {
|
||||||
* Returns whether or not the associated functions is defined in wasm.
|
* Returns whether or not the associated functions is defined in wasm.
|
||||||
*/
|
*/
|
||||||
bool IsWasm() const;
|
bool IsWasm() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether or not the associated function is defined by the user.
|
|
||||||
*/
|
|
||||||
bool IsUserJavaScript() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1923,11 +1951,10 @@ enum StateTag {
|
||||||
// A RegisterState represents the current state of registers used
|
// A RegisterState represents the current state of registers used
|
||||||
// by the sampling profiler API.
|
// by the sampling profiler API.
|
||||||
struct RegisterState {
|
struct RegisterState {
|
||||||
RegisterState() : pc(nullptr), sp(nullptr), fp(nullptr), lr(nullptr) {}
|
RegisterState() : pc(nullptr), sp(nullptr), fp(nullptr) {}
|
||||||
void* pc; // Instruction pointer.
|
void* pc; // Instruction pointer.
|
||||||
void* sp; // Stack pointer.
|
void* sp; // Stack pointer.
|
||||||
void* fp; // Frame pointer.
|
void* fp; // Frame pointer.
|
||||||
void* lr; // Link register (or nullptr on platforms without a link register).
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// The output structure filled up by GetStackSample API function.
|
// The output structure filled up by GetStackSample API function.
|
||||||
|
|
@ -2093,10 +2120,10 @@ class V8_EXPORT ValueSerializer {
|
||||||
void WriteDouble(double value);
|
void WriteDouble(double value);
|
||||||
void WriteRawBytes(const void* source, size_t length);
|
void WriteRawBytes(const void* source, size_t length);
|
||||||
|
|
||||||
|
private:
|
||||||
ValueSerializer(const ValueSerializer&) = delete;
|
ValueSerializer(const ValueSerializer&) = delete;
|
||||||
void operator=(const ValueSerializer&) = delete;
|
void operator=(const ValueSerializer&) = delete;
|
||||||
|
|
||||||
private:
|
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
PrivateData* private_;
|
PrivateData* private_;
|
||||||
};
|
};
|
||||||
|
|
@ -2195,10 +2222,10 @@ class V8_EXPORT ValueDeserializer {
|
||||||
V8_WARN_UNUSED_RESULT bool ReadDouble(double* value);
|
V8_WARN_UNUSED_RESULT bool ReadDouble(double* value);
|
||||||
V8_WARN_UNUSED_RESULT bool ReadRawBytes(size_t length, const void** data);
|
V8_WARN_UNUSED_RESULT bool ReadRawBytes(size_t length, const void** data);
|
||||||
|
|
||||||
|
private:
|
||||||
ValueDeserializer(const ValueDeserializer&) = delete;
|
ValueDeserializer(const ValueDeserializer&) = delete;
|
||||||
void operator=(const ValueDeserializer&) = delete;
|
void operator=(const ValueDeserializer&) = delete;
|
||||||
|
|
||||||
private:
|
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
PrivateData* private_;
|
PrivateData* private_;
|
||||||
};
|
};
|
||||||
|
|
@ -2493,6 +2520,9 @@ class V8_EXPORT Value : public Data {
|
||||||
|
|
||||||
V8_WARN_UNUSED_RESULT MaybeLocal<BigInt> ToBigInt(
|
V8_WARN_UNUSED_RESULT MaybeLocal<BigInt> ToBigInt(
|
||||||
Local<Context> context) const;
|
Local<Context> context) const;
|
||||||
|
V8_DEPRECATED("ToBoolean can never throw. Use Local version.",
|
||||||
|
V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
|
||||||
|
Local<Context> context) const);
|
||||||
V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber(
|
V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber(
|
||||||
Local<Context> context) const;
|
Local<Context> context) const;
|
||||||
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
|
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
|
||||||
|
|
@ -2508,6 +2538,16 @@ class V8_EXPORT Value : public Data {
|
||||||
V8_WARN_UNUSED_RESULT MaybeLocal<Int32> ToInt32(Local<Context> context) const;
|
V8_WARN_UNUSED_RESULT MaybeLocal<Int32> ToInt32(Local<Context> context) const;
|
||||||
|
|
||||||
Local<Boolean> ToBoolean(Isolate* isolate) const;
|
Local<Boolean> ToBoolean(Isolate* isolate) const;
|
||||||
|
V8_DEPRECATED("Use maybe version",
|
||||||
|
Local<Number> ToNumber(Isolate* isolate) const);
|
||||||
|
V8_DEPRECATED("Use maybe version",
|
||||||
|
Local<String> ToString(Isolate* isolate) const);
|
||||||
|
V8_DEPRECATED("Use maybe version",
|
||||||
|
Local<Object> ToObject(Isolate* isolate) const);
|
||||||
|
V8_DEPRECATED("Use maybe version",
|
||||||
|
Local<Integer> ToInteger(Isolate* isolate) const);
|
||||||
|
V8_DEPRECATED("Use maybe version",
|
||||||
|
Local<Int32> ToInt32(Isolate* isolate) const);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to convert a string to an array index.
|
* Attempts to convert a string to an array index.
|
||||||
|
|
@ -2518,6 +2558,9 @@ class V8_EXPORT Value : public Data {
|
||||||
|
|
||||||
bool BooleanValue(Isolate* isolate) const;
|
bool BooleanValue(Isolate* isolate) const;
|
||||||
|
|
||||||
|
V8_DEPRECATED("BooleanValue can never throw. Use Isolate version.",
|
||||||
|
V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
|
||||||
|
Local<Context> context) const);
|
||||||
V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
|
V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
|
||||||
V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
|
V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
|
||||||
Local<Context> context) const;
|
Local<Context> context) const;
|
||||||
|
|
@ -2721,10 +2764,6 @@ class V8_EXPORT String : public Name {
|
||||||
*/
|
*/
|
||||||
virtual bool IsCacheable() const { return true; }
|
virtual bool IsCacheable() const { return true; }
|
||||||
|
|
||||||
// Disallow copying and assigning.
|
|
||||||
ExternalStringResourceBase(const ExternalStringResourceBase&) = delete;
|
|
||||||
void operator=(const ExternalStringResourceBase&) = delete;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ExternalStringResourceBase() = default;
|
ExternalStringResourceBase() = default;
|
||||||
|
|
||||||
|
|
@ -2754,6 +2793,10 @@ class V8_EXPORT String : public Name {
|
||||||
*/
|
*/
|
||||||
virtual void Unlock() const {}
|
virtual void Unlock() const {}
|
||||||
|
|
||||||
|
// Disallow copying and assigning.
|
||||||
|
ExternalStringResourceBase(const ExternalStringResourceBase&) = delete;
|
||||||
|
void operator=(const ExternalStringResourceBase&) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class internal::ExternalString;
|
friend class internal::ExternalString;
|
||||||
friend class v8::String;
|
friend class v8::String;
|
||||||
|
|
@ -2837,23 +2880,43 @@ class V8_EXPORT String : public Name {
|
||||||
|
|
||||||
V8_INLINE static String* Cast(v8::Value* obj);
|
V8_INLINE static String* Cast(v8::Value* obj);
|
||||||
|
|
||||||
|
// TODO(dcarney): remove with deprecation of New functions.
|
||||||
|
enum NewStringType {
|
||||||
|
kNormalString = static_cast<int>(v8::NewStringType::kNormal),
|
||||||
|
kInternalizedString = static_cast<int>(v8::NewStringType::kInternalized)
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Allocates a new string from UTF-8 data.*/
|
||||||
|
static V8_DEPRECATED(
|
||||||
|
"Use maybe version",
|
||||||
|
Local<String> NewFromUtf8(Isolate* isolate, const char* data,
|
||||||
|
NewStringType type = kNormalString,
|
||||||
|
int length = -1));
|
||||||
|
|
||||||
/** Allocates a new string from UTF-8 data. Only returns an empty value when
|
/** Allocates a new string from UTF-8 data. Only returns an empty value when
|
||||||
* length > kMaxLength. **/
|
* length > kMaxLength. **/
|
||||||
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromUtf8(
|
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromUtf8(
|
||||||
Isolate* isolate, const char* data,
|
Isolate* isolate, const char* data, v8::NewStringType type,
|
||||||
NewStringType type = NewStringType::kNormal, int length = -1);
|
int length = -1);
|
||||||
|
|
||||||
/** Allocates a new string from Latin-1 data. Only returns an empty value
|
/** Allocates a new string from Latin-1 data. Only returns an empty value
|
||||||
* when length > kMaxLength. **/
|
* when length > kMaxLength. **/
|
||||||
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromOneByte(
|
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromOneByte(
|
||||||
Isolate* isolate, const uint8_t* data,
|
Isolate* isolate, const uint8_t* data, v8::NewStringType type,
|
||||||
NewStringType type = NewStringType::kNormal, int length = -1);
|
int length = -1);
|
||||||
|
|
||||||
|
/** Allocates a new string from UTF-16 data.*/
|
||||||
|
static V8_DEPRECATED(
|
||||||
|
"Use maybe version",
|
||||||
|
Local<String> NewFromTwoByte(Isolate* isolate, const uint16_t* data,
|
||||||
|
NewStringType type = kNormalString,
|
||||||
|
int length = -1));
|
||||||
|
|
||||||
/** Allocates a new string from UTF-16 data. Only returns an empty value when
|
/** Allocates a new string from UTF-16 data. Only returns an empty value when
|
||||||
* length > kMaxLength. **/
|
* length > kMaxLength. **/
|
||||||
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte(
|
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte(
|
||||||
Isolate* isolate, const uint16_t* data,
|
Isolate* isolate, const uint16_t* data, v8::NewStringType type,
|
||||||
NewStringType type = NewStringType::kNormal, int length = -1);
|
int length = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new string by concatenating the left and the right strings
|
* Creates a new string by concatenating the left and the right strings
|
||||||
|
|
@ -2892,6 +2955,10 @@ class V8_EXPORT String : public Name {
|
||||||
* should the underlying buffer be deallocated or modified except through the
|
* should the underlying buffer be deallocated or modified except through the
|
||||||
* destructor of the external string resource.
|
* destructor of the external string resource.
|
||||||
*/
|
*/
|
||||||
|
static V8_DEPRECATED(
|
||||||
|
"Use maybe version",
|
||||||
|
Local<String> NewExternal(Isolate* isolate,
|
||||||
|
ExternalOneByteStringResource* resource));
|
||||||
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte(
|
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte(
|
||||||
Isolate* isolate, ExternalOneByteStringResource* resource);
|
Isolate* isolate, ExternalOneByteStringResource* resource);
|
||||||
|
|
||||||
|
|
@ -3288,8 +3355,8 @@ enum class IntegrityLevel { kFrozen, kSealed };
|
||||||
*/
|
*/
|
||||||
class V8_EXPORT Object : public Value {
|
class V8_EXPORT Object : public Value {
|
||||||
public:
|
public:
|
||||||
V8_DEPRECATED("Use maybe version",
|
V8_DEPRECATE_SOON("Use maybe version",
|
||||||
bool Set(Local<Value> key, Local<Value> value));
|
bool Set(Local<Value> key, Local<Value> value));
|
||||||
/**
|
/**
|
||||||
* Set only return Just(true) or Empty(), so if it should never fail, use
|
* Set only return Just(true) or Empty(), so if it should never fail, use
|
||||||
* result.Check().
|
* result.Check().
|
||||||
|
|
@ -3297,8 +3364,8 @@ class V8_EXPORT Object : public Value {
|
||||||
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
|
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
|
||||||
Local<Value> key, Local<Value> value);
|
Local<Value> key, Local<Value> value);
|
||||||
|
|
||||||
V8_DEPRECATED("Use maybe version",
|
V8_DEPRECATE_SOON("Use maybe version",
|
||||||
bool Set(uint32_t index, Local<Value> value));
|
bool Set(uint32_t index, Local<Value> value));
|
||||||
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
|
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
|
||||||
Local<Value> value);
|
Local<Value> value);
|
||||||
|
|
||||||
|
|
@ -3342,11 +3409,11 @@ class V8_EXPORT Object : public Value {
|
||||||
V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty(
|
V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty(
|
||||||
Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
|
Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
|
||||||
|
|
||||||
V8_DEPRECATED("Use maybe version", Local<Value> Get(Local<Value> key));
|
V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Local<Value> key));
|
||||||
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
|
||||||
Local<Value> key);
|
Local<Value> key);
|
||||||
|
|
||||||
V8_DEPRECATED("Use maybe version", Local<Value> Get(uint32_t index));
|
V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(uint32_t index));
|
||||||
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
|
||||||
uint32_t index);
|
uint32_t index);
|
||||||
|
|
||||||
|
|
@ -3830,6 +3897,9 @@ class ReturnValue {
|
||||||
}
|
}
|
||||||
// Local setters
|
// Local setters
|
||||||
template <typename S>
|
template <typename S>
|
||||||
|
V8_INLINE V8_DEPRECATED("Use Global<> instead",
|
||||||
|
void Set(const Persistent<S>& handle));
|
||||||
|
template <typename S>
|
||||||
V8_INLINE void Set(const Global<S>& handle);
|
V8_INLINE void Set(const Global<S>& handle);
|
||||||
template <typename S>
|
template <typename S>
|
||||||
V8_INLINE void Set(const TracedGlobal<S>& handle);
|
V8_INLINE void Set(const TracedGlobal<S>& handle);
|
||||||
|
|
@ -5217,6 +5287,38 @@ class V8_EXPORT Date : public Object {
|
||||||
|
|
||||||
V8_INLINE static Date* Cast(Value* obj);
|
V8_INLINE static Date* Cast(Value* obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time zone redetection indicator for
|
||||||
|
* DateTimeConfigurationChangeNotification.
|
||||||
|
*
|
||||||
|
* kSkip indicates V8 that the notification should not trigger redetecting
|
||||||
|
* host time zone. kRedetect indicates V8 that host time zone should be
|
||||||
|
* redetected, and used to set the default time zone.
|
||||||
|
*
|
||||||
|
* The host time zone detection may require file system access or similar
|
||||||
|
* operations unlikely to be available inside a sandbox. If v8 is run inside a
|
||||||
|
* sandbox, the host time zone has to be detected outside the sandbox before
|
||||||
|
* calling DateTimeConfigurationChangeNotification function.
|
||||||
|
*/
|
||||||
|
enum class TimeZoneDetection { kSkip, kRedetect };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notification that the embedder has changed the time zone,
|
||||||
|
* daylight savings time, or other date / time configuration
|
||||||
|
* parameters. V8 keeps a cache of various values used for
|
||||||
|
* date / time computation. This notification will reset
|
||||||
|
* those cached values for the current context so that date /
|
||||||
|
* time configuration changes would be reflected in the Date
|
||||||
|
* object.
|
||||||
|
*
|
||||||
|
* This API should not be called more than needed as it will
|
||||||
|
* negatively impact the performance of date operations.
|
||||||
|
*/
|
||||||
|
V8_DEPRECATED("Use Isolate::DateTimeConfigurationChangeNotification",
|
||||||
|
static void DateTimeConfigurationChangeNotification(
|
||||||
|
Isolate* isolate, TimeZoneDetection time_zone_detection =
|
||||||
|
TimeZoneDetection::kSkip));
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void CheckCast(Value* obj);
|
static void CheckCast(Value* obj);
|
||||||
};
|
};
|
||||||
|
|
@ -5902,6 +6004,21 @@ class V8_EXPORT FunctionTemplate : public Template {
|
||||||
*/
|
*/
|
||||||
void SetAcceptAnyReceiver(bool value);
|
void SetAcceptAnyReceiver(bool value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the __proto__ accessor ignores instances of
|
||||||
|
* the function template. If instances of the function template are
|
||||||
|
* ignored, __proto__ skips all instances and instead returns the
|
||||||
|
* next object in the prototype chain.
|
||||||
|
*
|
||||||
|
* Call with a value of true to make the __proto__ accessor ignore
|
||||||
|
* instances of the function template. Call with a value of false
|
||||||
|
* to make the __proto__ accessor not ignore instances of the
|
||||||
|
* function template. By default, instances of a function template
|
||||||
|
* are not ignored.
|
||||||
|
*/
|
||||||
|
V8_DEPRECATED("This feature is incompatible with ES6+.",
|
||||||
|
void SetHiddenPrototype(bool value));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the ReadOnly flag in the attributes of the 'prototype' property
|
* Sets the ReadOnly flag in the attributes of the 'prototype' property
|
||||||
* of functions created from this FunctionTemplate to true.
|
* of functions created from this FunctionTemplate to true.
|
||||||
|
|
@ -6706,12 +6823,11 @@ class V8_EXPORT MicrotaskQueue {
|
||||||
*/
|
*/
|
||||||
virtual int GetMicrotasksScopeDepth() const = 0;
|
virtual int GetMicrotasksScopeDepth() const = 0;
|
||||||
|
|
||||||
MicrotaskQueue(const MicrotaskQueue&) = delete;
|
|
||||||
MicrotaskQueue& operator=(const MicrotaskQueue&) = delete;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class internal::MicrotaskQueue;
|
friend class internal::MicrotaskQueue;
|
||||||
MicrotaskQueue() = default;
|
MicrotaskQueue() = default;
|
||||||
|
MicrotaskQueue(const MicrotaskQueue&) = delete;
|
||||||
|
MicrotaskQueue& operator=(const MicrotaskQueue&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -7102,11 +7218,6 @@ enum class MemoryPressureLevel { kNone, kModerate, kCritical };
|
||||||
*/
|
*/
|
||||||
class V8_EXPORT EmbedderHeapTracer {
|
class V8_EXPORT EmbedderHeapTracer {
|
||||||
public:
|
public:
|
||||||
enum TraceFlags : uint64_t {
|
|
||||||
kNoFlags = 0,
|
|
||||||
kReduceMemory = 1 << 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Indicator for the stack state of the embedder.
|
// Indicator for the stack state of the embedder.
|
||||||
enum EmbedderStackState {
|
enum EmbedderStackState {
|
||||||
kUnknown,
|
kUnknown,
|
||||||
|
|
@ -7123,24 +7234,6 @@ class V8_EXPORT EmbedderHeapTracer {
|
||||||
virtual void VisitTracedGlobalHandle(const TracedGlobal<Value>& value) = 0;
|
virtual void VisitTracedGlobalHandle(const TracedGlobal<Value>& value) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Summary of a garbage collection cycle. See |TraceEpilogue| on how the
|
|
||||||
* summary is reported.
|
|
||||||
*/
|
|
||||||
struct TraceSummary {
|
|
||||||
/**
|
|
||||||
* Time spent managing the retained memory in milliseconds. This can e.g.
|
|
||||||
* include the time tracing through objects in the embedder.
|
|
||||||
*/
|
|
||||||
double time = 0.0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Memory retained by the embedder through the |EmbedderHeapTracer|
|
|
||||||
* mechanism in bytes.
|
|
||||||
*/
|
|
||||||
size_t allocated_size = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual ~EmbedderHeapTracer() = default;
|
virtual ~EmbedderHeapTracer() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -7163,8 +7256,7 @@ class V8_EXPORT EmbedderHeapTracer {
|
||||||
/**
|
/**
|
||||||
* Called at the beginning of a GC cycle.
|
* Called at the beginning of a GC cycle.
|
||||||
*/
|
*/
|
||||||
V8_DEPRECATE_SOON("Use version with flags.", virtual void TracePrologue()) {}
|
virtual void TracePrologue() = 0;
|
||||||
virtual void TracePrologue(TraceFlags flags);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to advance tracing in the embedder.
|
* Called to advance tracing in the embedder.
|
||||||
|
|
@ -7187,12 +7279,9 @@ class V8_EXPORT EmbedderHeapTracer {
|
||||||
/**
|
/**
|
||||||
* Called at the end of a GC cycle.
|
* Called at the end of a GC cycle.
|
||||||
*
|
*
|
||||||
* Note that allocation is *not* allowed within |TraceEpilogue|. Can be
|
* Note that allocation is *not* allowed within |TraceEpilogue|.
|
||||||
* overriden to fill a |TraceSummary| that is used by V8 to schedule future
|
|
||||||
* garbage collections.
|
|
||||||
*/
|
*/
|
||||||
virtual void TraceEpilogue() {}
|
virtual void TraceEpilogue() = 0;
|
||||||
virtual void TraceEpilogue(TraceSummary* trace_summary) { TraceEpilogue(); }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called upon entering the final marking pause. No more incremental marking
|
* Called upon entering the final marking pause. No more incremental marking
|
||||||
|
|
@ -7229,14 +7318,6 @@ class V8_EXPORT EmbedderHeapTracer {
|
||||||
*/
|
*/
|
||||||
void GarbageCollectionForTesting(EmbedderStackState stack_state);
|
void GarbageCollectionForTesting(EmbedderStackState stack_state);
|
||||||
|
|
||||||
/*
|
|
||||||
* Called by the embedder to signal newly allocated memory. Not bound to
|
|
||||||
* tracing phases. Embedders should trade off when increments are reported as
|
|
||||||
* V8 may consult global heuristics on whether to trigger garbage collection
|
|
||||||
* on this change.
|
|
||||||
*/
|
|
||||||
void IncreaseAllocatedSize(size_t bytes);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the v8::Isolate this tracer is attached too and |nullptr| if it
|
* Returns the v8::Isolate this tracer is attached too and |nullptr| if it
|
||||||
* is not attached to any v8::Isolate.
|
* is not attached to any v8::Isolate.
|
||||||
|
|
@ -8529,13 +8610,6 @@ class V8_EXPORT Isolate {
|
||||||
|
|
||||||
class V8_EXPORT StartupData {
|
class V8_EXPORT StartupData {
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* Whether the data created can be rehashed and and the hash seed can be
|
|
||||||
* recomputed when deserialized.
|
|
||||||
* Only valid for StartupData returned by SnapshotCreator::CreateBlob().
|
|
||||||
*/
|
|
||||||
bool CanBeRehashed() const;
|
|
||||||
|
|
||||||
const char* data;
|
const char* data;
|
||||||
int raw_size;
|
int raw_size;
|
||||||
};
|
};
|
||||||
|
|
@ -8594,10 +8668,7 @@ class V8_EXPORT V8 {
|
||||||
/**
|
/**
|
||||||
* Sets V8 flags from a string.
|
* Sets V8 flags from a string.
|
||||||
*/
|
*/
|
||||||
static void SetFlagsFromString(const char* str);
|
static void SetFlagsFromString(const char* str, int length);
|
||||||
static void SetFlagsFromString(const char* str, size_t length);
|
|
||||||
V8_DEPRECATED("use size_t version",
|
|
||||||
static void SetFlagsFromString(const char* str, int length));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets V8 flags from the command line.
|
* Sets V8 flags from the command line.
|
||||||
|
|
@ -8768,6 +8839,9 @@ class V8_EXPORT V8 {
|
||||||
const char* label);
|
const char* label);
|
||||||
static Value* Eternalize(Isolate* isolate, Value* handle);
|
static Value* Eternalize(Isolate* isolate, Value* handle);
|
||||||
|
|
||||||
|
static void RegisterExternallyReferencedObject(internal::Address* location,
|
||||||
|
internal::Isolate* isolate);
|
||||||
|
|
||||||
template <class K, class V, class T>
|
template <class K, class V, class T>
|
||||||
friend class PersistentValueMapBase;
|
friend class PersistentValueMapBase;
|
||||||
|
|
||||||
|
|
@ -9714,6 +9788,14 @@ void Persistent<T, M>::Copy(const Persistent<S, M2>& that) {
|
||||||
M::Copy(that, this);
|
M::Copy(that, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
bool PersistentBase<T>::IsIndependent() const {
|
||||||
|
typedef internal::Internals I;
|
||||||
|
if (this->IsEmpty()) return false;
|
||||||
|
return I::GetNodeFlag(reinterpret_cast<internal::Address*>(this->val_),
|
||||||
|
I::kNodeIsIndependentShift);
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
bool PersistentBase<T>::IsWeak() const {
|
bool PersistentBase<T>::IsWeak() const {
|
||||||
typedef internal::Internals I;
|
typedef internal::Internals I;
|
||||||
|
|
@ -9780,6 +9862,31 @@ void PersistentBase<T>::AnnotateStrongRetainer(const char* label) {
|
||||||
label);
|
label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void PersistentBase<T>::RegisterExternalReference(Isolate* isolate) const {
|
||||||
|
if (IsEmpty()) return;
|
||||||
|
V8::RegisterExternallyReferencedObject(
|
||||||
|
reinterpret_cast<internal::Address*>(this->val_),
|
||||||
|
reinterpret_cast<internal::Isolate*>(isolate));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void PersistentBase<T>::MarkIndependent() {
|
||||||
|
typedef internal::Internals I;
|
||||||
|
if (this->IsEmpty()) return;
|
||||||
|
I::UpdateNodeFlag(reinterpret_cast<internal::Address*>(this->val_), true,
|
||||||
|
I::kNodeIsIndependentShift);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void PersistentBase<T>::MarkActive() {
|
||||||
|
typedef internal::Internals I;
|
||||||
|
if (this->IsEmpty()) return;
|
||||||
|
I::UpdateNodeFlag(reinterpret_cast<internal::Address*>(this->val_), true,
|
||||||
|
I::kNodeIsActiveShift);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) {
|
void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) {
|
||||||
typedef internal::Internals I;
|
typedef internal::Internals I;
|
||||||
|
|
@ -9905,6 +10012,17 @@ void TracedGlobal<T>::SetFinalizationCallback(
|
||||||
template <typename T>
|
template <typename T>
|
||||||
ReturnValue<T>::ReturnValue(internal::Address* slot) : value_(slot) {}
|
ReturnValue<T>::ReturnValue(internal::Address* slot) : value_(slot) {}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
template<typename S>
|
||||||
|
void ReturnValue<T>::Set(const Persistent<S>& handle) {
|
||||||
|
TYPE_CHECK(T, S);
|
||||||
|
if (V8_UNLIKELY(handle.IsEmpty())) {
|
||||||
|
*value_ = GetDefaultValue();
|
||||||
|
} else {
|
||||||
|
*value_ = *reinterpret_cast<internal::Address*>(*handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void ReturnValue<T>::Set(const Global<S>& handle) {
|
void ReturnValue<T>::Set(const Global<S>& handle) {
|
||||||
|
|
@ -10824,8 +10942,7 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
|
||||||
*external_memory = amount;
|
*external_memory = amount;
|
||||||
|
|
||||||
int64_t allocation_diff_since_last_mc =
|
int64_t allocation_diff_since_last_mc =
|
||||||
static_cast<int64_t>(static_cast<uint64_t>(*external_memory) -
|
*external_memory - *external_memory_at_last_mc;
|
||||||
static_cast<uint64_t>(*external_memory_at_last_mc));
|
|
||||||
// Only check memory pressure and potentially trigger GC if the amount of
|
// Only check memory pressure and potentially trigger GC if the amount of
|
||||||
// external memory increased.
|
// external memory increased.
|
||||||
if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
|
if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
include_rules = [
|
|
||||||
"+libplatform/libplatform-export.h",
|
|
||||||
]
|
|
||||||
|
|
||||||
specific_include_rules = {
|
|
||||||
"libplatform\.h": [
|
|
||||||
"+libplatform/v8-tracing.h",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
@ -23,8 +23,6 @@ class Mutex;
|
||||||
namespace platform {
|
namespace platform {
|
||||||
namespace tracing {
|
namespace tracing {
|
||||||
|
|
||||||
class PerfettoTracingController;
|
|
||||||
|
|
||||||
const int kTraceMaxNumArgs = 2;
|
const int kTraceMaxNumArgs = 2;
|
||||||
|
|
||||||
class V8_PLATFORM_EXPORT TraceObject {
|
class V8_PLATFORM_EXPORT TraceObject {
|
||||||
|
|
@ -240,11 +238,6 @@ class V8_PLATFORM_EXPORT TracingController
|
||||||
TracingController();
|
TracingController();
|
||||||
~TracingController() override;
|
~TracingController() override;
|
||||||
void Initialize(TraceBuffer* trace_buffer);
|
void Initialize(TraceBuffer* trace_buffer);
|
||||||
#ifdef V8_USE_PERFETTO
|
|
||||||
// Must be called before StartTracing() if V8_USE_PERFETTO is true. Provides
|
|
||||||
// the output stream for the JSON trace data.
|
|
||||||
void InitializeForPerfetto(std::ostream* output_stream);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// v8::TracingController implementation.
|
// v8::TracingController implementation.
|
||||||
const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
|
const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
|
||||||
|
|
@ -287,11 +280,6 @@ class V8_PLATFORM_EXPORT TracingController
|
||||||
std::unique_ptr<base::Mutex> mutex_;
|
std::unique_ptr<base::Mutex> mutex_;
|
||||||
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
|
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
|
||||||
std::atomic_bool recording_{false};
|
std::atomic_bool recording_{false};
|
||||||
#ifdef V8_USE_PERFETTO
|
|
||||||
std::atomic_bool perfetto_recording_{false};
|
|
||||||
std::unique_ptr<PerfettoTracingController> perfetto_tracing_controller_;
|
|
||||||
std::ostream* output_stream_ = nullptr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Disallow copy and assign
|
// Disallow copy and assign
|
||||||
TracingController(const TracingController&) = delete;
|
TracingController(const TracingController&) = delete;
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ class V8_EXPORT V8ContextInfo {
|
||||||
|
|
||||||
static int executionContextId(v8::Local<v8::Context> context);
|
static int executionContextId(v8::Local<v8::Context> context);
|
||||||
|
|
||||||
|
private:
|
||||||
// Disallow copying and allocating this one.
|
// Disallow copying and allocating this one.
|
||||||
enum NotNullTagEnum { NotNullLiteral };
|
enum NotNullTagEnum { NotNullLiteral };
|
||||||
void* operator new(size_t) = delete;
|
void* operator new(size_t) = delete;
|
||||||
|
|
@ -130,11 +131,7 @@ class V8_EXPORT V8InspectorSession {
|
||||||
// Dispatching protocol messages.
|
// Dispatching protocol messages.
|
||||||
static bool canDispatchMethod(const StringView& method);
|
static bool canDispatchMethod(const StringView& method);
|
||||||
virtual void dispatchProtocolMessage(const StringView& message) = 0;
|
virtual void dispatchProtocolMessage(const StringView& message) = 0;
|
||||||
virtual V8_DEPRECATED("Use state() instead",
|
virtual std::unique_ptr<StringBuffer> stateJSON() = 0;
|
||||||
std::unique_ptr<StringBuffer> stateJSON()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
virtual std::vector<uint8_t> state() = 0;
|
|
||||||
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
||||||
supportedDomains() = 0;
|
supportedDomains() = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,32 +48,28 @@ const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
|
||||||
template <size_t tagged_ptr_size>
|
template <size_t tagged_ptr_size>
|
||||||
struct SmiTagging;
|
struct SmiTagging;
|
||||||
|
|
||||||
constexpr intptr_t kIntptrAllBitsSet = intptr_t{-1};
|
|
||||||
constexpr uintptr_t kUintptrAllBitsSet =
|
|
||||||
static_cast<uintptr_t>(kIntptrAllBitsSet);
|
|
||||||
|
|
||||||
// Smi constants for systems where tagged pointer is a 32-bit value.
|
// Smi constants for systems where tagged pointer is a 32-bit value.
|
||||||
template <>
|
template <>
|
||||||
struct SmiTagging<4> {
|
struct SmiTagging<4> {
|
||||||
enum { kSmiShiftSize = 0, kSmiValueSize = 31 };
|
enum { kSmiShiftSize = 0, kSmiValueSize = 31 };
|
||||||
|
|
||||||
static constexpr intptr_t kSmiMinValue =
|
|
||||||
static_cast<intptr_t>(kUintptrAllBitsSet << (kSmiValueSize - 1));
|
|
||||||
static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1);
|
|
||||||
|
|
||||||
V8_INLINE static int SmiToInt(const internal::Address value) {
|
V8_INLINE static int SmiToInt(const internal::Address value) {
|
||||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||||
// Shift down (requires >> to be sign extending).
|
// Shift down (requires >> to be sign extending).
|
||||||
return static_cast<int>(static_cast<intptr_t>(value)) >> shift_bits;
|
return static_cast<int>(static_cast<intptr_t>(value)) >> shift_bits;
|
||||||
}
|
}
|
||||||
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
|
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
|
||||||
// Is value in range [kSmiMinValue, kSmiMaxValue].
|
// To be representable as an tagged small integer, the two
|
||||||
// Use unsigned operations in order to avoid undefined behaviour in case of
|
// most-significant bits of 'value' must be either 00 or 11 due to
|
||||||
// signed integer overflow.
|
// sign-extension. To check this we add 01 to the two
|
||||||
return (static_cast<uintptr_t>(value) -
|
// most-significant bits, and check if the most-significant bit is 0.
|
||||||
static_cast<uintptr_t>(kSmiMinValue)) <=
|
//
|
||||||
(static_cast<uintptr_t>(kSmiMaxValue) -
|
// CAUTION: The original code below:
|
||||||
static_cast<uintptr_t>(kSmiMinValue));
|
// bool result = ((value + 0x40000000) & 0x80000000) == 0;
|
||||||
|
// may lead to incorrect results according to the C language spec, and
|
||||||
|
// in fact doesn't work correctly with gcc4.1.1 in some cases: The
|
||||||
|
// compiler may produce undefined results in case of signed integer
|
||||||
|
// overflow. The computation must be done w/ unsigned ints.
|
||||||
|
return static_cast<uintptr_t>(value) + 0x40000000U < 0x80000000U;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -81,11 +77,6 @@ struct SmiTagging<4> {
|
||||||
template <>
|
template <>
|
||||||
struct SmiTagging<8> {
|
struct SmiTagging<8> {
|
||||||
enum { kSmiShiftSize = 31, kSmiValueSize = 32 };
|
enum { kSmiShiftSize = 31, kSmiValueSize = 32 };
|
||||||
|
|
||||||
static constexpr intptr_t kSmiMinValue =
|
|
||||||
static_cast<intptr_t>(kUintptrAllBitsSet << (kSmiValueSize - 1));
|
|
||||||
static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1);
|
|
||||||
|
|
||||||
V8_INLINE static int SmiToInt(const internal::Address value) {
|
V8_INLINE static int SmiToInt(const internal::Address value) {
|
||||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||||
// Shift down and throw away top 32 bits.
|
// Shift down and throw away top 32 bits.
|
||||||
|
|
@ -107,15 +98,15 @@ const int kApiTaggedSize = kApiSystemPointerSize;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
|
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
|
||||||
using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
|
typedef SmiTagging<kApiInt32Size> PlatformSmiTagging;
|
||||||
#else
|
#else
|
||||||
using PlatformSmiTagging = SmiTagging<kApiTaggedSize>;
|
typedef SmiTagging<kApiTaggedSize> PlatformSmiTagging;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
|
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
|
||||||
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
|
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
|
||||||
const int kSmiMinValue = static_cast<int>(PlatformSmiTagging::kSmiMinValue);
|
const int kSmiMinValue = (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
|
||||||
const int kSmiMaxValue = static_cast<int>(PlatformSmiTagging::kSmiMaxValue);
|
const int kSmiMaxValue = -(kSmiMinValue + 1);
|
||||||
constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
|
constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
|
||||||
constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
|
constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
|
||||||
|
|
||||||
|
|
@ -174,6 +165,8 @@ class Internals {
|
||||||
static const int kNodeStateMask = 0x7;
|
static const int kNodeStateMask = 0x7;
|
||||||
static const int kNodeStateIsWeakValue = 2;
|
static const int kNodeStateIsWeakValue = 2;
|
||||||
static const int kNodeStateIsPendingValue = 3;
|
static const int kNodeStateIsPendingValue = 3;
|
||||||
|
static const int kNodeIsIndependentShift = 3;
|
||||||
|
static const int kNodeIsActiveShift = 4;
|
||||||
|
|
||||||
static const int kFirstNonstringType = 0x40;
|
static const int kFirstNonstringType = 0x40;
|
||||||
static const int kOddballType = 0x43;
|
static const int kOddballType = 0x43;
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ class TaskRunner {
|
||||||
TaskRunner() = default;
|
TaskRunner() = default;
|
||||||
virtual ~TaskRunner() = default;
|
virtual ~TaskRunner() = default;
|
||||||
|
|
||||||
|
private:
|
||||||
TaskRunner(const TaskRunner&) = delete;
|
TaskRunner(const TaskRunner&) = delete;
|
||||||
TaskRunner& operator=(const TaskRunner&) = delete;
|
TaskRunner& operator=(const TaskRunner&) = delete;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
#ifndef V8_V8_PROFILER_H_
|
#ifndef V8_V8_PROFILER_H_
|
||||||
#define V8_V8_PROFILER_H_
|
#define V8_V8_PROFILER_H_
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "v8.h" // NOLINT(build/include)
|
#include "v8.h" // NOLINT(build/include)
|
||||||
|
|
@ -298,53 +297,6 @@ enum CpuProfilingMode {
|
||||||
kCallerLineNumbers,
|
kCallerLineNumbers,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Determines how names are derived for functions sampled.
|
|
||||||
enum CpuProfilingNamingMode {
|
|
||||||
// Use the immediate name of functions at compilation time.
|
|
||||||
kStandardNaming,
|
|
||||||
// Use more verbose naming for functions without names, inferred from scope
|
|
||||||
// where possible.
|
|
||||||
kDebugNaming,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Optional profiling attributes.
|
|
||||||
*/
|
|
||||||
class V8_EXPORT CpuProfilingOptions {
|
|
||||||
public:
|
|
||||||
// Indicates that the sample buffer size should not be explicitly limited.
|
|
||||||
static const unsigned kNoSampleLimit = UINT_MAX;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \param mode Type of computation of stack frame line numbers.
|
|
||||||
* \param max_samples The maximum number of samples that should be recorded by
|
|
||||||
* the profiler. Samples obtained after this limit will be
|
|
||||||
* discarded.
|
|
||||||
* \param sampling_interval_us controls the profile-specific target
|
|
||||||
* sampling interval. The provided sampling
|
|
||||||
* interval will be snapped to the next lowest
|
|
||||||
* non-zero multiple of the profiler's sampling
|
|
||||||
* interval, set via SetSamplingInterval(). If
|
|
||||||
* zero, the sampling interval will be equal to
|
|
||||||
* the profiler's sampling interval.
|
|
||||||
*/
|
|
||||||
CpuProfilingOptions(CpuProfilingMode mode = kLeafNodeLineNumbers,
|
|
||||||
unsigned max_samples = kNoSampleLimit,
|
|
||||||
int sampling_interval_us = 0)
|
|
||||||
: mode_(mode),
|
|
||||||
max_samples_(max_samples),
|
|
||||||
sampling_interval_us_(sampling_interval_us) {}
|
|
||||||
|
|
||||||
CpuProfilingMode mode() const { return mode_; }
|
|
||||||
unsigned max_samples() const { return max_samples_; }
|
|
||||||
int sampling_interval_us() const { return sampling_interval_us_; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
CpuProfilingMode mode_;
|
|
||||||
unsigned max_samples_;
|
|
||||||
int sampling_interval_us_;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for controlling CPU profiling. Instance of the
|
* Interface for controlling CPU profiling. Instance of the
|
||||||
* profiler can be created using v8::CpuProfiler::New method.
|
* profiler can be created using v8::CpuProfiler::New method.
|
||||||
|
|
@ -356,8 +308,7 @@ class V8_EXPORT CpuProfiler {
|
||||||
* initialized. The profiler object must be disposed after use by calling
|
* initialized. The profiler object must be disposed after use by calling
|
||||||
* |Dispose| method.
|
* |Dispose| method.
|
||||||
*/
|
*/
|
||||||
static CpuProfiler* New(Isolate* isolate,
|
static CpuProfiler* New(Isolate* isolate);
|
||||||
CpuProfilingNamingMode = kDebugNaming);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronously collect current stack sample in all profilers attached to
|
* Synchronously collect current stack sample in all profilers attached to
|
||||||
|
|
@ -388,26 +339,18 @@ class V8_EXPORT CpuProfiler {
|
||||||
void SetUsePreciseSampling(bool);
|
void SetUsePreciseSampling(bool);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts collecting a CPU profile. Title may be an empty string. Several
|
* Starts collecting CPU profile. Title may be an empty string. It
|
||||||
* profiles may be collected at once. Attempts to start collecting several
|
* is allowed to have several profiles being collected at
|
||||||
* profiles with the same title are silently ignored.
|
* once. Attempts to start collecting several profiles with the same
|
||||||
*/
|
* title are silently ignored. While collecting a profile, functions
|
||||||
void StartProfiling(Local<String> title, CpuProfilingOptions options);
|
* from all security contexts are included in it. The token-based
|
||||||
|
* filtering is only performed when querying for a profile.
|
||||||
/**
|
|
||||||
* Starts profiling with the same semantics as above, except with expanded
|
|
||||||
* parameters.
|
|
||||||
*
|
*
|
||||||
* |record_samples| parameter controls whether individual samples should
|
* |record_samples| parameter controls whether individual samples should
|
||||||
* be recorded in addition to the aggregated tree.
|
* be recorded in addition to the aggregated tree.
|
||||||
*
|
|
||||||
* |max_samples| controls the maximum number of samples that should be
|
|
||||||
* recorded by the profiler. Samples obtained after this limit will be
|
|
||||||
* discarded.
|
|
||||||
*/
|
*/
|
||||||
void StartProfiling(
|
void StartProfiling(Local<String> title, CpuProfilingMode mode,
|
||||||
Local<String> title, CpuProfilingMode mode, bool record_samples = false,
|
bool record_samples = false);
|
||||||
unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
|
|
||||||
/**
|
/**
|
||||||
* The same as StartProfiling above, but the CpuProfilingMode defaults to
|
* The same as StartProfiling above, but the CpuProfilingMode defaults to
|
||||||
* kLeafNodeLineNumbers mode, which was the previous default behavior of the
|
* kLeafNodeLineNumbers mode, which was the previous default behavior of the
|
||||||
|
|
@ -448,6 +391,7 @@ class V8_EXPORT CpuProfiler {
|
||||||
CpuProfiler& operator=(const CpuProfiler&);
|
CpuProfiler& operator=(const CpuProfiler&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HeapSnapshotEdge represents a directed connection between heap
|
* HeapSnapshotEdge represents a directed connection between heap
|
||||||
* graph nodes: from retainers to retained nodes.
|
* graph nodes: from retainers to retained nodes.
|
||||||
|
|
@ -798,6 +742,7 @@ class V8_EXPORT EmbedderGraph {
|
||||||
*/
|
*/
|
||||||
virtual const char* NamePrefix() { return nullptr; }
|
virtual const char* NamePrefix() { return nullptr; }
|
||||||
|
|
||||||
|
private:
|
||||||
Node(const Node&) = delete;
|
Node(const Node&) = delete;
|
||||||
Node& operator=(const Node&) = delete;
|
Node& operator=(const Node&) = delete;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -194,6 +194,14 @@ class PersistentValueMapBase {
|
||||||
return SetReturnValueFromVal(&returnValue, Traits::Get(&impl_, key));
|
return SetReturnValueFromVal(&returnValue, Traits::Get(&impl_, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call V8::RegisterExternallyReferencedObject with the map value for given
|
||||||
|
* key.
|
||||||
|
*/
|
||||||
|
V8_DEPRECATED(
|
||||||
|
"Used TracedGlobal and EmbedderHeapTracer::RegisterEmbedderReference",
|
||||||
|
inline void RegisterExternallyReferencedObject(K& key));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return value for key and remove it from the map.
|
* Return value for key and remove it from the map.
|
||||||
*/
|
*/
|
||||||
|
|
@ -344,6 +352,16 @@ class PersistentValueMapBase {
|
||||||
const char* label_;
|
const char* label_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename K, typename V, typename Traits>
|
||||||
|
inline void
|
||||||
|
PersistentValueMapBase<K, V, Traits>::RegisterExternallyReferencedObject(
|
||||||
|
K& key) {
|
||||||
|
assert(Contains(key));
|
||||||
|
V8::RegisterExternallyReferencedObject(
|
||||||
|
reinterpret_cast<internal::Address*>(FromVal(Traits::Get(&impl_, key))),
|
||||||
|
reinterpret_cast<internal::Isolate*>(GetIsolate()));
|
||||||
|
}
|
||||||
|
|
||||||
template <typename K, typename V, typename Traits>
|
template <typename K, typename V, typename Traits>
|
||||||
class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
|
class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@
|
||||||
// NOTE these macros are used by some of the tool scripts and the build
|
// NOTE these macros are used by some of the tool scripts and the build
|
||||||
// system so their names cannot be changed without changing the scripts.
|
// system so their names cannot be changed without changing the scripts.
|
||||||
#define V8_MAJOR_VERSION 7
|
#define V8_MAJOR_VERSION 7
|
||||||
#define V8_MINOR_VERSION 6
|
#define V8_MINOR_VERSION 5
|
||||||
#define V8_BUILD_NUMBER 0
|
#define V8_BUILD_NUMBER 288
|
||||||
#define V8_PATCH_LEVEL 0
|
#define V8_PATCH_LEVEL 22
|
||||||
|
|
||||||
// Use 1 for candidates and 0 otherwise.
|
// Use 1 for candidates and 0 otherwise.
|
||||||
// (Boolean macro values are not supported by all preprocessors.)
|
// (Boolean macro values are not supported by all preprocessors.)
|
||||||
#define V8_IS_CANDIDATE_VERSION 1
|
#define V8_IS_CANDIDATE_VERSION 0
|
||||||
|
|
||||||
#endif // V8_INCLUDE_VERSION_H_
|
#endif // V8_INCLUDE_VERSION_H_
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ class ExternalString;
|
||||||
class Isolate;
|
class Isolate;
|
||||||
class LocalEmbedderHeapTracer;
|
class LocalEmbedderHeapTracer;
|
||||||
class MicrotaskQueue;
|
class MicrotaskQueue;
|
||||||
|
class NeverReadOnlySpaceObject;
|
||||||
struct ScriptStreamingData;
|
struct ScriptStreamingData;
|
||||||
template<typename T> class CustomArguments;
|
template<typename T> class CustomArguments;
|
||||||
class PropertyCallbackArguments;
|
class PropertyCallbackArguments;
|
||||||
|
|
@ -544,6 +545,38 @@ template <class T> class PersistentBase {
|
||||||
*/
|
*/
|
||||||
V8_INLINE void AnnotateStrongRetainer(const char* label);
|
V8_INLINE void AnnotateStrongRetainer(const char* label);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows the embedder to tell the v8 garbage collector that a certain object
|
||||||
|
* is alive. Only allowed when the embedder is asked to trace its heap by
|
||||||
|
* EmbedderHeapTracer.
|
||||||
|
*/
|
||||||
|
V8_DEPRECATED(
|
||||||
|
"Used TracedGlobal and EmbedderHeapTracer::RegisterEmbedderReference",
|
||||||
|
V8_INLINE void RegisterExternalReference(Isolate* isolate) const);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks the reference to this object independent. Garbage collector is free
|
||||||
|
* to ignore any object groups containing this object. Weak callback for an
|
||||||
|
* independent handle should not assume that it will be preceded by a global
|
||||||
|
* GC prologue callback or followed by a global GC epilogue callback.
|
||||||
|
*/
|
||||||
|
V8_DEPRECATED(
|
||||||
|
"Weak objects are always considered independent. "
|
||||||
|
"Use TracedGlobal when trying to use EmbedderHeapTracer. "
|
||||||
|
"Use a strong handle when trying to keep an object alive.",
|
||||||
|
V8_INLINE void MarkIndependent());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks the reference to this object as active. The scavenge garbage
|
||||||
|
* collection should not reclaim the objects marked as active, even if the
|
||||||
|
* object held by the handle is otherwise unreachable.
|
||||||
|
*
|
||||||
|
* This bit is cleared after the each garbage collection pass.
|
||||||
|
*/
|
||||||
|
V8_DEPRECATED("Use TracedGlobal.", V8_INLINE void MarkActive());
|
||||||
|
|
||||||
|
V8_DEPRECATED("See MarkIndependent.", V8_INLINE bool IsIndependent() const);
|
||||||
|
|
||||||
/** Returns true if the handle's reference is weak. */
|
/** Returns true if the handle's reference is weak. */
|
||||||
V8_INLINE bool IsWeak() const;
|
V8_INLINE bool IsWeak() const;
|
||||||
|
|
||||||
|
|
@ -1900,11 +1933,6 @@ class V8_EXPORT StackFrame {
|
||||||
* Returns whether or not the associated functions is defined in wasm.
|
* Returns whether or not the associated functions is defined in wasm.
|
||||||
*/
|
*/
|
||||||
bool IsWasm() const;
|
bool IsWasm() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether or not the associated function is defined by the user.
|
|
||||||
*/
|
|
||||||
bool IsUserJavaScript() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1923,11 +1951,10 @@ enum StateTag {
|
||||||
// A RegisterState represents the current state of registers used
|
// A RegisterState represents the current state of registers used
|
||||||
// by the sampling profiler API.
|
// by the sampling profiler API.
|
||||||
struct RegisterState {
|
struct RegisterState {
|
||||||
RegisterState() : pc(nullptr), sp(nullptr), fp(nullptr), lr(nullptr) {}
|
RegisterState() : pc(nullptr), sp(nullptr), fp(nullptr) {}
|
||||||
void* pc; // Instruction pointer.
|
void* pc; // Instruction pointer.
|
||||||
void* sp; // Stack pointer.
|
void* sp; // Stack pointer.
|
||||||
void* fp; // Frame pointer.
|
void* fp; // Frame pointer.
|
||||||
void* lr; // Link register (or nullptr on platforms without a link register).
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// The output structure filled up by GetStackSample API function.
|
// The output structure filled up by GetStackSample API function.
|
||||||
|
|
@ -2093,10 +2120,10 @@ class V8_EXPORT ValueSerializer {
|
||||||
void WriteDouble(double value);
|
void WriteDouble(double value);
|
||||||
void WriteRawBytes(const void* source, size_t length);
|
void WriteRawBytes(const void* source, size_t length);
|
||||||
|
|
||||||
|
private:
|
||||||
ValueSerializer(const ValueSerializer&) = delete;
|
ValueSerializer(const ValueSerializer&) = delete;
|
||||||
void operator=(const ValueSerializer&) = delete;
|
void operator=(const ValueSerializer&) = delete;
|
||||||
|
|
||||||
private:
|
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
PrivateData* private_;
|
PrivateData* private_;
|
||||||
};
|
};
|
||||||
|
|
@ -2195,10 +2222,10 @@ class V8_EXPORT ValueDeserializer {
|
||||||
V8_WARN_UNUSED_RESULT bool ReadDouble(double* value);
|
V8_WARN_UNUSED_RESULT bool ReadDouble(double* value);
|
||||||
V8_WARN_UNUSED_RESULT bool ReadRawBytes(size_t length, const void** data);
|
V8_WARN_UNUSED_RESULT bool ReadRawBytes(size_t length, const void** data);
|
||||||
|
|
||||||
|
private:
|
||||||
ValueDeserializer(const ValueDeserializer&) = delete;
|
ValueDeserializer(const ValueDeserializer&) = delete;
|
||||||
void operator=(const ValueDeserializer&) = delete;
|
void operator=(const ValueDeserializer&) = delete;
|
||||||
|
|
||||||
private:
|
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
PrivateData* private_;
|
PrivateData* private_;
|
||||||
};
|
};
|
||||||
|
|
@ -2493,6 +2520,9 @@ class V8_EXPORT Value : public Data {
|
||||||
|
|
||||||
V8_WARN_UNUSED_RESULT MaybeLocal<BigInt> ToBigInt(
|
V8_WARN_UNUSED_RESULT MaybeLocal<BigInt> ToBigInt(
|
||||||
Local<Context> context) const;
|
Local<Context> context) const;
|
||||||
|
V8_DEPRECATED("ToBoolean can never throw. Use Local version.",
|
||||||
|
V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
|
||||||
|
Local<Context> context) const);
|
||||||
V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber(
|
V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber(
|
||||||
Local<Context> context) const;
|
Local<Context> context) const;
|
||||||
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
|
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
|
||||||
|
|
@ -2508,6 +2538,16 @@ class V8_EXPORT Value : public Data {
|
||||||
V8_WARN_UNUSED_RESULT MaybeLocal<Int32> ToInt32(Local<Context> context) const;
|
V8_WARN_UNUSED_RESULT MaybeLocal<Int32> ToInt32(Local<Context> context) const;
|
||||||
|
|
||||||
Local<Boolean> ToBoolean(Isolate* isolate) const;
|
Local<Boolean> ToBoolean(Isolate* isolate) const;
|
||||||
|
V8_DEPRECATED("Use maybe version",
|
||||||
|
Local<Number> ToNumber(Isolate* isolate) const);
|
||||||
|
V8_DEPRECATED("Use maybe version",
|
||||||
|
Local<String> ToString(Isolate* isolate) const);
|
||||||
|
V8_DEPRECATED("Use maybe version",
|
||||||
|
Local<Object> ToObject(Isolate* isolate) const);
|
||||||
|
V8_DEPRECATED("Use maybe version",
|
||||||
|
Local<Integer> ToInteger(Isolate* isolate) const);
|
||||||
|
V8_DEPRECATED("Use maybe version",
|
||||||
|
Local<Int32> ToInt32(Isolate* isolate) const);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to convert a string to an array index.
|
* Attempts to convert a string to an array index.
|
||||||
|
|
@ -2518,6 +2558,9 @@ class V8_EXPORT Value : public Data {
|
||||||
|
|
||||||
bool BooleanValue(Isolate* isolate) const;
|
bool BooleanValue(Isolate* isolate) const;
|
||||||
|
|
||||||
|
V8_DEPRECATED("BooleanValue can never throw. Use Isolate version.",
|
||||||
|
V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
|
||||||
|
Local<Context> context) const);
|
||||||
V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
|
V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
|
||||||
V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
|
V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
|
||||||
Local<Context> context) const;
|
Local<Context> context) const;
|
||||||
|
|
@ -2721,10 +2764,6 @@ class V8_EXPORT String : public Name {
|
||||||
*/
|
*/
|
||||||
virtual bool IsCacheable() const { return true; }
|
virtual bool IsCacheable() const { return true; }
|
||||||
|
|
||||||
// Disallow copying and assigning.
|
|
||||||
ExternalStringResourceBase(const ExternalStringResourceBase&) = delete;
|
|
||||||
void operator=(const ExternalStringResourceBase&) = delete;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ExternalStringResourceBase() = default;
|
ExternalStringResourceBase() = default;
|
||||||
|
|
||||||
|
|
@ -2754,6 +2793,10 @@ class V8_EXPORT String : public Name {
|
||||||
*/
|
*/
|
||||||
virtual void Unlock() const {}
|
virtual void Unlock() const {}
|
||||||
|
|
||||||
|
// Disallow copying and assigning.
|
||||||
|
ExternalStringResourceBase(const ExternalStringResourceBase&) = delete;
|
||||||
|
void operator=(const ExternalStringResourceBase&) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class internal::ExternalString;
|
friend class internal::ExternalString;
|
||||||
friend class v8::String;
|
friend class v8::String;
|
||||||
|
|
@ -2837,23 +2880,43 @@ class V8_EXPORT String : public Name {
|
||||||
|
|
||||||
V8_INLINE static String* Cast(v8::Value* obj);
|
V8_INLINE static String* Cast(v8::Value* obj);
|
||||||
|
|
||||||
|
// TODO(dcarney): remove with deprecation of New functions.
|
||||||
|
enum NewStringType {
|
||||||
|
kNormalString = static_cast<int>(v8::NewStringType::kNormal),
|
||||||
|
kInternalizedString = static_cast<int>(v8::NewStringType::kInternalized)
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Allocates a new string from UTF-8 data.*/
|
||||||
|
static V8_DEPRECATED(
|
||||||
|
"Use maybe version",
|
||||||
|
Local<String> NewFromUtf8(Isolate* isolate, const char* data,
|
||||||
|
NewStringType type = kNormalString,
|
||||||
|
int length = -1));
|
||||||
|
|
||||||
/** Allocates a new string from UTF-8 data. Only returns an empty value when
|
/** Allocates a new string from UTF-8 data. Only returns an empty value when
|
||||||
* length > kMaxLength. **/
|
* length > kMaxLength. **/
|
||||||
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromUtf8(
|
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromUtf8(
|
||||||
Isolate* isolate, const char* data,
|
Isolate* isolate, const char* data, v8::NewStringType type,
|
||||||
NewStringType type = NewStringType::kNormal, int length = -1);
|
int length = -1);
|
||||||
|
|
||||||
/** Allocates a new string from Latin-1 data. Only returns an empty value
|
/** Allocates a new string from Latin-1 data. Only returns an empty value
|
||||||
* when length > kMaxLength. **/
|
* when length > kMaxLength. **/
|
||||||
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromOneByte(
|
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromOneByte(
|
||||||
Isolate* isolate, const uint8_t* data,
|
Isolate* isolate, const uint8_t* data, v8::NewStringType type,
|
||||||
NewStringType type = NewStringType::kNormal, int length = -1);
|
int length = -1);
|
||||||
|
|
||||||
|
/** Allocates a new string from UTF-16 data.*/
|
||||||
|
static V8_DEPRECATED(
|
||||||
|
"Use maybe version",
|
||||||
|
Local<String> NewFromTwoByte(Isolate* isolate, const uint16_t* data,
|
||||||
|
NewStringType type = kNormalString,
|
||||||
|
int length = -1));
|
||||||
|
|
||||||
/** Allocates a new string from UTF-16 data. Only returns an empty value when
|
/** Allocates a new string from UTF-16 data. Only returns an empty value when
|
||||||
* length > kMaxLength. **/
|
* length > kMaxLength. **/
|
||||||
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte(
|
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte(
|
||||||
Isolate* isolate, const uint16_t* data,
|
Isolate* isolate, const uint16_t* data, v8::NewStringType type,
|
||||||
NewStringType type = NewStringType::kNormal, int length = -1);
|
int length = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new string by concatenating the left and the right strings
|
* Creates a new string by concatenating the left and the right strings
|
||||||
|
|
@ -2892,6 +2955,10 @@ class V8_EXPORT String : public Name {
|
||||||
* should the underlying buffer be deallocated or modified except through the
|
* should the underlying buffer be deallocated or modified except through the
|
||||||
* destructor of the external string resource.
|
* destructor of the external string resource.
|
||||||
*/
|
*/
|
||||||
|
static V8_DEPRECATED(
|
||||||
|
"Use maybe version",
|
||||||
|
Local<String> NewExternal(Isolate* isolate,
|
||||||
|
ExternalOneByteStringResource* resource));
|
||||||
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte(
|
static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte(
|
||||||
Isolate* isolate, ExternalOneByteStringResource* resource);
|
Isolate* isolate, ExternalOneByteStringResource* resource);
|
||||||
|
|
||||||
|
|
@ -3288,8 +3355,8 @@ enum class IntegrityLevel { kFrozen, kSealed };
|
||||||
*/
|
*/
|
||||||
class V8_EXPORT Object : public Value {
|
class V8_EXPORT Object : public Value {
|
||||||
public:
|
public:
|
||||||
V8_DEPRECATED("Use maybe version",
|
V8_DEPRECATE_SOON("Use maybe version",
|
||||||
bool Set(Local<Value> key, Local<Value> value));
|
bool Set(Local<Value> key, Local<Value> value));
|
||||||
/**
|
/**
|
||||||
* Set only return Just(true) or Empty(), so if it should never fail, use
|
* Set only return Just(true) or Empty(), so if it should never fail, use
|
||||||
* result.Check().
|
* result.Check().
|
||||||
|
|
@ -3297,8 +3364,8 @@ class V8_EXPORT Object : public Value {
|
||||||
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
|
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
|
||||||
Local<Value> key, Local<Value> value);
|
Local<Value> key, Local<Value> value);
|
||||||
|
|
||||||
V8_DEPRECATED("Use maybe version",
|
V8_DEPRECATE_SOON("Use maybe version",
|
||||||
bool Set(uint32_t index, Local<Value> value));
|
bool Set(uint32_t index, Local<Value> value));
|
||||||
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
|
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
|
||||||
Local<Value> value);
|
Local<Value> value);
|
||||||
|
|
||||||
|
|
@ -3342,11 +3409,11 @@ class V8_EXPORT Object : public Value {
|
||||||
V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty(
|
V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty(
|
||||||
Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
|
Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
|
||||||
|
|
||||||
V8_DEPRECATED("Use maybe version", Local<Value> Get(Local<Value> key));
|
V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(Local<Value> key));
|
||||||
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
|
||||||
Local<Value> key);
|
Local<Value> key);
|
||||||
|
|
||||||
V8_DEPRECATED("Use maybe version", Local<Value> Get(uint32_t index));
|
V8_DEPRECATE_SOON("Use maybe version", Local<Value> Get(uint32_t index));
|
||||||
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
|
V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
|
||||||
uint32_t index);
|
uint32_t index);
|
||||||
|
|
||||||
|
|
@ -3830,6 +3897,9 @@ class ReturnValue {
|
||||||
}
|
}
|
||||||
// Local setters
|
// Local setters
|
||||||
template <typename S>
|
template <typename S>
|
||||||
|
V8_INLINE V8_DEPRECATED("Use Global<> instead",
|
||||||
|
void Set(const Persistent<S>& handle));
|
||||||
|
template <typename S>
|
||||||
V8_INLINE void Set(const Global<S>& handle);
|
V8_INLINE void Set(const Global<S>& handle);
|
||||||
template <typename S>
|
template <typename S>
|
||||||
V8_INLINE void Set(const TracedGlobal<S>& handle);
|
V8_INLINE void Set(const TracedGlobal<S>& handle);
|
||||||
|
|
@ -5217,6 +5287,38 @@ class V8_EXPORT Date : public Object {
|
||||||
|
|
||||||
V8_INLINE static Date* Cast(Value* obj);
|
V8_INLINE static Date* Cast(Value* obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time zone redetection indicator for
|
||||||
|
* DateTimeConfigurationChangeNotification.
|
||||||
|
*
|
||||||
|
* kSkip indicates V8 that the notification should not trigger redetecting
|
||||||
|
* host time zone. kRedetect indicates V8 that host time zone should be
|
||||||
|
* redetected, and used to set the default time zone.
|
||||||
|
*
|
||||||
|
* The host time zone detection may require file system access or similar
|
||||||
|
* operations unlikely to be available inside a sandbox. If v8 is run inside a
|
||||||
|
* sandbox, the host time zone has to be detected outside the sandbox before
|
||||||
|
* calling DateTimeConfigurationChangeNotification function.
|
||||||
|
*/
|
||||||
|
enum class TimeZoneDetection { kSkip, kRedetect };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notification that the embedder has changed the time zone,
|
||||||
|
* daylight savings time, or other date / time configuration
|
||||||
|
* parameters. V8 keeps a cache of various values used for
|
||||||
|
* date / time computation. This notification will reset
|
||||||
|
* those cached values for the current context so that date /
|
||||||
|
* time configuration changes would be reflected in the Date
|
||||||
|
* object.
|
||||||
|
*
|
||||||
|
* This API should not be called more than needed as it will
|
||||||
|
* negatively impact the performance of date operations.
|
||||||
|
*/
|
||||||
|
V8_DEPRECATED("Use Isolate::DateTimeConfigurationChangeNotification",
|
||||||
|
static void DateTimeConfigurationChangeNotification(
|
||||||
|
Isolate* isolate, TimeZoneDetection time_zone_detection =
|
||||||
|
TimeZoneDetection::kSkip));
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void CheckCast(Value* obj);
|
static void CheckCast(Value* obj);
|
||||||
};
|
};
|
||||||
|
|
@ -5902,6 +6004,21 @@ class V8_EXPORT FunctionTemplate : public Template {
|
||||||
*/
|
*/
|
||||||
void SetAcceptAnyReceiver(bool value);
|
void SetAcceptAnyReceiver(bool value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether the __proto__ accessor ignores instances of
|
||||||
|
* the function template. If instances of the function template are
|
||||||
|
* ignored, __proto__ skips all instances and instead returns the
|
||||||
|
* next object in the prototype chain.
|
||||||
|
*
|
||||||
|
* Call with a value of true to make the __proto__ accessor ignore
|
||||||
|
* instances of the function template. Call with a value of false
|
||||||
|
* to make the __proto__ accessor not ignore instances of the
|
||||||
|
* function template. By default, instances of a function template
|
||||||
|
* are not ignored.
|
||||||
|
*/
|
||||||
|
V8_DEPRECATED("This feature is incompatible with ES6+.",
|
||||||
|
void SetHiddenPrototype(bool value));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the ReadOnly flag in the attributes of the 'prototype' property
|
* Sets the ReadOnly flag in the attributes of the 'prototype' property
|
||||||
* of functions created from this FunctionTemplate to true.
|
* of functions created from this FunctionTemplate to true.
|
||||||
|
|
@ -6706,12 +6823,11 @@ class V8_EXPORT MicrotaskQueue {
|
||||||
*/
|
*/
|
||||||
virtual int GetMicrotasksScopeDepth() const = 0;
|
virtual int GetMicrotasksScopeDepth() const = 0;
|
||||||
|
|
||||||
MicrotaskQueue(const MicrotaskQueue&) = delete;
|
|
||||||
MicrotaskQueue& operator=(const MicrotaskQueue&) = delete;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class internal::MicrotaskQueue;
|
friend class internal::MicrotaskQueue;
|
||||||
MicrotaskQueue() = default;
|
MicrotaskQueue() = default;
|
||||||
|
MicrotaskQueue(const MicrotaskQueue&) = delete;
|
||||||
|
MicrotaskQueue& operator=(const MicrotaskQueue&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -7102,11 +7218,6 @@ enum class MemoryPressureLevel { kNone, kModerate, kCritical };
|
||||||
*/
|
*/
|
||||||
class V8_EXPORT EmbedderHeapTracer {
|
class V8_EXPORT EmbedderHeapTracer {
|
||||||
public:
|
public:
|
||||||
enum TraceFlags : uint64_t {
|
|
||||||
kNoFlags = 0,
|
|
||||||
kReduceMemory = 1 << 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Indicator for the stack state of the embedder.
|
// Indicator for the stack state of the embedder.
|
||||||
enum EmbedderStackState {
|
enum EmbedderStackState {
|
||||||
kUnknown,
|
kUnknown,
|
||||||
|
|
@ -7123,24 +7234,6 @@ class V8_EXPORT EmbedderHeapTracer {
|
||||||
virtual void VisitTracedGlobalHandle(const TracedGlobal<Value>& value) = 0;
|
virtual void VisitTracedGlobalHandle(const TracedGlobal<Value>& value) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Summary of a garbage collection cycle. See |TraceEpilogue| on how the
|
|
||||||
* summary is reported.
|
|
||||||
*/
|
|
||||||
struct TraceSummary {
|
|
||||||
/**
|
|
||||||
* Time spent managing the retained memory in milliseconds. This can e.g.
|
|
||||||
* include the time tracing through objects in the embedder.
|
|
||||||
*/
|
|
||||||
double time = 0.0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Memory retained by the embedder through the |EmbedderHeapTracer|
|
|
||||||
* mechanism in bytes.
|
|
||||||
*/
|
|
||||||
size_t allocated_size = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual ~EmbedderHeapTracer() = default;
|
virtual ~EmbedderHeapTracer() = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -7163,8 +7256,7 @@ class V8_EXPORT EmbedderHeapTracer {
|
||||||
/**
|
/**
|
||||||
* Called at the beginning of a GC cycle.
|
* Called at the beginning of a GC cycle.
|
||||||
*/
|
*/
|
||||||
V8_DEPRECATE_SOON("Use version with flags.", virtual void TracePrologue()) {}
|
virtual void TracePrologue() = 0;
|
||||||
virtual void TracePrologue(TraceFlags flags);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to advance tracing in the embedder.
|
* Called to advance tracing in the embedder.
|
||||||
|
|
@ -7187,12 +7279,9 @@ class V8_EXPORT EmbedderHeapTracer {
|
||||||
/**
|
/**
|
||||||
* Called at the end of a GC cycle.
|
* Called at the end of a GC cycle.
|
||||||
*
|
*
|
||||||
* Note that allocation is *not* allowed within |TraceEpilogue|. Can be
|
* Note that allocation is *not* allowed within |TraceEpilogue|.
|
||||||
* overriden to fill a |TraceSummary| that is used by V8 to schedule future
|
|
||||||
* garbage collections.
|
|
||||||
*/
|
*/
|
||||||
virtual void TraceEpilogue() {}
|
virtual void TraceEpilogue() = 0;
|
||||||
virtual void TraceEpilogue(TraceSummary* trace_summary) { TraceEpilogue(); }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called upon entering the final marking pause. No more incremental marking
|
* Called upon entering the final marking pause. No more incremental marking
|
||||||
|
|
@ -7229,14 +7318,6 @@ class V8_EXPORT EmbedderHeapTracer {
|
||||||
*/
|
*/
|
||||||
void GarbageCollectionForTesting(EmbedderStackState stack_state);
|
void GarbageCollectionForTesting(EmbedderStackState stack_state);
|
||||||
|
|
||||||
/*
|
|
||||||
* Called by the embedder to signal newly allocated memory. Not bound to
|
|
||||||
* tracing phases. Embedders should trade off when increments are reported as
|
|
||||||
* V8 may consult global heuristics on whether to trigger garbage collection
|
|
||||||
* on this change.
|
|
||||||
*/
|
|
||||||
void IncreaseAllocatedSize(size_t bytes);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the v8::Isolate this tracer is attached too and |nullptr| if it
|
* Returns the v8::Isolate this tracer is attached too and |nullptr| if it
|
||||||
* is not attached to any v8::Isolate.
|
* is not attached to any v8::Isolate.
|
||||||
|
|
@ -8529,13 +8610,6 @@ class V8_EXPORT Isolate {
|
||||||
|
|
||||||
class V8_EXPORT StartupData {
|
class V8_EXPORT StartupData {
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* Whether the data created can be rehashed and and the hash seed can be
|
|
||||||
* recomputed when deserialized.
|
|
||||||
* Only valid for StartupData returned by SnapshotCreator::CreateBlob().
|
|
||||||
*/
|
|
||||||
bool CanBeRehashed() const;
|
|
||||||
|
|
||||||
const char* data;
|
const char* data;
|
||||||
int raw_size;
|
int raw_size;
|
||||||
};
|
};
|
||||||
|
|
@ -8594,10 +8668,7 @@ class V8_EXPORT V8 {
|
||||||
/**
|
/**
|
||||||
* Sets V8 flags from a string.
|
* Sets V8 flags from a string.
|
||||||
*/
|
*/
|
||||||
static void SetFlagsFromString(const char* str);
|
static void SetFlagsFromString(const char* str, int length);
|
||||||
static void SetFlagsFromString(const char* str, size_t length);
|
|
||||||
V8_DEPRECATED("use size_t version",
|
|
||||||
static void SetFlagsFromString(const char* str, int length));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets V8 flags from the command line.
|
* Sets V8 flags from the command line.
|
||||||
|
|
@ -8768,6 +8839,9 @@ class V8_EXPORT V8 {
|
||||||
const char* label);
|
const char* label);
|
||||||
static Value* Eternalize(Isolate* isolate, Value* handle);
|
static Value* Eternalize(Isolate* isolate, Value* handle);
|
||||||
|
|
||||||
|
static void RegisterExternallyReferencedObject(internal::Address* location,
|
||||||
|
internal::Isolate* isolate);
|
||||||
|
|
||||||
template <class K, class V, class T>
|
template <class K, class V, class T>
|
||||||
friend class PersistentValueMapBase;
|
friend class PersistentValueMapBase;
|
||||||
|
|
||||||
|
|
@ -9714,6 +9788,14 @@ void Persistent<T, M>::Copy(const Persistent<S, M2>& that) {
|
||||||
M::Copy(that, this);
|
M::Copy(that, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
bool PersistentBase<T>::IsIndependent() const {
|
||||||
|
typedef internal::Internals I;
|
||||||
|
if (this->IsEmpty()) return false;
|
||||||
|
return I::GetNodeFlag(reinterpret_cast<internal::Address*>(this->val_),
|
||||||
|
I::kNodeIsIndependentShift);
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
bool PersistentBase<T>::IsWeak() const {
|
bool PersistentBase<T>::IsWeak() const {
|
||||||
typedef internal::Internals I;
|
typedef internal::Internals I;
|
||||||
|
|
@ -9780,6 +9862,31 @@ void PersistentBase<T>::AnnotateStrongRetainer(const char* label) {
|
||||||
label);
|
label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void PersistentBase<T>::RegisterExternalReference(Isolate* isolate) const {
|
||||||
|
if (IsEmpty()) return;
|
||||||
|
V8::RegisterExternallyReferencedObject(
|
||||||
|
reinterpret_cast<internal::Address*>(this->val_),
|
||||||
|
reinterpret_cast<internal::Isolate*>(isolate));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void PersistentBase<T>::MarkIndependent() {
|
||||||
|
typedef internal::Internals I;
|
||||||
|
if (this->IsEmpty()) return;
|
||||||
|
I::UpdateNodeFlag(reinterpret_cast<internal::Address*>(this->val_), true,
|
||||||
|
I::kNodeIsIndependentShift);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
void PersistentBase<T>::MarkActive() {
|
||||||
|
typedef internal::Internals I;
|
||||||
|
if (this->IsEmpty()) return;
|
||||||
|
I::UpdateNodeFlag(reinterpret_cast<internal::Address*>(this->val_), true,
|
||||||
|
I::kNodeIsActiveShift);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) {
|
void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) {
|
||||||
typedef internal::Internals I;
|
typedef internal::Internals I;
|
||||||
|
|
@ -9905,6 +10012,17 @@ void TracedGlobal<T>::SetFinalizationCallback(
|
||||||
template <typename T>
|
template <typename T>
|
||||||
ReturnValue<T>::ReturnValue(internal::Address* slot) : value_(slot) {}
|
ReturnValue<T>::ReturnValue(internal::Address* slot) : value_(slot) {}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
template<typename S>
|
||||||
|
void ReturnValue<T>::Set(const Persistent<S>& handle) {
|
||||||
|
TYPE_CHECK(T, S);
|
||||||
|
if (V8_UNLIKELY(handle.IsEmpty())) {
|
||||||
|
*value_ = GetDefaultValue();
|
||||||
|
} else {
|
||||||
|
*value_ = *reinterpret_cast<internal::Address*>(*handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void ReturnValue<T>::Set(const Global<S>& handle) {
|
void ReturnValue<T>::Set(const Global<S>& handle) {
|
||||||
|
|
@ -10824,8 +10942,7 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory(
|
||||||
*external_memory = amount;
|
*external_memory = amount;
|
||||||
|
|
||||||
int64_t allocation_diff_since_last_mc =
|
int64_t allocation_diff_since_last_mc =
|
||||||
static_cast<int64_t>(static_cast<uint64_t>(*external_memory) -
|
*external_memory - *external_memory_at_last_mc;
|
||||||
static_cast<uint64_t>(*external_memory_at_last_mc));
|
|
||||||
// Only check memory pressure and potentially trigger GC if the amount of
|
// Only check memory pressure and potentially trigger GC if the amount of
|
||||||
// external memory increased.
|
// external memory increased.
|
||||||
if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
|
if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue