Upgrade V8 to 8.0.426.16 (#79)
* compile v8 * remove old libs * reduce size of monolith
This commit is contained in:
parent
7114e243d4
commit
de497900cf
|
|
@ -0,0 +1 @@
|
|||
.DS_Store
|
||||
|
|
@ -78,30 +78,6 @@ LOCAL_EXPORT_CPPFLAGS := -D__STDC_LIMIT_MACROS=1
|
|||
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_libbase
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/v8/libv8_libbase.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_libplatform
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/v8/libv8_libplatform.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_libsampler
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/v8/libv8_libsampler.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_snapshot
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/v8/libv8_snapshot.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_inspector
|
||||
|
|
@ -110,18 +86,13 @@ include $(PREBUILT_STATIC_LIBRARY)
|
|||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := v8_compiler
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/v8/libv8_compiler.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := v8_static
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/v8/libv8_base_without_compiler.a
|
||||
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/v8/libv8_monolith.a
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/$(TARGET_ARCH_ABI)/include/v8
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += v8_libbase v8_libplatform v8_libsampler v8_snapshot v8_compiler
|
||||
|
||||
ifeq ($(TARGET_ARCH),arm64)
|
||||
LOCAL_EXPORT_CPPFLAGS := -DV8_COMPRESS_POINTERS
|
||||
LOCAL_EXPORT_CFLAGS := -DV8_COMPRESS_POINTERS
|
||||
endif
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
#======================================
|
||||
|
|
|
|||
|
|
@ -67,3 +67,6 @@ which in turn guarantees long-term stability of the API.
|
|||
# The V8 inspector
|
||||
|
||||
All debugging capabilities of V8 should be exposed via the inspector protocol.
|
||||
The exception to this are profiling features exposed via v8-profiler.h.
|
||||
Changes to the inspector protocol need to ensure backwards compatibility and
|
||||
commitment to maintain.
|
||||
|
|
|
|||
|
|
@ -1,16 +1,18 @@
|
|||
set noparent
|
||||
|
||||
adamk@chromium.org
|
||||
danno@chromium.org
|
||||
ulan@chromium.org
|
||||
verwaest@chromium.org
|
||||
yangguo@chromium.org
|
||||
|
||||
per-file v8-internal.h=file://OWNERS
|
||||
per-file *DEPS=file:../COMMON_OWNERS
|
||||
per-file v8-internal.h=file:../COMMON_OWNERS
|
||||
per-file v8-inspector.h=dgozman@chromium.org
|
||||
per-file v8-inspector.h=pfeldman@chromium.org
|
||||
per-file v8-inspector.h=kozyatinskiy@chromium.org
|
||||
per-file v8-inspector-protocol.h=dgozman@chromium.org
|
||||
per-file v8-inspector-protocol.h=pfeldman@chromium.org
|
||||
per-file v8-inspector-protocol.h=kozyatinskiy@chromium.org
|
||||
per-file js_protocol.pdl=dgozman@chromium.org
|
||||
per-file js_protocol.pdl=pfeldman@chromium.org
|
||||
|
||||
# COMPONENT: Blink>JavaScript>API
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef V8_LIBPLATFORM_LIBPLATFORM_H_
|
||||
#define V8_LIBPLATFORM_LIBPLATFORM_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "libplatform/libplatform-export.h"
|
||||
#include "libplatform/v8-tracing.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
|
|
@ -70,11 +72,10 @@ V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform,
|
|||
* The |platform| has to be created using |NewDefaultPlatform|.
|
||||
*
|
||||
*/
|
||||
V8_PLATFORM_EXPORT V8_DEPRECATE_SOON(
|
||||
"Access the DefaultPlatform directly",
|
||||
void SetTracingController(
|
||||
v8::Platform* platform,
|
||||
v8::platform::tracing::TracingController* tracing_controller));
|
||||
V8_DEPRECATE_SOON("Access the DefaultPlatform directly")
|
||||
V8_PLATFORM_EXPORT void SetTracingController(
|
||||
v8::Platform* platform,
|
||||
v8::platform::tracing::TracingController* tracing_controller);
|
||||
|
||||
} // namespace platform
|
||||
} // namespace v8
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@
|
|||
#include "libplatform/libplatform-export.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
|
||||
namespace perfetto {
|
||||
class TracingSession;
|
||||
}
|
||||
|
||||
namespace v8 {
|
||||
|
||||
namespace base {
|
||||
|
|
@ -23,12 +27,15 @@ class Mutex;
|
|||
namespace platform {
|
||||
namespace tracing {
|
||||
|
||||
class TraceEventListener;
|
||||
class JSONTraceEventListener;
|
||||
|
||||
const int kTraceMaxNumArgs = 2;
|
||||
|
||||
class V8_PLATFORM_EXPORT TraceObject {
|
||||
public:
|
||||
union ArgValue {
|
||||
bool as_bool;
|
||||
V8_DEPRECATED("use as_uint ? true : false") bool as_bool;
|
||||
uint64_t as_uint;
|
||||
int64_t as_int;
|
||||
double as_double;
|
||||
|
|
@ -237,7 +244,17 @@ class V8_PLATFORM_EXPORT TracingController
|
|||
|
||||
TracingController();
|
||||
~TracingController() override;
|
||||
|
||||
// Takes ownership of |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);
|
||||
// Provide an optional listener for testing that will receive trace events.
|
||||
// Must be called before StartTracing().
|
||||
void SetTraceEventListenerForTesting(TraceEventListener* listener);
|
||||
#endif
|
||||
|
||||
// v8::TracingController implementation.
|
||||
const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
|
||||
|
|
@ -280,6 +297,12 @@ class V8_PLATFORM_EXPORT TracingController
|
|||
std::unique_ptr<base::Mutex> mutex_;
|
||||
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
|
||||
std::atomic_bool recording_{false};
|
||||
#ifdef V8_USE_PERFETTO
|
||||
std::ostream* output_stream_ = nullptr;
|
||||
std::unique_ptr<JSONTraceEventListener> json_listener_;
|
||||
TraceEventListener* listener_for_testing_ = nullptr;
|
||||
std::unique_ptr<perfetto::TracingSession> tracing_session_;
|
||||
#endif
|
||||
|
||||
// Disallow copy and assign
|
||||
TracingController(const TracingController&) = delete;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <cctype>
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "v8.h" // NOLINT(build/include)
|
||||
|
||||
|
|
@ -24,6 +25,7 @@ namespace Runtime {
|
|||
namespace API {
|
||||
class RemoteObject;
|
||||
class StackTrace;
|
||||
class StackTraceId;
|
||||
}
|
||||
}
|
||||
namespace Schema {
|
||||
|
|
@ -87,7 +89,6 @@ class V8_EXPORT V8ContextInfo {
|
|||
|
||||
static int executionContextId(v8::Local<v8::Context> context);
|
||||
|
||||
private:
|
||||
// Disallow copying and allocating this one.
|
||||
enum NotNullTagEnum { NotNullLiteral };
|
||||
void* operator new(size_t) = delete;
|
||||
|
|
@ -110,6 +111,8 @@ class V8_EXPORT V8StackTrace {
|
|||
virtual ~V8StackTrace() = default;
|
||||
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
||||
buildInspectorObject() const = 0;
|
||||
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
||||
buildInspectorObject(int maxAsyncDepth) const = 0;
|
||||
virtual std::unique_ptr<StringBuffer> toString() const = 0;
|
||||
|
||||
// Safe to pass between threads, drops async chain.
|
||||
|
|
@ -131,7 +134,7 @@ class V8_EXPORT V8InspectorSession {
|
|||
// Dispatching protocol messages.
|
||||
static bool canDispatchMethod(const StringView& method);
|
||||
virtual void dispatchProtocolMessage(const StringView& message) = 0;
|
||||
virtual std::unique_ptr<StringBuffer> stateJSON() = 0;
|
||||
virtual std::vector<uint8_t> state() = 0;
|
||||
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
||||
supportedDomains() = 0;
|
||||
|
||||
|
|
@ -228,12 +231,20 @@ class V8_EXPORT V8InspectorClient {
|
|||
struct V8_EXPORT V8StackTraceId {
|
||||
uintptr_t id;
|
||||
std::pair<int64_t, int64_t> debugger_id;
|
||||
bool should_pause = false;
|
||||
|
||||
V8StackTraceId();
|
||||
V8StackTraceId(const V8StackTraceId&) = default;
|
||||
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id);
|
||||
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id,
|
||||
bool should_pause);
|
||||
explicit V8StackTraceId(const StringView&);
|
||||
V8StackTraceId& operator=(const V8StackTraceId&) = default;
|
||||
V8StackTraceId& operator=(V8StackTraceId&&) noexcept = default;
|
||||
~V8StackTraceId() = default;
|
||||
|
||||
bool IsInvalid() const;
|
||||
std::unique_ptr<StringBuffer> ToString();
|
||||
};
|
||||
|
||||
class V8_EXPORT V8Inspector {
|
||||
|
|
@ -289,6 +300,24 @@ class V8_EXPORT V8Inspector {
|
|||
virtual std::unique_ptr<V8StackTrace> createStackTrace(
|
||||
v8::Local<v8::StackTrace>) = 0;
|
||||
virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
|
||||
|
||||
// Performance counters.
|
||||
class V8_EXPORT Counters : public std::enable_shared_from_this<Counters> {
|
||||
public:
|
||||
explicit Counters(v8::Isolate* isolate);
|
||||
~Counters();
|
||||
const std::unordered_map<std::string, int>& getCountersMap() const {
|
||||
return m_countersMap;
|
||||
}
|
||||
|
||||
private:
|
||||
static int* getCounterPtr(const char* name);
|
||||
|
||||
v8::Isolate* m_isolate;
|
||||
std::unordered_map<std::string, int> m_countersMap;
|
||||
};
|
||||
|
||||
virtual std::shared_ptr<Counters> enableCounters() = 0;
|
||||
};
|
||||
|
||||
} // namespace v8_inspector
|
||||
|
|
|
|||
|
|
@ -48,28 +48,32 @@ const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
|
|||
template <size_t tagged_ptr_size>
|
||||
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.
|
||||
template <>
|
||||
struct SmiTagging<4> {
|
||||
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) {
|
||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||
// Shift down (requires >> to be sign extending).
|
||||
return static_cast<int>(static_cast<intptr_t>(value)) >> shift_bits;
|
||||
// Truncate and shift down (requires >> to be sign extending).
|
||||
return static_cast<int32_t>(static_cast<uint32_t>(value)) >> shift_bits;
|
||||
}
|
||||
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
|
||||
// To be representable as an tagged small integer, the two
|
||||
// most-significant bits of 'value' must be either 00 or 11 due to
|
||||
// sign-extension. To check this we add 01 to the two
|
||||
// most-significant bits, and check if the most-significant bit is 0.
|
||||
//
|
||||
// CAUTION: The original code below:
|
||||
// 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;
|
||||
// Is value in range [kSmiMinValue, kSmiMaxValue].
|
||||
// Use unsigned operations in order to avoid undefined behaviour in case of
|
||||
// signed integer overflow.
|
||||
return (static_cast<uintptr_t>(value) -
|
||||
static_cast<uintptr_t>(kSmiMinValue)) <=
|
||||
(static_cast<uintptr_t>(kSmiMaxValue) -
|
||||
static_cast<uintptr_t>(kSmiMinValue));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -77,6 +81,11 @@ struct SmiTagging<4> {
|
|||
template <>
|
||||
struct SmiTagging<8> {
|
||||
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) {
|
||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||
// Shift down and throw away top 32 bits.
|
||||
|
|
@ -98,15 +107,17 @@ const int kApiTaggedSize = kApiSystemPointerSize;
|
|||
#endif
|
||||
|
||||
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
|
||||
typedef SmiTagging<kApiInt32Size> PlatformSmiTagging;
|
||||
using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
|
||||
#else
|
||||
typedef SmiTagging<kApiTaggedSize> PlatformSmiTagging;
|
||||
using PlatformSmiTagging = SmiTagging<kApiTaggedSize>;
|
||||
#endif
|
||||
|
||||
// TODO(ishell): Consinder adding kSmiShiftBits = kSmiShiftSize + kSmiTagSize
|
||||
// since it's used much more often than the inividual constants.
|
||||
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
|
||||
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
|
||||
const int kSmiMinValue = (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
|
||||
const int kSmiMaxValue = -(kSmiMinValue + 1);
|
||||
const int kSmiMinValue = static_cast<int>(PlatformSmiTagging::kSmiMinValue);
|
||||
const int kSmiMaxValue = static_cast<int>(PlatformSmiTagging::kSmiMaxValue);
|
||||
constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
|
||||
constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
|
||||
|
||||
|
|
@ -135,7 +146,7 @@ class Internals {
|
|||
static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize;
|
||||
static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize;
|
||||
static const int kEmbedderDataSlotSize = kApiSystemPointerSize;
|
||||
static const int kNativeContextEmbedderDataOffset = 7 * kApiTaggedSize;
|
||||
static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize;
|
||||
static const int kFullStringRepresentationMask = 0x0f;
|
||||
static const int kStringEncodingMask = 0x8;
|
||||
static const int kExternalTwoByteRepresentationTag = 0x02;
|
||||
|
|
@ -143,6 +154,7 @@ class Internals {
|
|||
|
||||
static const uint32_t kNumIsolateDataSlots = 4;
|
||||
|
||||
// IsolateData layout guarantees.
|
||||
static const int kIsolateEmbedderDataOffset = 0;
|
||||
static const int kExternalMemoryOffset =
|
||||
kNumIsolateDataSlots * kApiSystemPointerSize;
|
||||
|
|
@ -150,8 +162,14 @@ class Internals {
|
|||
kExternalMemoryOffset + kApiInt64Size;
|
||||
static const int kExternalMemoryAtLastMarkCompactOffset =
|
||||
kExternalMemoryLimitOffset + kApiInt64Size;
|
||||
static const int kIsolateRootsOffset =
|
||||
static const int kIsolateFastCCallCallerFpOffset =
|
||||
kExternalMemoryAtLastMarkCompactOffset + kApiInt64Size;
|
||||
static const int kIsolateFastCCallCallerPcOffset =
|
||||
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
|
||||
static const int kIsolateStackGuardOffset =
|
||||
kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize;
|
||||
static const int kIsolateRootsOffset =
|
||||
kIsolateStackGuardOffset + 7 * kApiSystemPointerSize;
|
||||
|
||||
static const int kUndefinedValueRootIndex = 4;
|
||||
static const int kTheHoleValueRootIndex = 5;
|
||||
|
|
@ -165,12 +183,10 @@ class Internals {
|
|||
static const int kNodeStateMask = 0x7;
|
||||
static const int kNodeStateIsWeakValue = 2;
|
||||
static const int kNodeStateIsPendingValue = 3;
|
||||
static const int kNodeIsIndependentShift = 3;
|
||||
static const int kNodeIsActiveShift = 4;
|
||||
|
||||
static const int kFirstNonstringType = 0x40;
|
||||
static const int kOddballType = 0x43;
|
||||
static const int kForeignType = 0x47;
|
||||
static const int kForeignType = 0x46;
|
||||
static const int kJSSpecialApiObjectType = 0x410;
|
||||
static const int kJSApiObjectType = 0x420;
|
||||
static const int kJSObjectType = 0x421;
|
||||
|
|
@ -313,14 +329,11 @@ class Internals {
|
|||
#ifdef V8_COMPRESS_POINTERS
|
||||
// See v8:7703 or src/ptr-compr.* for details about pointer compression.
|
||||
static constexpr size_t kPtrComprHeapReservationSize = size_t{1} << 32;
|
||||
static constexpr size_t kPtrComprIsolateRootBias =
|
||||
kPtrComprHeapReservationSize / 2;
|
||||
static constexpr size_t kPtrComprIsolateRootAlignment = size_t{1} << 32;
|
||||
|
||||
V8_INLINE static internal::Address GetRootFromOnHeapAddress(
|
||||
internal::Address addr) {
|
||||
return (addr + kPtrComprIsolateRootBias) &
|
||||
-static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
||||
return addr & -static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
||||
}
|
||||
|
||||
V8_INLINE static internal::Address DecompressTaggedAnyField(
|
||||
|
|
@ -367,6 +380,10 @@ V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);
|
|||
// language mode is strict.
|
||||
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate);
|
||||
|
||||
// A base class for backing stores, which is needed due to vagaries of
|
||||
// how static casts work with std::shared_ptr.
|
||||
class BackingStoreBase {};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ class TaskRunner {
|
|||
TaskRunner() = default;
|
||||
virtual ~TaskRunner() = default;
|
||||
|
||||
private:
|
||||
TaskRunner(const TaskRunner&) = delete;
|
||||
TaskRunner& operator=(const TaskRunner&) = delete;
|
||||
};
|
||||
|
|
@ -368,9 +367,8 @@ class Platform {
|
|||
* |isolate|. Tasks posted for the same isolate should be execute in order of
|
||||
* scheduling. The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallOnForegroundThread(Isolate* isolate, Task* task)) = 0;
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallOnForegroundThread(Isolate* isolate, Task* task) { abort(); }
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a foreground thread wrt a specific
|
||||
|
|
@ -378,10 +376,11 @@ class Platform {
|
|||
* Tasks posted for the same isolate should be execute in order of
|
||||
* scheduling. The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
||||
double delay_in_seconds)) = 0;
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
||||
double delay_in_seconds) {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a foreground thread wrt a specific
|
||||
|
|
@ -391,20 +390,15 @@ class Platform {
|
|||
* starved for an arbitrarily long time if no idle time is available.
|
||||
* The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallIdleOnForegroundThread(Isolate* isolate,
|
||||
IdleTask* task)) {
|
||||
// This must be overriden if |IdleTasksEnabled()|.
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if idle tasks are enabled for the given |isolate|.
|
||||
*/
|
||||
virtual bool IdleTasksEnabled(Isolate* isolate) {
|
||||
return false;
|
||||
}
|
||||
virtual bool IdleTasksEnabled(Isolate* isolate) { return false; }
|
||||
|
||||
/**
|
||||
* Monotonically increasing time in seconds from an arbitrary fixed point in
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@
|
|||
#ifndef V8_V8_PROFILER_H_
|
||||
#define V8_V8_PROFILER_H_
|
||||
|
||||
#include <limits.h>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "v8.h" // NOLINT(build/include)
|
||||
|
||||
/**
|
||||
|
|
@ -17,14 +20,18 @@ namespace v8 {
|
|||
class HeapGraphNode;
|
||||
struct HeapStatsUpdate;
|
||||
|
||||
typedef uint32_t SnapshotObjectId;
|
||||
|
||||
using NativeObject = void*;
|
||||
using SnapshotObjectId = uint32_t;
|
||||
|
||||
struct CpuProfileDeoptFrame {
|
||||
int script_id;
|
||||
size_t position;
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
class CpuProfile;
|
||||
} // namespace internal
|
||||
|
||||
} // namespace v8
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
|
|
@ -47,75 +54,6 @@ template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>;
|
|||
|
||||
namespace v8 {
|
||||
|
||||
// TickSample captures the information collected for each sample.
|
||||
struct V8_EXPORT TickSample {
|
||||
// Internal profiling (with --prof + tools/$OS-tick-processor) wants to
|
||||
// include the runtime function we're calling. Externally exposed tick
|
||||
// samples don't care.
|
||||
enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame };
|
||||
|
||||
TickSample()
|
||||
: state(OTHER),
|
||||
pc(nullptr),
|
||||
external_callback_entry(nullptr),
|
||||
frames_count(0),
|
||||
has_external_callback(false),
|
||||
update_stats(true) {}
|
||||
|
||||
/**
|
||||
* Initialize a tick sample from the isolate.
|
||||
* \param isolate The isolate.
|
||||
* \param state Execution state.
|
||||
* \param record_c_entry_frame Include or skip the runtime function.
|
||||
* \param update_stats Whether update the sample to the aggregated stats.
|
||||
* \param use_simulator_reg_state When set to true and V8 is running under a
|
||||
* simulator, the method will use the simulator
|
||||
* register state rather than the one provided
|
||||
* with |state| argument. Otherwise the method
|
||||
* will use provided register |state| as is.
|
||||
*/
|
||||
void Init(Isolate* isolate, const v8::RegisterState& state,
|
||||
RecordCEntryFrame record_c_entry_frame, bool update_stats,
|
||||
bool use_simulator_reg_state = true);
|
||||
/**
|
||||
* Get a call stack sample from the isolate.
|
||||
* \param isolate The isolate.
|
||||
* \param state Register state.
|
||||
* \param record_c_entry_frame Include or skip the runtime function.
|
||||
* \param frames Caller allocated buffer to store stack frames.
|
||||
* \param frames_limit Maximum number of frames to capture. The buffer must
|
||||
* be large enough to hold the number of frames.
|
||||
* \param sample_info The sample info is filled up by the function
|
||||
* provides number of actual captured stack frames and
|
||||
* the current VM state.
|
||||
* \param use_simulator_reg_state When set to true and V8 is running under a
|
||||
* simulator, the method will use the simulator
|
||||
* register state rather than the one provided
|
||||
* with |state| argument. Otherwise the method
|
||||
* will use provided register |state| as is.
|
||||
* \note GetStackSample is thread and signal safe and should only be called
|
||||
* when the JS thread is paused or interrupted.
|
||||
* Otherwise the behavior is undefined.
|
||||
*/
|
||||
static bool GetStackSample(Isolate* isolate, v8::RegisterState* state,
|
||||
RecordCEntryFrame record_c_entry_frame,
|
||||
void** frames, size_t frames_limit,
|
||||
v8::SampleInfo* sample_info,
|
||||
bool use_simulator_reg_state = true);
|
||||
StateTag state; // The state of the VM.
|
||||
void* pc; // Instruction pointer.
|
||||
union {
|
||||
void* tos; // Top stack value (*sp).
|
||||
void* external_callback_entry;
|
||||
};
|
||||
static const unsigned kMaxFramesCountLog2 = 8;
|
||||
static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1;
|
||||
void* stack[kMaxFramesCount]; // Call stack.
|
||||
unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames.
|
||||
bool has_external_callback : 1;
|
||||
bool update_stats : 1; // Whether the sample should update aggregated stats.
|
||||
};
|
||||
|
||||
/**
|
||||
* CpuProfileNode represents a node in a call graph.
|
||||
*/
|
||||
|
|
@ -206,11 +144,6 @@ class V8_EXPORT CpuProfileNode {
|
|||
*/
|
||||
unsigned GetHitCount() const;
|
||||
|
||||
/** Returns function entry UID. */
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use GetScriptId, GetLineNumber, and GetColumnNumber instead.",
|
||||
unsigned GetCallUid() const);
|
||||
|
||||
/** Returns id of the node. The id is unique within the tree */
|
||||
unsigned GetNodeId() const;
|
||||
|
||||
|
|
@ -297,6 +230,66 @@ enum CpuProfilingMode {
|
|||
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,
|
||||
};
|
||||
|
||||
enum CpuProfilingLoggingMode {
|
||||
// Enables logging when a profile is active, and disables logging when all
|
||||
// profiles are detached.
|
||||
kLazyLogging,
|
||||
// Enables logging for the lifetime of the CpuProfiler. Calls to
|
||||
// StartRecording are faster, at the expense of runtime overhead.
|
||||
kEagerLogging,
|
||||
};
|
||||
|
||||
/**
|
||||
* 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,
|
||||
MaybeLocal<Context> filter_context = MaybeLocal<Context>());
|
||||
|
||||
CpuProfilingMode mode() const { return mode_; }
|
||||
unsigned max_samples() const { return max_samples_; }
|
||||
int sampling_interval_us() const { return sampling_interval_us_; }
|
||||
|
||||
private:
|
||||
friend class internal::CpuProfile;
|
||||
|
||||
bool has_filter_context() const { return !filter_context_.IsEmpty(); }
|
||||
void* raw_filter_context() const;
|
||||
|
||||
CpuProfilingMode mode_;
|
||||
unsigned max_samples_;
|
||||
int sampling_interval_us_;
|
||||
CopyablePersistentTraits<Context>::CopyablePersistent filter_context_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for controlling CPU profiling. Instance of the
|
||||
* profiler can be created using v8::CpuProfiler::New method.
|
||||
|
|
@ -308,7 +301,9 @@ class V8_EXPORT CpuProfiler {
|
|||
* initialized. The profiler object must be disposed after use by calling
|
||||
* |Dispose| method.
|
||||
*/
|
||||
static CpuProfiler* New(Isolate* isolate);
|
||||
static CpuProfiler* New(Isolate* isolate,
|
||||
CpuProfilingNamingMode = kDebugNaming,
|
||||
CpuProfilingLoggingMode = kLazyLogging);
|
||||
|
||||
/**
|
||||
* Synchronously collect current stack sample in all profilers attached to
|
||||
|
|
@ -339,18 +334,26 @@ class V8_EXPORT CpuProfiler {
|
|||
void SetUsePreciseSampling(bool);
|
||||
|
||||
/**
|
||||
* Starts collecting CPU profile. Title may be an empty string. It
|
||||
* is allowed to have several profiles being collected at
|
||||
* once. Attempts to start collecting several profiles with the same
|
||||
* title are silently ignored. While collecting a profile, functions
|
||||
* from all security contexts are included in it. The token-based
|
||||
* filtering is only performed when querying for a profile.
|
||||
* Starts collecting a CPU profile. Title may be an empty string. Several
|
||||
* profiles may be collected at once. Attempts to start collecting several
|
||||
* profiles with the same title are silently ignored.
|
||||
*/
|
||||
void StartProfiling(Local<String> title, CpuProfilingOptions options);
|
||||
|
||||
/**
|
||||
* Starts profiling with the same semantics as above, except with expanded
|
||||
* parameters.
|
||||
*
|
||||
* |record_samples| parameter controls whether individual samples should
|
||||
* 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(Local<String> title, CpuProfilingMode mode,
|
||||
bool record_samples = false);
|
||||
void StartProfiling(
|
||||
Local<String> title, CpuProfilingMode mode, bool record_samples = false,
|
||||
unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
|
||||
/**
|
||||
* The same as StartProfiling above, but the CpuProfilingMode defaults to
|
||||
* kLeafNodeLineNumbers mode, which was the previous default behavior of the
|
||||
|
|
@ -364,20 +367,6 @@ class V8_EXPORT CpuProfiler {
|
|||
*/
|
||||
CpuProfile* StopProfiling(Local<String> title);
|
||||
|
||||
/**
|
||||
* Force collection of a sample. Must be called on the VM thread.
|
||||
* Recording the forced sample does not contribute to the aggregated
|
||||
* profile statistics.
|
||||
*/
|
||||
V8_DEPRECATED("Use static CollectSample(Isolate*) instead.",
|
||||
void CollectSample());
|
||||
|
||||
/**
|
||||
* Tells the profiler whether the embedder is idle.
|
||||
*/
|
||||
V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.",
|
||||
void SetIdle(bool is_idle));
|
||||
|
||||
/**
|
||||
* Generate more detailed source positions to code objects. This results in
|
||||
* better results when mapping profiling samples to script source.
|
||||
|
|
@ -391,7 +380,6 @@ class V8_EXPORT CpuProfiler {
|
|||
CpuProfiler& operator=(const CpuProfiler&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* HeapSnapshotEdge represents a directed connection between heap
|
||||
* graph nodes: from retainers to retained nodes.
|
||||
|
|
@ -742,7 +730,12 @@ class V8_EXPORT EmbedderGraph {
|
|||
*/
|
||||
virtual const char* NamePrefix() { return nullptr; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Returns the NativeObject that can be used for querying the
|
||||
* |HeapSnapshot|.
|
||||
*/
|
||||
virtual NativeObject GetNativeObject() { return nullptr; }
|
||||
|
||||
Node(const Node&) = delete;
|
||||
Node& operator=(const Node&) = delete;
|
||||
};
|
||||
|
|
@ -805,6 +798,12 @@ class V8_EXPORT HeapProfiler {
|
|||
*/
|
||||
SnapshotObjectId GetObjectId(Local<Value> value);
|
||||
|
||||
/**
|
||||
* Returns SnapshotObjectId for a native object referenced by |value| if it
|
||||
* has been seen by the heap profiler, kUnknownObjectId otherwise.
|
||||
*/
|
||||
SnapshotObjectId GetObjectId(NativeObject value);
|
||||
|
||||
/**
|
||||
* Returns heap object with given SnapshotObjectId if the object is alive,
|
||||
* otherwise empty handle is returned.
|
||||
|
|
@ -973,7 +972,8 @@ struct HeapStatsUpdate {
|
|||
V(LazyCompile) \
|
||||
V(RegExp) \
|
||||
V(Script) \
|
||||
V(Stub)
|
||||
V(Stub) \
|
||||
V(Relocation)
|
||||
|
||||
/**
|
||||
* Note that this enum may be extended in the future. Please include a default
|
||||
|
|
@ -1006,10 +1006,12 @@ class V8_EXPORT CodeEvent {
|
|||
const char* GetComment();
|
||||
|
||||
static const char* GetCodeEventTypeName(CodeEventType code_event_type);
|
||||
|
||||
uintptr_t GetPreviousCodeStartAddress();
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface to listen to code creation events.
|
||||
* Interface to listen to code creation and code relocation events.
|
||||
*/
|
||||
class V8_EXPORT CodeEventHandler {
|
||||
public:
|
||||
|
|
@ -1021,9 +1023,26 @@ class V8_EXPORT CodeEventHandler {
|
|||
explicit CodeEventHandler(Isolate* isolate);
|
||||
virtual ~CodeEventHandler();
|
||||
|
||||
/**
|
||||
* Handle is called every time a code object is created or moved. Information
|
||||
* about each code event will be available through the `code_event`
|
||||
* parameter.
|
||||
*
|
||||
* When the CodeEventType is kRelocationType, the code for this CodeEvent has
|
||||
* moved from `GetPreviousCodeStartAddress()` to `GetCodeStartAddress()`.
|
||||
*/
|
||||
virtual void Handle(CodeEvent* code_event) = 0;
|
||||
|
||||
/**
|
||||
* Call `Enable()` to starts listening to code creation and code relocation
|
||||
* events. These events will be handled by `Handle()`.
|
||||
*/
|
||||
void Enable();
|
||||
|
||||
/**
|
||||
* Call `Disable()` to stop listening to code creation and code relocation
|
||||
* events.
|
||||
*/
|
||||
void Disable();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -11,10 +11,9 @@
|
|||
* Testing support for the V8 JavaScript engine.
|
||||
*/
|
||||
namespace v8 {
|
||||
|
||||
class V8_EXPORT Testing {
|
||||
public:
|
||||
enum StressType {
|
||||
enum V8_DEPRECATED("Don't use this (d8-specific testing logic).") StressType {
|
||||
kStressTypeOpt,
|
||||
kStressTypeDeopt
|
||||
};
|
||||
|
|
@ -22,27 +21,30 @@ class V8_EXPORT Testing {
|
|||
/**
|
||||
* Set the type of stressing to do. The default if not set is kStressTypeOpt.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void SetStressRunType(StressType type);
|
||||
|
||||
/**
|
||||
* Get the number of runs of a given test that is required to get the full
|
||||
* stress coverage.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static int GetStressRuns();
|
||||
|
||||
/**
|
||||
* Indicate the number of the run which is about to start. The value of run
|
||||
* should be between 0 and one less than the result from GetStressRuns()
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void PrepareStressRun(int run);
|
||||
|
||||
/**
|
||||
* Force deoptimization of all functions.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void DeoptimizeAll(Isolate* isolate);
|
||||
};
|
||||
|
||||
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_V8_TEST_H_
|
||||
|
|
|
|||
|
|
@ -194,14 +194,6 @@ class PersistentValueMapBase {
|
|||
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.
|
||||
*/
|
||||
|
|
@ -352,16 +344,6 @@ class PersistentValueMapBase {
|
|||
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>
|
||||
class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
// These macros define the version number for the current version.
|
||||
// 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.
|
||||
#define V8_MAJOR_VERSION 7
|
||||
#define V8_MINOR_VERSION 5
|
||||
#define V8_BUILD_NUMBER 288
|
||||
#define V8_PATCH_LEVEL 30
|
||||
#define V8_MAJOR_VERSION 8
|
||||
#define V8_MINOR_VERSION 0
|
||||
#define V8_BUILD_NUMBER 426
|
||||
#define V8_PATCH_LEVEL 16
|
||||
|
||||
// Use 1 for candidates and 0 otherwise.
|
||||
// (Boolean macro values are not supported by all preprocessors.)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Operating system detection
|
||||
// Operating system detection (host)
|
||||
//
|
||||
// V8_OS_ANDROID - Android
|
||||
// V8_OS_BSD - BSDish (Mac OS X, Net/Free/Open/DragonFlyBSD)
|
||||
|
|
@ -122,6 +122,67 @@
|
|||
# define V8_OS_WIN 1
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Operating system detection (target)
|
||||
//
|
||||
// V8_TARGET_OS_ANDROID
|
||||
// V8_TARGET_OS_FUCHSIA
|
||||
// V8_TARGET_OS_IOS
|
||||
// V8_TARGET_OS_LINUX
|
||||
// V8_TARGET_OS_MACOSX
|
||||
// V8_TARGET_OS_WIN
|
||||
//
|
||||
// If not set explicitly, these fall back to corresponding V8_OS_ values.
|
||||
|
||||
#ifdef V8_HAVE_TARGET_OS
|
||||
|
||||
// The target OS is provided, just check that at least one known value is set.
|
||||
# if !defined(V8_TARGET_OS_ANDROID) \
|
||||
&& !defined(V8_TARGET_OS_FUCHSIA) \
|
||||
&& !defined(V8_TARGET_OS_IOS) \
|
||||
&& !defined(V8_TARGET_OS_LINUX) \
|
||||
&& !defined(V8_TARGET_OS_MACOSX) \
|
||||
&& !defined(V8_TARGET_OS_WIN)
|
||||
# error No known target OS defined.
|
||||
# endif
|
||||
|
||||
#else // V8_HAVE_TARGET_OS
|
||||
|
||||
# if defined(V8_TARGET_OS_ANDROID) \
|
||||
|| defined(V8_TARGET_OS_FUCHSIA) \
|
||||
|| defined(V8_TARGET_OS_IOS) \
|
||||
|| defined(V8_TARGET_OS_LINUX) \
|
||||
|| defined(V8_TARGET_OS_MACOSX) \
|
||||
|| defined(V8_TARGET_OS_WIN)
|
||||
# error A target OS is defined but V8_HAVE_TARGET_OS is unset.
|
||||
# endif
|
||||
|
||||
// Fall back to the detected host OS.
|
||||
#ifdef V8_OS_ANDROID
|
||||
# define V8_TARGET_OS_ANDROID
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_FUCHSIA
|
||||
# define V8_TARGET_OS_FUCHSIA
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_IOS
|
||||
# define V8_TARGET_OS_IOS
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_LINUX
|
||||
# define V8_TARGET_OS_LINUX
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_MACOSX
|
||||
# define V8_TARGET_OS_MACOSX
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
# define V8_TARGET_OS_WIN
|
||||
#endif
|
||||
|
||||
#endif // V8_HAVE_TARGET_OS
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// C library detection
|
||||
|
|
@ -169,7 +230,7 @@
|
|||
//
|
||||
// V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
|
||||
// supported
|
||||
// V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
|
||||
// V8_HAS_ATTRIBUTE_NONNULL - __attribute__((nonnull)) supported
|
||||
// V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
|
||||
// V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
|
||||
// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
|
||||
|
|
@ -186,10 +247,10 @@
|
|||
// V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported
|
||||
// V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported
|
||||
// V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported
|
||||
// V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
|
||||
// V8_HAS_COMPUTED_GOTO - computed goto/labels as values
|
||||
// supported
|
||||
// V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
|
||||
// V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported
|
||||
// V8_HAS_DECLSPEC_NORETURN - __declspec(noreturn) supported
|
||||
// V8_HAS___FORCEINLINE - __forceinline supported
|
||||
//
|
||||
// Note that testing for compilers and/or features must be done using #if
|
||||
|
|
@ -205,15 +266,14 @@
|
|||
#endif
|
||||
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE \
|
||||
(__has_extension(attribute_deprecated_with_message))
|
||||
# define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(__has_attribute(warn_unused_result))
|
||||
|
||||
# define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
|
||||
# define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
|
||||
# define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
|
||||
# define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
|
||||
|
|
@ -226,9 +286,13 @@
|
|||
# define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
|
||||
# define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
|
||||
|
||||
# if __cplusplus >= 201402L
|
||||
# define V8_CAN_HAVE_DCHECK_IN_CONSTEXPR 1
|
||||
# endif
|
||||
// Clang has no __has_feature for computed gotos.
|
||||
// GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
# define V8_HAS_COMPUTED_GOTO 1
|
||||
|
||||
// Whether constexpr has full C++14 semantics, in particular that non-constexpr
|
||||
// code is allowed as long as it's not executed for any constexpr instantiation.
|
||||
# define V8_HAS_CXX14_CONSTEXPR 1
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
|
|
@ -247,30 +311,34 @@
|
|||
// always_inline is available in gcc 4.0 but not very reliable until 4.4.
|
||||
// Works around "sorry, unimplemented: inlining failed" build errors with
|
||||
// older compilers.
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0))
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0))
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE 1
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE 1
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED 1
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY 1
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
|
||||
|
||||
# define V8_HAS_BUILTIN_CLZ (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_CTZ (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
|
||||
# define V8_HAS_BUILTIN_FRAME_ADDRESS (V8_GNUC_PREREQ(2, 96, 0))
|
||||
# define V8_HAS_BUILTIN_POPCOUNT (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
|
||||
# define V8_HAS_BUILTIN_CLZ 1
|
||||
# define V8_HAS_BUILTIN_CTZ 1
|
||||
# define V8_HAS_BUILTIN_EXPECT 1
|
||||
# define V8_HAS_BUILTIN_FRAME_ADDRESS 1
|
||||
# define V8_HAS_BUILTIN_POPCOUNT 1
|
||||
|
||||
// GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
#define V8_HAS_COMPUTED_GOTO 1
|
||||
|
||||
// Whether constexpr has full C++14 semantics, in particular that non-constexpr
|
||||
// code is allowed as long as it's not executed for any constexpr instantiation.
|
||||
// GCC only supports this since version 6.
|
||||
# define V8_HAS_CXX14_CONSTEXPR (V8_GNUC_PREREQ(6, 0, 0))
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define V8_CC_MSVC 1
|
||||
|
||||
# define V8_HAS_DECLSPEC_DEPRECATED 1
|
||||
# define V8_HAS_DECLSPEC_NOINLINE 1
|
||||
# define V8_HAS_DECLSPEC_SELECTANY 1
|
||||
# define V8_HAS_DECLSPEC_NORETURN 1
|
||||
|
||||
# define V8_HAS___FORCEINLINE 1
|
||||
|
||||
|
|
@ -291,6 +359,23 @@
|
|||
# define V8_INLINE inline
|
||||
#endif
|
||||
|
||||
#if V8_HAS_BUILTIN_ASSUME_ALIGNED
|
||||
# define V8_ASSUME_ALIGNED(ptr, alignment) \
|
||||
__builtin_assume_aligned((ptr), (alignment))
|
||||
#else
|
||||
# define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
|
||||
#endif
|
||||
|
||||
|
||||
// A macro to mark specific arguments as non-null.
|
||||
// Use like:
|
||||
// int add(int* x, int y, int* z) V8_NONNULL(1, 3) { return *x + y + *z; }
|
||||
#if V8_HAS_ATTRIBUTE_NONNULL
|
||||
# define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
#else
|
||||
# define V8_NONNULL(...) /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
|
||||
// A macro used to tell the compiler to never inline a particular function.
|
||||
// Don't bother for debug builds.
|
||||
|
|
@ -306,31 +391,18 @@
|
|||
|
||||
|
||||
// A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
|
||||
#if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
|
||||
#define V8_DEPRECATED(message, declarator) \
|
||||
declarator __attribute__((deprecated(message)))
|
||||
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
|
||||
#define V8_DEPRECATED(message, declarator) \
|
||||
declarator __attribute__((deprecated))
|
||||
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
|
||||
#define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
|
||||
#if defined(V8_DEPRECATION_WARNINGS)
|
||||
# define V8_DEPRECATED(message) [[deprecated(message)]]
|
||||
#else
|
||||
#define V8_DEPRECATED(message, declarator) declarator
|
||||
# define V8_DEPRECATED(message)
|
||||
#endif
|
||||
|
||||
|
||||
// A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS) && \
|
||||
V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
|
||||
#define V8_DEPRECATE_SOON(message, declarator) \
|
||||
declarator __attribute__((deprecated(message)))
|
||||
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
|
||||
#define V8_DEPRECATE_SOON(message, declarator) \
|
||||
declarator __attribute__((deprecated))
|
||||
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
|
||||
#define V8_DEPRECATE_SOON(message, declarator) __declspec(deprecated) declarator
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
|
||||
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
|
||||
#else
|
||||
#define V8_DEPRECATE_SOON(message, declarator) declarator
|
||||
# define V8_DEPRECATE_SOON(message)
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -353,6 +425,12 @@
|
|||
#define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
|
||||
#error Inconsistent build configuration: To build the V8 shared library \
|
||||
set BUILDING_V8_SHARED, to include its headers for linking against the \
|
||||
V8 shared library set USING_V8_SHARED.
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
|
||||
// Setup for Windows DLL export/import. When building the V8 DLL the
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -67,3 +67,6 @@ which in turn guarantees long-term stability of the API.
|
|||
# The V8 inspector
|
||||
|
||||
All debugging capabilities of V8 should be exposed via the inspector protocol.
|
||||
The exception to this are profiling features exposed via v8-profiler.h.
|
||||
Changes to the inspector protocol need to ensure backwards compatibility and
|
||||
commitment to maintain.
|
||||
|
|
|
|||
|
|
@ -1,16 +1,18 @@
|
|||
set noparent
|
||||
|
||||
adamk@chromium.org
|
||||
danno@chromium.org
|
||||
ulan@chromium.org
|
||||
verwaest@chromium.org
|
||||
yangguo@chromium.org
|
||||
|
||||
per-file v8-internal.h=file://OWNERS
|
||||
per-file *DEPS=file:../COMMON_OWNERS
|
||||
per-file v8-internal.h=file:../COMMON_OWNERS
|
||||
per-file v8-inspector.h=dgozman@chromium.org
|
||||
per-file v8-inspector.h=pfeldman@chromium.org
|
||||
per-file v8-inspector.h=kozyatinskiy@chromium.org
|
||||
per-file v8-inspector-protocol.h=dgozman@chromium.org
|
||||
per-file v8-inspector-protocol.h=pfeldman@chromium.org
|
||||
per-file v8-inspector-protocol.h=kozyatinskiy@chromium.org
|
||||
per-file js_protocol.pdl=dgozman@chromium.org
|
||||
per-file js_protocol.pdl=pfeldman@chromium.org
|
||||
|
||||
# COMPONENT: Blink>JavaScript>API
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef V8_LIBPLATFORM_LIBPLATFORM_H_
|
||||
#define V8_LIBPLATFORM_LIBPLATFORM_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "libplatform/libplatform-export.h"
|
||||
#include "libplatform/v8-tracing.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
|
|
@ -70,11 +72,10 @@ V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform,
|
|||
* The |platform| has to be created using |NewDefaultPlatform|.
|
||||
*
|
||||
*/
|
||||
V8_PLATFORM_EXPORT V8_DEPRECATE_SOON(
|
||||
"Access the DefaultPlatform directly",
|
||||
void SetTracingController(
|
||||
v8::Platform* platform,
|
||||
v8::platform::tracing::TracingController* tracing_controller));
|
||||
V8_DEPRECATE_SOON("Access the DefaultPlatform directly")
|
||||
V8_PLATFORM_EXPORT void SetTracingController(
|
||||
v8::Platform* platform,
|
||||
v8::platform::tracing::TracingController* tracing_controller);
|
||||
|
||||
} // namespace platform
|
||||
} // namespace v8
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@
|
|||
#include "libplatform/libplatform-export.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
|
||||
namespace perfetto {
|
||||
class TracingSession;
|
||||
}
|
||||
|
||||
namespace v8 {
|
||||
|
||||
namespace base {
|
||||
|
|
@ -23,12 +27,15 @@ class Mutex;
|
|||
namespace platform {
|
||||
namespace tracing {
|
||||
|
||||
class TraceEventListener;
|
||||
class JSONTraceEventListener;
|
||||
|
||||
const int kTraceMaxNumArgs = 2;
|
||||
|
||||
class V8_PLATFORM_EXPORT TraceObject {
|
||||
public:
|
||||
union ArgValue {
|
||||
bool as_bool;
|
||||
V8_DEPRECATED("use as_uint ? true : false") bool as_bool;
|
||||
uint64_t as_uint;
|
||||
int64_t as_int;
|
||||
double as_double;
|
||||
|
|
@ -237,7 +244,17 @@ class V8_PLATFORM_EXPORT TracingController
|
|||
|
||||
TracingController();
|
||||
~TracingController() override;
|
||||
|
||||
// Takes ownership of |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);
|
||||
// Provide an optional listener for testing that will receive trace events.
|
||||
// Must be called before StartTracing().
|
||||
void SetTraceEventListenerForTesting(TraceEventListener* listener);
|
||||
#endif
|
||||
|
||||
// v8::TracingController implementation.
|
||||
const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
|
||||
|
|
@ -280,6 +297,12 @@ class V8_PLATFORM_EXPORT TracingController
|
|||
std::unique_ptr<base::Mutex> mutex_;
|
||||
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
|
||||
std::atomic_bool recording_{false};
|
||||
#ifdef V8_USE_PERFETTO
|
||||
std::ostream* output_stream_ = nullptr;
|
||||
std::unique_ptr<JSONTraceEventListener> json_listener_;
|
||||
TraceEventListener* listener_for_testing_ = nullptr;
|
||||
std::unique_ptr<perfetto::TracingSession> tracing_session_;
|
||||
#endif
|
||||
|
||||
// Disallow copy and assign
|
||||
TracingController(const TracingController&) = delete;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <cctype>
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "v8.h" // NOLINT(build/include)
|
||||
|
||||
|
|
@ -24,6 +25,7 @@ namespace Runtime {
|
|||
namespace API {
|
||||
class RemoteObject;
|
||||
class StackTrace;
|
||||
class StackTraceId;
|
||||
}
|
||||
}
|
||||
namespace Schema {
|
||||
|
|
@ -87,7 +89,6 @@ class V8_EXPORT V8ContextInfo {
|
|||
|
||||
static int executionContextId(v8::Local<v8::Context> context);
|
||||
|
||||
private:
|
||||
// Disallow copying and allocating this one.
|
||||
enum NotNullTagEnum { NotNullLiteral };
|
||||
void* operator new(size_t) = delete;
|
||||
|
|
@ -110,6 +111,8 @@ class V8_EXPORT V8StackTrace {
|
|||
virtual ~V8StackTrace() = default;
|
||||
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
||||
buildInspectorObject() const = 0;
|
||||
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
||||
buildInspectorObject(int maxAsyncDepth) const = 0;
|
||||
virtual std::unique_ptr<StringBuffer> toString() const = 0;
|
||||
|
||||
// Safe to pass between threads, drops async chain.
|
||||
|
|
@ -131,7 +134,7 @@ class V8_EXPORT V8InspectorSession {
|
|||
// Dispatching protocol messages.
|
||||
static bool canDispatchMethod(const StringView& method);
|
||||
virtual void dispatchProtocolMessage(const StringView& message) = 0;
|
||||
virtual std::unique_ptr<StringBuffer> stateJSON() = 0;
|
||||
virtual std::vector<uint8_t> state() = 0;
|
||||
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
||||
supportedDomains() = 0;
|
||||
|
||||
|
|
@ -228,12 +231,20 @@ class V8_EXPORT V8InspectorClient {
|
|||
struct V8_EXPORT V8StackTraceId {
|
||||
uintptr_t id;
|
||||
std::pair<int64_t, int64_t> debugger_id;
|
||||
bool should_pause = false;
|
||||
|
||||
V8StackTraceId();
|
||||
V8StackTraceId(const V8StackTraceId&) = default;
|
||||
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id);
|
||||
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id,
|
||||
bool should_pause);
|
||||
explicit V8StackTraceId(const StringView&);
|
||||
V8StackTraceId& operator=(const V8StackTraceId&) = default;
|
||||
V8StackTraceId& operator=(V8StackTraceId&&) noexcept = default;
|
||||
~V8StackTraceId() = default;
|
||||
|
||||
bool IsInvalid() const;
|
||||
std::unique_ptr<StringBuffer> ToString();
|
||||
};
|
||||
|
||||
class V8_EXPORT V8Inspector {
|
||||
|
|
@ -289,6 +300,24 @@ class V8_EXPORT V8Inspector {
|
|||
virtual std::unique_ptr<V8StackTrace> createStackTrace(
|
||||
v8::Local<v8::StackTrace>) = 0;
|
||||
virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
|
||||
|
||||
// Performance counters.
|
||||
class V8_EXPORT Counters : public std::enable_shared_from_this<Counters> {
|
||||
public:
|
||||
explicit Counters(v8::Isolate* isolate);
|
||||
~Counters();
|
||||
const std::unordered_map<std::string, int>& getCountersMap() const {
|
||||
return m_countersMap;
|
||||
}
|
||||
|
||||
private:
|
||||
static int* getCounterPtr(const char* name);
|
||||
|
||||
v8::Isolate* m_isolate;
|
||||
std::unordered_map<std::string, int> m_countersMap;
|
||||
};
|
||||
|
||||
virtual std::shared_ptr<Counters> enableCounters() = 0;
|
||||
};
|
||||
|
||||
} // namespace v8_inspector
|
||||
|
|
|
|||
|
|
@ -48,28 +48,32 @@ const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
|
|||
template <size_t tagged_ptr_size>
|
||||
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.
|
||||
template <>
|
||||
struct SmiTagging<4> {
|
||||
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) {
|
||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||
// Shift down (requires >> to be sign extending).
|
||||
return static_cast<int>(static_cast<intptr_t>(value)) >> shift_bits;
|
||||
// Truncate and shift down (requires >> to be sign extending).
|
||||
return static_cast<int32_t>(static_cast<uint32_t>(value)) >> shift_bits;
|
||||
}
|
||||
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
|
||||
// To be representable as an tagged small integer, the two
|
||||
// most-significant bits of 'value' must be either 00 or 11 due to
|
||||
// sign-extension. To check this we add 01 to the two
|
||||
// most-significant bits, and check if the most-significant bit is 0.
|
||||
//
|
||||
// CAUTION: The original code below:
|
||||
// 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;
|
||||
// Is value in range [kSmiMinValue, kSmiMaxValue].
|
||||
// Use unsigned operations in order to avoid undefined behaviour in case of
|
||||
// signed integer overflow.
|
||||
return (static_cast<uintptr_t>(value) -
|
||||
static_cast<uintptr_t>(kSmiMinValue)) <=
|
||||
(static_cast<uintptr_t>(kSmiMaxValue) -
|
||||
static_cast<uintptr_t>(kSmiMinValue));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -77,6 +81,11 @@ struct SmiTagging<4> {
|
|||
template <>
|
||||
struct SmiTagging<8> {
|
||||
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) {
|
||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||
// Shift down and throw away top 32 bits.
|
||||
|
|
@ -98,15 +107,17 @@ const int kApiTaggedSize = kApiSystemPointerSize;
|
|||
#endif
|
||||
|
||||
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
|
||||
typedef SmiTagging<kApiInt32Size> PlatformSmiTagging;
|
||||
using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
|
||||
#else
|
||||
typedef SmiTagging<kApiTaggedSize> PlatformSmiTagging;
|
||||
using PlatformSmiTagging = SmiTagging<kApiTaggedSize>;
|
||||
#endif
|
||||
|
||||
// TODO(ishell): Consinder adding kSmiShiftBits = kSmiShiftSize + kSmiTagSize
|
||||
// since it's used much more often than the inividual constants.
|
||||
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
|
||||
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
|
||||
const int kSmiMinValue = (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
|
||||
const int kSmiMaxValue = -(kSmiMinValue + 1);
|
||||
const int kSmiMinValue = static_cast<int>(PlatformSmiTagging::kSmiMinValue);
|
||||
const int kSmiMaxValue = static_cast<int>(PlatformSmiTagging::kSmiMaxValue);
|
||||
constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
|
||||
constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
|
||||
|
||||
|
|
@ -135,7 +146,7 @@ class Internals {
|
|||
static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize;
|
||||
static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize;
|
||||
static const int kEmbedderDataSlotSize = kApiSystemPointerSize;
|
||||
static const int kNativeContextEmbedderDataOffset = 7 * kApiTaggedSize;
|
||||
static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize;
|
||||
static const int kFullStringRepresentationMask = 0x0f;
|
||||
static const int kStringEncodingMask = 0x8;
|
||||
static const int kExternalTwoByteRepresentationTag = 0x02;
|
||||
|
|
@ -143,6 +154,7 @@ class Internals {
|
|||
|
||||
static const uint32_t kNumIsolateDataSlots = 4;
|
||||
|
||||
// IsolateData layout guarantees.
|
||||
static const int kIsolateEmbedderDataOffset = 0;
|
||||
static const int kExternalMemoryOffset =
|
||||
kNumIsolateDataSlots * kApiSystemPointerSize;
|
||||
|
|
@ -150,8 +162,14 @@ class Internals {
|
|||
kExternalMemoryOffset + kApiInt64Size;
|
||||
static const int kExternalMemoryAtLastMarkCompactOffset =
|
||||
kExternalMemoryLimitOffset + kApiInt64Size;
|
||||
static const int kIsolateRootsOffset =
|
||||
static const int kIsolateFastCCallCallerFpOffset =
|
||||
kExternalMemoryAtLastMarkCompactOffset + kApiInt64Size;
|
||||
static const int kIsolateFastCCallCallerPcOffset =
|
||||
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
|
||||
static const int kIsolateStackGuardOffset =
|
||||
kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize;
|
||||
static const int kIsolateRootsOffset =
|
||||
kIsolateStackGuardOffset + 7 * kApiSystemPointerSize;
|
||||
|
||||
static const int kUndefinedValueRootIndex = 4;
|
||||
static const int kTheHoleValueRootIndex = 5;
|
||||
|
|
@ -165,12 +183,10 @@ class Internals {
|
|||
static const int kNodeStateMask = 0x7;
|
||||
static const int kNodeStateIsWeakValue = 2;
|
||||
static const int kNodeStateIsPendingValue = 3;
|
||||
static const int kNodeIsIndependentShift = 3;
|
||||
static const int kNodeIsActiveShift = 4;
|
||||
|
||||
static const int kFirstNonstringType = 0x40;
|
||||
static const int kOddballType = 0x43;
|
||||
static const int kForeignType = 0x47;
|
||||
static const int kForeignType = 0x46;
|
||||
static const int kJSSpecialApiObjectType = 0x410;
|
||||
static const int kJSApiObjectType = 0x420;
|
||||
static const int kJSObjectType = 0x421;
|
||||
|
|
@ -313,14 +329,11 @@ class Internals {
|
|||
#ifdef V8_COMPRESS_POINTERS
|
||||
// See v8:7703 or src/ptr-compr.* for details about pointer compression.
|
||||
static constexpr size_t kPtrComprHeapReservationSize = size_t{1} << 32;
|
||||
static constexpr size_t kPtrComprIsolateRootBias =
|
||||
kPtrComprHeapReservationSize / 2;
|
||||
static constexpr size_t kPtrComprIsolateRootAlignment = size_t{1} << 32;
|
||||
|
||||
V8_INLINE static internal::Address GetRootFromOnHeapAddress(
|
||||
internal::Address addr) {
|
||||
return (addr + kPtrComprIsolateRootBias) &
|
||||
-static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
||||
return addr & -static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
||||
}
|
||||
|
||||
V8_INLINE static internal::Address DecompressTaggedAnyField(
|
||||
|
|
@ -367,6 +380,10 @@ V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);
|
|||
// language mode is strict.
|
||||
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate);
|
||||
|
||||
// A base class for backing stores, which is needed due to vagaries of
|
||||
// how static casts work with std::shared_ptr.
|
||||
class BackingStoreBase {};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ class TaskRunner {
|
|||
TaskRunner() = default;
|
||||
virtual ~TaskRunner() = default;
|
||||
|
||||
private:
|
||||
TaskRunner(const TaskRunner&) = delete;
|
||||
TaskRunner& operator=(const TaskRunner&) = delete;
|
||||
};
|
||||
|
|
@ -368,9 +367,8 @@ class Platform {
|
|||
* |isolate|. Tasks posted for the same isolate should be execute in order of
|
||||
* scheduling. The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallOnForegroundThread(Isolate* isolate, Task* task)) = 0;
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallOnForegroundThread(Isolate* isolate, Task* task) { abort(); }
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a foreground thread wrt a specific
|
||||
|
|
@ -378,10 +376,11 @@ class Platform {
|
|||
* Tasks posted for the same isolate should be execute in order of
|
||||
* scheduling. The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
||||
double delay_in_seconds)) = 0;
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
||||
double delay_in_seconds) {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a foreground thread wrt a specific
|
||||
|
|
@ -391,20 +390,15 @@ class Platform {
|
|||
* starved for an arbitrarily long time if no idle time is available.
|
||||
* The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallIdleOnForegroundThread(Isolate* isolate,
|
||||
IdleTask* task)) {
|
||||
// This must be overriden if |IdleTasksEnabled()|.
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if idle tasks are enabled for the given |isolate|.
|
||||
*/
|
||||
virtual bool IdleTasksEnabled(Isolate* isolate) {
|
||||
return false;
|
||||
}
|
||||
virtual bool IdleTasksEnabled(Isolate* isolate) { return false; }
|
||||
|
||||
/**
|
||||
* Monotonically increasing time in seconds from an arbitrary fixed point in
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@
|
|||
#ifndef V8_V8_PROFILER_H_
|
||||
#define V8_V8_PROFILER_H_
|
||||
|
||||
#include <limits.h>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "v8.h" // NOLINT(build/include)
|
||||
|
||||
/**
|
||||
|
|
@ -17,14 +20,18 @@ namespace v8 {
|
|||
class HeapGraphNode;
|
||||
struct HeapStatsUpdate;
|
||||
|
||||
typedef uint32_t SnapshotObjectId;
|
||||
|
||||
using NativeObject = void*;
|
||||
using SnapshotObjectId = uint32_t;
|
||||
|
||||
struct CpuProfileDeoptFrame {
|
||||
int script_id;
|
||||
size_t position;
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
class CpuProfile;
|
||||
} // namespace internal
|
||||
|
||||
} // namespace v8
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
|
|
@ -47,75 +54,6 @@ template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>;
|
|||
|
||||
namespace v8 {
|
||||
|
||||
// TickSample captures the information collected for each sample.
|
||||
struct V8_EXPORT TickSample {
|
||||
// Internal profiling (with --prof + tools/$OS-tick-processor) wants to
|
||||
// include the runtime function we're calling. Externally exposed tick
|
||||
// samples don't care.
|
||||
enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame };
|
||||
|
||||
TickSample()
|
||||
: state(OTHER),
|
||||
pc(nullptr),
|
||||
external_callback_entry(nullptr),
|
||||
frames_count(0),
|
||||
has_external_callback(false),
|
||||
update_stats(true) {}
|
||||
|
||||
/**
|
||||
* Initialize a tick sample from the isolate.
|
||||
* \param isolate The isolate.
|
||||
* \param state Execution state.
|
||||
* \param record_c_entry_frame Include or skip the runtime function.
|
||||
* \param update_stats Whether update the sample to the aggregated stats.
|
||||
* \param use_simulator_reg_state When set to true and V8 is running under a
|
||||
* simulator, the method will use the simulator
|
||||
* register state rather than the one provided
|
||||
* with |state| argument. Otherwise the method
|
||||
* will use provided register |state| as is.
|
||||
*/
|
||||
void Init(Isolate* isolate, const v8::RegisterState& state,
|
||||
RecordCEntryFrame record_c_entry_frame, bool update_stats,
|
||||
bool use_simulator_reg_state = true);
|
||||
/**
|
||||
* Get a call stack sample from the isolate.
|
||||
* \param isolate The isolate.
|
||||
* \param state Register state.
|
||||
* \param record_c_entry_frame Include or skip the runtime function.
|
||||
* \param frames Caller allocated buffer to store stack frames.
|
||||
* \param frames_limit Maximum number of frames to capture. The buffer must
|
||||
* be large enough to hold the number of frames.
|
||||
* \param sample_info The sample info is filled up by the function
|
||||
* provides number of actual captured stack frames and
|
||||
* the current VM state.
|
||||
* \param use_simulator_reg_state When set to true and V8 is running under a
|
||||
* simulator, the method will use the simulator
|
||||
* register state rather than the one provided
|
||||
* with |state| argument. Otherwise the method
|
||||
* will use provided register |state| as is.
|
||||
* \note GetStackSample is thread and signal safe and should only be called
|
||||
* when the JS thread is paused or interrupted.
|
||||
* Otherwise the behavior is undefined.
|
||||
*/
|
||||
static bool GetStackSample(Isolate* isolate, v8::RegisterState* state,
|
||||
RecordCEntryFrame record_c_entry_frame,
|
||||
void** frames, size_t frames_limit,
|
||||
v8::SampleInfo* sample_info,
|
||||
bool use_simulator_reg_state = true);
|
||||
StateTag state; // The state of the VM.
|
||||
void* pc; // Instruction pointer.
|
||||
union {
|
||||
void* tos; // Top stack value (*sp).
|
||||
void* external_callback_entry;
|
||||
};
|
||||
static const unsigned kMaxFramesCountLog2 = 8;
|
||||
static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1;
|
||||
void* stack[kMaxFramesCount]; // Call stack.
|
||||
unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames.
|
||||
bool has_external_callback : 1;
|
||||
bool update_stats : 1; // Whether the sample should update aggregated stats.
|
||||
};
|
||||
|
||||
/**
|
||||
* CpuProfileNode represents a node in a call graph.
|
||||
*/
|
||||
|
|
@ -206,11 +144,6 @@ class V8_EXPORT CpuProfileNode {
|
|||
*/
|
||||
unsigned GetHitCount() const;
|
||||
|
||||
/** Returns function entry UID. */
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use GetScriptId, GetLineNumber, and GetColumnNumber instead.",
|
||||
unsigned GetCallUid() const);
|
||||
|
||||
/** Returns id of the node. The id is unique within the tree */
|
||||
unsigned GetNodeId() const;
|
||||
|
||||
|
|
@ -297,6 +230,66 @@ enum CpuProfilingMode {
|
|||
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,
|
||||
};
|
||||
|
||||
enum CpuProfilingLoggingMode {
|
||||
// Enables logging when a profile is active, and disables logging when all
|
||||
// profiles are detached.
|
||||
kLazyLogging,
|
||||
// Enables logging for the lifetime of the CpuProfiler. Calls to
|
||||
// StartRecording are faster, at the expense of runtime overhead.
|
||||
kEagerLogging,
|
||||
};
|
||||
|
||||
/**
|
||||
* 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,
|
||||
MaybeLocal<Context> filter_context = MaybeLocal<Context>());
|
||||
|
||||
CpuProfilingMode mode() const { return mode_; }
|
||||
unsigned max_samples() const { return max_samples_; }
|
||||
int sampling_interval_us() const { return sampling_interval_us_; }
|
||||
|
||||
private:
|
||||
friend class internal::CpuProfile;
|
||||
|
||||
bool has_filter_context() const { return !filter_context_.IsEmpty(); }
|
||||
void* raw_filter_context() const;
|
||||
|
||||
CpuProfilingMode mode_;
|
||||
unsigned max_samples_;
|
||||
int sampling_interval_us_;
|
||||
CopyablePersistentTraits<Context>::CopyablePersistent filter_context_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for controlling CPU profiling. Instance of the
|
||||
* profiler can be created using v8::CpuProfiler::New method.
|
||||
|
|
@ -308,7 +301,9 @@ class V8_EXPORT CpuProfiler {
|
|||
* initialized. The profiler object must be disposed after use by calling
|
||||
* |Dispose| method.
|
||||
*/
|
||||
static CpuProfiler* New(Isolate* isolate);
|
||||
static CpuProfiler* New(Isolate* isolate,
|
||||
CpuProfilingNamingMode = kDebugNaming,
|
||||
CpuProfilingLoggingMode = kLazyLogging);
|
||||
|
||||
/**
|
||||
* Synchronously collect current stack sample in all profilers attached to
|
||||
|
|
@ -339,18 +334,26 @@ class V8_EXPORT CpuProfiler {
|
|||
void SetUsePreciseSampling(bool);
|
||||
|
||||
/**
|
||||
* Starts collecting CPU profile. Title may be an empty string. It
|
||||
* is allowed to have several profiles being collected at
|
||||
* once. Attempts to start collecting several profiles with the same
|
||||
* title are silently ignored. While collecting a profile, functions
|
||||
* from all security contexts are included in it. The token-based
|
||||
* filtering is only performed when querying for a profile.
|
||||
* Starts collecting a CPU profile. Title may be an empty string. Several
|
||||
* profiles may be collected at once. Attempts to start collecting several
|
||||
* profiles with the same title are silently ignored.
|
||||
*/
|
||||
void StartProfiling(Local<String> title, CpuProfilingOptions options);
|
||||
|
||||
/**
|
||||
* Starts profiling with the same semantics as above, except with expanded
|
||||
* parameters.
|
||||
*
|
||||
* |record_samples| parameter controls whether individual samples should
|
||||
* 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(Local<String> title, CpuProfilingMode mode,
|
||||
bool record_samples = false);
|
||||
void StartProfiling(
|
||||
Local<String> title, CpuProfilingMode mode, bool record_samples = false,
|
||||
unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
|
||||
/**
|
||||
* The same as StartProfiling above, but the CpuProfilingMode defaults to
|
||||
* kLeafNodeLineNumbers mode, which was the previous default behavior of the
|
||||
|
|
@ -364,20 +367,6 @@ class V8_EXPORT CpuProfiler {
|
|||
*/
|
||||
CpuProfile* StopProfiling(Local<String> title);
|
||||
|
||||
/**
|
||||
* Force collection of a sample. Must be called on the VM thread.
|
||||
* Recording the forced sample does not contribute to the aggregated
|
||||
* profile statistics.
|
||||
*/
|
||||
V8_DEPRECATED("Use static CollectSample(Isolate*) instead.",
|
||||
void CollectSample());
|
||||
|
||||
/**
|
||||
* Tells the profiler whether the embedder is idle.
|
||||
*/
|
||||
V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.",
|
||||
void SetIdle(bool is_idle));
|
||||
|
||||
/**
|
||||
* Generate more detailed source positions to code objects. This results in
|
||||
* better results when mapping profiling samples to script source.
|
||||
|
|
@ -391,7 +380,6 @@ class V8_EXPORT CpuProfiler {
|
|||
CpuProfiler& operator=(const CpuProfiler&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* HeapSnapshotEdge represents a directed connection between heap
|
||||
* graph nodes: from retainers to retained nodes.
|
||||
|
|
@ -742,7 +730,12 @@ class V8_EXPORT EmbedderGraph {
|
|||
*/
|
||||
virtual const char* NamePrefix() { return nullptr; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Returns the NativeObject that can be used for querying the
|
||||
* |HeapSnapshot|.
|
||||
*/
|
||||
virtual NativeObject GetNativeObject() { return nullptr; }
|
||||
|
||||
Node(const Node&) = delete;
|
||||
Node& operator=(const Node&) = delete;
|
||||
};
|
||||
|
|
@ -805,6 +798,12 @@ class V8_EXPORT HeapProfiler {
|
|||
*/
|
||||
SnapshotObjectId GetObjectId(Local<Value> value);
|
||||
|
||||
/**
|
||||
* Returns SnapshotObjectId for a native object referenced by |value| if it
|
||||
* has been seen by the heap profiler, kUnknownObjectId otherwise.
|
||||
*/
|
||||
SnapshotObjectId GetObjectId(NativeObject value);
|
||||
|
||||
/**
|
||||
* Returns heap object with given SnapshotObjectId if the object is alive,
|
||||
* otherwise empty handle is returned.
|
||||
|
|
@ -973,7 +972,8 @@ struct HeapStatsUpdate {
|
|||
V(LazyCompile) \
|
||||
V(RegExp) \
|
||||
V(Script) \
|
||||
V(Stub)
|
||||
V(Stub) \
|
||||
V(Relocation)
|
||||
|
||||
/**
|
||||
* Note that this enum may be extended in the future. Please include a default
|
||||
|
|
@ -1006,10 +1006,12 @@ class V8_EXPORT CodeEvent {
|
|||
const char* GetComment();
|
||||
|
||||
static const char* GetCodeEventTypeName(CodeEventType code_event_type);
|
||||
|
||||
uintptr_t GetPreviousCodeStartAddress();
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface to listen to code creation events.
|
||||
* Interface to listen to code creation and code relocation events.
|
||||
*/
|
||||
class V8_EXPORT CodeEventHandler {
|
||||
public:
|
||||
|
|
@ -1021,9 +1023,26 @@ class V8_EXPORT CodeEventHandler {
|
|||
explicit CodeEventHandler(Isolate* isolate);
|
||||
virtual ~CodeEventHandler();
|
||||
|
||||
/**
|
||||
* Handle is called every time a code object is created or moved. Information
|
||||
* about each code event will be available through the `code_event`
|
||||
* parameter.
|
||||
*
|
||||
* When the CodeEventType is kRelocationType, the code for this CodeEvent has
|
||||
* moved from `GetPreviousCodeStartAddress()` to `GetCodeStartAddress()`.
|
||||
*/
|
||||
virtual void Handle(CodeEvent* code_event) = 0;
|
||||
|
||||
/**
|
||||
* Call `Enable()` to starts listening to code creation and code relocation
|
||||
* events. These events will be handled by `Handle()`.
|
||||
*/
|
||||
void Enable();
|
||||
|
||||
/**
|
||||
* Call `Disable()` to stop listening to code creation and code relocation
|
||||
* events.
|
||||
*/
|
||||
void Disable();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -11,10 +11,9 @@
|
|||
* Testing support for the V8 JavaScript engine.
|
||||
*/
|
||||
namespace v8 {
|
||||
|
||||
class V8_EXPORT Testing {
|
||||
public:
|
||||
enum StressType {
|
||||
enum V8_DEPRECATED("Don't use this (d8-specific testing logic).") StressType {
|
||||
kStressTypeOpt,
|
||||
kStressTypeDeopt
|
||||
};
|
||||
|
|
@ -22,27 +21,30 @@ class V8_EXPORT Testing {
|
|||
/**
|
||||
* Set the type of stressing to do. The default if not set is kStressTypeOpt.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void SetStressRunType(StressType type);
|
||||
|
||||
/**
|
||||
* Get the number of runs of a given test that is required to get the full
|
||||
* stress coverage.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static int GetStressRuns();
|
||||
|
||||
/**
|
||||
* Indicate the number of the run which is about to start. The value of run
|
||||
* should be between 0 and one less than the result from GetStressRuns()
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void PrepareStressRun(int run);
|
||||
|
||||
/**
|
||||
* Force deoptimization of all functions.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void DeoptimizeAll(Isolate* isolate);
|
||||
};
|
||||
|
||||
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_V8_TEST_H_
|
||||
|
|
|
|||
|
|
@ -194,14 +194,6 @@ class PersistentValueMapBase {
|
|||
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.
|
||||
*/
|
||||
|
|
@ -352,16 +344,6 @@ class PersistentValueMapBase {
|
|||
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>
|
||||
class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
// These macros define the version number for the current version.
|
||||
// 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.
|
||||
#define V8_MAJOR_VERSION 7
|
||||
#define V8_MINOR_VERSION 5
|
||||
#define V8_BUILD_NUMBER 288
|
||||
#define V8_PATCH_LEVEL 30
|
||||
#define V8_MAJOR_VERSION 8
|
||||
#define V8_MINOR_VERSION 0
|
||||
#define V8_BUILD_NUMBER 426
|
||||
#define V8_PATCH_LEVEL 16
|
||||
|
||||
// Use 1 for candidates and 0 otherwise.
|
||||
// (Boolean macro values are not supported by all preprocessors.)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Operating system detection
|
||||
// Operating system detection (host)
|
||||
//
|
||||
// V8_OS_ANDROID - Android
|
||||
// V8_OS_BSD - BSDish (Mac OS X, Net/Free/Open/DragonFlyBSD)
|
||||
|
|
@ -122,6 +122,67 @@
|
|||
# define V8_OS_WIN 1
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Operating system detection (target)
|
||||
//
|
||||
// V8_TARGET_OS_ANDROID
|
||||
// V8_TARGET_OS_FUCHSIA
|
||||
// V8_TARGET_OS_IOS
|
||||
// V8_TARGET_OS_LINUX
|
||||
// V8_TARGET_OS_MACOSX
|
||||
// V8_TARGET_OS_WIN
|
||||
//
|
||||
// If not set explicitly, these fall back to corresponding V8_OS_ values.
|
||||
|
||||
#ifdef V8_HAVE_TARGET_OS
|
||||
|
||||
// The target OS is provided, just check that at least one known value is set.
|
||||
# if !defined(V8_TARGET_OS_ANDROID) \
|
||||
&& !defined(V8_TARGET_OS_FUCHSIA) \
|
||||
&& !defined(V8_TARGET_OS_IOS) \
|
||||
&& !defined(V8_TARGET_OS_LINUX) \
|
||||
&& !defined(V8_TARGET_OS_MACOSX) \
|
||||
&& !defined(V8_TARGET_OS_WIN)
|
||||
# error No known target OS defined.
|
||||
# endif
|
||||
|
||||
#else // V8_HAVE_TARGET_OS
|
||||
|
||||
# if defined(V8_TARGET_OS_ANDROID) \
|
||||
|| defined(V8_TARGET_OS_FUCHSIA) \
|
||||
|| defined(V8_TARGET_OS_IOS) \
|
||||
|| defined(V8_TARGET_OS_LINUX) \
|
||||
|| defined(V8_TARGET_OS_MACOSX) \
|
||||
|| defined(V8_TARGET_OS_WIN)
|
||||
# error A target OS is defined but V8_HAVE_TARGET_OS is unset.
|
||||
# endif
|
||||
|
||||
// Fall back to the detected host OS.
|
||||
#ifdef V8_OS_ANDROID
|
||||
# define V8_TARGET_OS_ANDROID
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_FUCHSIA
|
||||
# define V8_TARGET_OS_FUCHSIA
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_IOS
|
||||
# define V8_TARGET_OS_IOS
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_LINUX
|
||||
# define V8_TARGET_OS_LINUX
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_MACOSX
|
||||
# define V8_TARGET_OS_MACOSX
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
# define V8_TARGET_OS_WIN
|
||||
#endif
|
||||
|
||||
#endif // V8_HAVE_TARGET_OS
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// C library detection
|
||||
|
|
@ -169,7 +230,7 @@
|
|||
//
|
||||
// V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
|
||||
// supported
|
||||
// V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
|
||||
// V8_HAS_ATTRIBUTE_NONNULL - __attribute__((nonnull)) supported
|
||||
// V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
|
||||
// V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
|
||||
// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
|
||||
|
|
@ -186,10 +247,10 @@
|
|||
// V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported
|
||||
// V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported
|
||||
// V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported
|
||||
// V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
|
||||
// V8_HAS_COMPUTED_GOTO - computed goto/labels as values
|
||||
// supported
|
||||
// V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
|
||||
// V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported
|
||||
// V8_HAS_DECLSPEC_NORETURN - __declspec(noreturn) supported
|
||||
// V8_HAS___FORCEINLINE - __forceinline supported
|
||||
//
|
||||
// Note that testing for compilers and/or features must be done using #if
|
||||
|
|
@ -205,15 +266,14 @@
|
|||
#endif
|
||||
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE \
|
||||
(__has_extension(attribute_deprecated_with_message))
|
||||
# define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(__has_attribute(warn_unused_result))
|
||||
|
||||
# define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
|
||||
# define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
|
||||
# define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
|
||||
# define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
|
||||
|
|
@ -226,9 +286,13 @@
|
|||
# define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
|
||||
# define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
|
||||
|
||||
# if __cplusplus >= 201402L
|
||||
# define V8_CAN_HAVE_DCHECK_IN_CONSTEXPR 1
|
||||
# endif
|
||||
// Clang has no __has_feature for computed gotos.
|
||||
// GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
# define V8_HAS_COMPUTED_GOTO 1
|
||||
|
||||
// Whether constexpr has full C++14 semantics, in particular that non-constexpr
|
||||
// code is allowed as long as it's not executed for any constexpr instantiation.
|
||||
# define V8_HAS_CXX14_CONSTEXPR 1
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
|
|
@ -247,30 +311,34 @@
|
|||
// always_inline is available in gcc 4.0 but not very reliable until 4.4.
|
||||
// Works around "sorry, unimplemented: inlining failed" build errors with
|
||||
// older compilers.
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0))
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0))
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE 1
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE 1
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED 1
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY 1
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
|
||||
|
||||
# define V8_HAS_BUILTIN_CLZ (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_CTZ (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
|
||||
# define V8_HAS_BUILTIN_FRAME_ADDRESS (V8_GNUC_PREREQ(2, 96, 0))
|
||||
# define V8_HAS_BUILTIN_POPCOUNT (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
|
||||
# define V8_HAS_BUILTIN_CLZ 1
|
||||
# define V8_HAS_BUILTIN_CTZ 1
|
||||
# define V8_HAS_BUILTIN_EXPECT 1
|
||||
# define V8_HAS_BUILTIN_FRAME_ADDRESS 1
|
||||
# define V8_HAS_BUILTIN_POPCOUNT 1
|
||||
|
||||
// GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
#define V8_HAS_COMPUTED_GOTO 1
|
||||
|
||||
// Whether constexpr has full C++14 semantics, in particular that non-constexpr
|
||||
// code is allowed as long as it's not executed for any constexpr instantiation.
|
||||
// GCC only supports this since version 6.
|
||||
# define V8_HAS_CXX14_CONSTEXPR (V8_GNUC_PREREQ(6, 0, 0))
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define V8_CC_MSVC 1
|
||||
|
||||
# define V8_HAS_DECLSPEC_DEPRECATED 1
|
||||
# define V8_HAS_DECLSPEC_NOINLINE 1
|
||||
# define V8_HAS_DECLSPEC_SELECTANY 1
|
||||
# define V8_HAS_DECLSPEC_NORETURN 1
|
||||
|
||||
# define V8_HAS___FORCEINLINE 1
|
||||
|
||||
|
|
@ -291,6 +359,23 @@
|
|||
# define V8_INLINE inline
|
||||
#endif
|
||||
|
||||
#if V8_HAS_BUILTIN_ASSUME_ALIGNED
|
||||
# define V8_ASSUME_ALIGNED(ptr, alignment) \
|
||||
__builtin_assume_aligned((ptr), (alignment))
|
||||
#else
|
||||
# define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
|
||||
#endif
|
||||
|
||||
|
||||
// A macro to mark specific arguments as non-null.
|
||||
// Use like:
|
||||
// int add(int* x, int y, int* z) V8_NONNULL(1, 3) { return *x + y + *z; }
|
||||
#if V8_HAS_ATTRIBUTE_NONNULL
|
||||
# define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
#else
|
||||
# define V8_NONNULL(...) /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
|
||||
// A macro used to tell the compiler to never inline a particular function.
|
||||
// Don't bother for debug builds.
|
||||
|
|
@ -306,31 +391,18 @@
|
|||
|
||||
|
||||
// A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
|
||||
#if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
|
||||
#define V8_DEPRECATED(message, declarator) \
|
||||
declarator __attribute__((deprecated(message)))
|
||||
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
|
||||
#define V8_DEPRECATED(message, declarator) \
|
||||
declarator __attribute__((deprecated))
|
||||
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
|
||||
#define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
|
||||
#if defined(V8_DEPRECATION_WARNINGS)
|
||||
# define V8_DEPRECATED(message) [[deprecated(message)]]
|
||||
#else
|
||||
#define V8_DEPRECATED(message, declarator) declarator
|
||||
# define V8_DEPRECATED(message)
|
||||
#endif
|
||||
|
||||
|
||||
// A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS) && \
|
||||
V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
|
||||
#define V8_DEPRECATE_SOON(message, declarator) \
|
||||
declarator __attribute__((deprecated(message)))
|
||||
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
|
||||
#define V8_DEPRECATE_SOON(message, declarator) \
|
||||
declarator __attribute__((deprecated))
|
||||
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
|
||||
#define V8_DEPRECATE_SOON(message, declarator) __declspec(deprecated) declarator
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
|
||||
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
|
||||
#else
|
||||
#define V8_DEPRECATE_SOON(message, declarator) declarator
|
||||
# define V8_DEPRECATE_SOON(message)
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -353,6 +425,12 @@
|
|||
#define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
|
||||
#error Inconsistent build configuration: To build the V8 shared library \
|
||||
set BUILDING_V8_SHARED, to include its headers for linking against the \
|
||||
V8 shared library set USING_V8_SHARED.
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
|
||||
// Setup for Windows DLL export/import. When building the V8 DLL the
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -67,3 +67,6 @@ which in turn guarantees long-term stability of the API.
|
|||
# The V8 inspector
|
||||
|
||||
All debugging capabilities of V8 should be exposed via the inspector protocol.
|
||||
The exception to this are profiling features exposed via v8-profiler.h.
|
||||
Changes to the inspector protocol need to ensure backwards compatibility and
|
||||
commitment to maintain.
|
||||
|
|
|
|||
|
|
@ -1,16 +1,18 @@
|
|||
set noparent
|
||||
|
||||
adamk@chromium.org
|
||||
danno@chromium.org
|
||||
ulan@chromium.org
|
||||
verwaest@chromium.org
|
||||
yangguo@chromium.org
|
||||
|
||||
per-file v8-internal.h=file://OWNERS
|
||||
per-file *DEPS=file:../COMMON_OWNERS
|
||||
per-file v8-internal.h=file:../COMMON_OWNERS
|
||||
per-file v8-inspector.h=dgozman@chromium.org
|
||||
per-file v8-inspector.h=pfeldman@chromium.org
|
||||
per-file v8-inspector.h=kozyatinskiy@chromium.org
|
||||
per-file v8-inspector-protocol.h=dgozman@chromium.org
|
||||
per-file v8-inspector-protocol.h=pfeldman@chromium.org
|
||||
per-file v8-inspector-protocol.h=kozyatinskiy@chromium.org
|
||||
per-file js_protocol.pdl=dgozman@chromium.org
|
||||
per-file js_protocol.pdl=pfeldman@chromium.org
|
||||
|
||||
# COMPONENT: Blink>JavaScript>API
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef V8_LIBPLATFORM_LIBPLATFORM_H_
|
||||
#define V8_LIBPLATFORM_LIBPLATFORM_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "libplatform/libplatform-export.h"
|
||||
#include "libplatform/v8-tracing.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
|
|
@ -70,11 +72,10 @@ V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform,
|
|||
* The |platform| has to be created using |NewDefaultPlatform|.
|
||||
*
|
||||
*/
|
||||
V8_PLATFORM_EXPORT V8_DEPRECATE_SOON(
|
||||
"Access the DefaultPlatform directly",
|
||||
void SetTracingController(
|
||||
v8::Platform* platform,
|
||||
v8::platform::tracing::TracingController* tracing_controller));
|
||||
V8_DEPRECATE_SOON("Access the DefaultPlatform directly")
|
||||
V8_PLATFORM_EXPORT void SetTracingController(
|
||||
v8::Platform* platform,
|
||||
v8::platform::tracing::TracingController* tracing_controller);
|
||||
|
||||
} // namespace platform
|
||||
} // namespace v8
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@
|
|||
#include "libplatform/libplatform-export.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
|
||||
namespace perfetto {
|
||||
class TracingSession;
|
||||
}
|
||||
|
||||
namespace v8 {
|
||||
|
||||
namespace base {
|
||||
|
|
@ -23,12 +27,15 @@ class Mutex;
|
|||
namespace platform {
|
||||
namespace tracing {
|
||||
|
||||
class TraceEventListener;
|
||||
class JSONTraceEventListener;
|
||||
|
||||
const int kTraceMaxNumArgs = 2;
|
||||
|
||||
class V8_PLATFORM_EXPORT TraceObject {
|
||||
public:
|
||||
union ArgValue {
|
||||
bool as_bool;
|
||||
V8_DEPRECATED("use as_uint ? true : false") bool as_bool;
|
||||
uint64_t as_uint;
|
||||
int64_t as_int;
|
||||
double as_double;
|
||||
|
|
@ -237,7 +244,17 @@ class V8_PLATFORM_EXPORT TracingController
|
|||
|
||||
TracingController();
|
||||
~TracingController() override;
|
||||
|
||||
// Takes ownership of |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);
|
||||
// Provide an optional listener for testing that will receive trace events.
|
||||
// Must be called before StartTracing().
|
||||
void SetTraceEventListenerForTesting(TraceEventListener* listener);
|
||||
#endif
|
||||
|
||||
// v8::TracingController implementation.
|
||||
const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
|
||||
|
|
@ -280,6 +297,12 @@ class V8_PLATFORM_EXPORT TracingController
|
|||
std::unique_ptr<base::Mutex> mutex_;
|
||||
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
|
||||
std::atomic_bool recording_{false};
|
||||
#ifdef V8_USE_PERFETTO
|
||||
std::ostream* output_stream_ = nullptr;
|
||||
std::unique_ptr<JSONTraceEventListener> json_listener_;
|
||||
TraceEventListener* listener_for_testing_ = nullptr;
|
||||
std::unique_ptr<perfetto::TracingSession> tracing_session_;
|
||||
#endif
|
||||
|
||||
// Disallow copy and assign
|
||||
TracingController(const TracingController&) = delete;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <cctype>
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "v8.h" // NOLINT(build/include)
|
||||
|
||||
|
|
@ -24,6 +25,7 @@ namespace Runtime {
|
|||
namespace API {
|
||||
class RemoteObject;
|
||||
class StackTrace;
|
||||
class StackTraceId;
|
||||
}
|
||||
}
|
||||
namespace Schema {
|
||||
|
|
@ -87,7 +89,6 @@ class V8_EXPORT V8ContextInfo {
|
|||
|
||||
static int executionContextId(v8::Local<v8::Context> context);
|
||||
|
||||
private:
|
||||
// Disallow copying and allocating this one.
|
||||
enum NotNullTagEnum { NotNullLiteral };
|
||||
void* operator new(size_t) = delete;
|
||||
|
|
@ -110,6 +111,8 @@ class V8_EXPORT V8StackTrace {
|
|||
virtual ~V8StackTrace() = default;
|
||||
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
||||
buildInspectorObject() const = 0;
|
||||
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
||||
buildInspectorObject(int maxAsyncDepth) const = 0;
|
||||
virtual std::unique_ptr<StringBuffer> toString() const = 0;
|
||||
|
||||
// Safe to pass between threads, drops async chain.
|
||||
|
|
@ -131,7 +134,7 @@ class V8_EXPORT V8InspectorSession {
|
|||
// Dispatching protocol messages.
|
||||
static bool canDispatchMethod(const StringView& method);
|
||||
virtual void dispatchProtocolMessage(const StringView& message) = 0;
|
||||
virtual std::unique_ptr<StringBuffer> stateJSON() = 0;
|
||||
virtual std::vector<uint8_t> state() = 0;
|
||||
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
||||
supportedDomains() = 0;
|
||||
|
||||
|
|
@ -228,12 +231,20 @@ class V8_EXPORT V8InspectorClient {
|
|||
struct V8_EXPORT V8StackTraceId {
|
||||
uintptr_t id;
|
||||
std::pair<int64_t, int64_t> debugger_id;
|
||||
bool should_pause = false;
|
||||
|
||||
V8StackTraceId();
|
||||
V8StackTraceId(const V8StackTraceId&) = default;
|
||||
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id);
|
||||
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id,
|
||||
bool should_pause);
|
||||
explicit V8StackTraceId(const StringView&);
|
||||
V8StackTraceId& operator=(const V8StackTraceId&) = default;
|
||||
V8StackTraceId& operator=(V8StackTraceId&&) noexcept = default;
|
||||
~V8StackTraceId() = default;
|
||||
|
||||
bool IsInvalid() const;
|
||||
std::unique_ptr<StringBuffer> ToString();
|
||||
};
|
||||
|
||||
class V8_EXPORT V8Inspector {
|
||||
|
|
@ -289,6 +300,24 @@ class V8_EXPORT V8Inspector {
|
|||
virtual std::unique_ptr<V8StackTrace> createStackTrace(
|
||||
v8::Local<v8::StackTrace>) = 0;
|
||||
virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
|
||||
|
||||
// Performance counters.
|
||||
class V8_EXPORT Counters : public std::enable_shared_from_this<Counters> {
|
||||
public:
|
||||
explicit Counters(v8::Isolate* isolate);
|
||||
~Counters();
|
||||
const std::unordered_map<std::string, int>& getCountersMap() const {
|
||||
return m_countersMap;
|
||||
}
|
||||
|
||||
private:
|
||||
static int* getCounterPtr(const char* name);
|
||||
|
||||
v8::Isolate* m_isolate;
|
||||
std::unordered_map<std::string, int> m_countersMap;
|
||||
};
|
||||
|
||||
virtual std::shared_ptr<Counters> enableCounters() = 0;
|
||||
};
|
||||
|
||||
} // namespace v8_inspector
|
||||
|
|
|
|||
|
|
@ -48,28 +48,32 @@ const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
|
|||
template <size_t tagged_ptr_size>
|
||||
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.
|
||||
template <>
|
||||
struct SmiTagging<4> {
|
||||
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) {
|
||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||
// Shift down (requires >> to be sign extending).
|
||||
return static_cast<int>(static_cast<intptr_t>(value)) >> shift_bits;
|
||||
// Truncate and shift down (requires >> to be sign extending).
|
||||
return static_cast<int32_t>(static_cast<uint32_t>(value)) >> shift_bits;
|
||||
}
|
||||
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
|
||||
// To be representable as an tagged small integer, the two
|
||||
// most-significant bits of 'value' must be either 00 or 11 due to
|
||||
// sign-extension. To check this we add 01 to the two
|
||||
// most-significant bits, and check if the most-significant bit is 0.
|
||||
//
|
||||
// CAUTION: The original code below:
|
||||
// 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;
|
||||
// Is value in range [kSmiMinValue, kSmiMaxValue].
|
||||
// Use unsigned operations in order to avoid undefined behaviour in case of
|
||||
// signed integer overflow.
|
||||
return (static_cast<uintptr_t>(value) -
|
||||
static_cast<uintptr_t>(kSmiMinValue)) <=
|
||||
(static_cast<uintptr_t>(kSmiMaxValue) -
|
||||
static_cast<uintptr_t>(kSmiMinValue));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -77,6 +81,11 @@ struct SmiTagging<4> {
|
|||
template <>
|
||||
struct SmiTagging<8> {
|
||||
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) {
|
||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||
// Shift down and throw away top 32 bits.
|
||||
|
|
@ -98,15 +107,17 @@ const int kApiTaggedSize = kApiSystemPointerSize;
|
|||
#endif
|
||||
|
||||
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
|
||||
typedef SmiTagging<kApiInt32Size> PlatformSmiTagging;
|
||||
using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
|
||||
#else
|
||||
typedef SmiTagging<kApiTaggedSize> PlatformSmiTagging;
|
||||
using PlatformSmiTagging = SmiTagging<kApiTaggedSize>;
|
||||
#endif
|
||||
|
||||
// TODO(ishell): Consinder adding kSmiShiftBits = kSmiShiftSize + kSmiTagSize
|
||||
// since it's used much more often than the inividual constants.
|
||||
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
|
||||
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
|
||||
const int kSmiMinValue = (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
|
||||
const int kSmiMaxValue = -(kSmiMinValue + 1);
|
||||
const int kSmiMinValue = static_cast<int>(PlatformSmiTagging::kSmiMinValue);
|
||||
const int kSmiMaxValue = static_cast<int>(PlatformSmiTagging::kSmiMaxValue);
|
||||
constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
|
||||
constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
|
||||
|
||||
|
|
@ -135,7 +146,7 @@ class Internals {
|
|||
static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize;
|
||||
static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize;
|
||||
static const int kEmbedderDataSlotSize = kApiSystemPointerSize;
|
||||
static const int kNativeContextEmbedderDataOffset = 7 * kApiTaggedSize;
|
||||
static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize;
|
||||
static const int kFullStringRepresentationMask = 0x0f;
|
||||
static const int kStringEncodingMask = 0x8;
|
||||
static const int kExternalTwoByteRepresentationTag = 0x02;
|
||||
|
|
@ -143,6 +154,7 @@ class Internals {
|
|||
|
||||
static const uint32_t kNumIsolateDataSlots = 4;
|
||||
|
||||
// IsolateData layout guarantees.
|
||||
static const int kIsolateEmbedderDataOffset = 0;
|
||||
static const int kExternalMemoryOffset =
|
||||
kNumIsolateDataSlots * kApiSystemPointerSize;
|
||||
|
|
@ -150,8 +162,14 @@ class Internals {
|
|||
kExternalMemoryOffset + kApiInt64Size;
|
||||
static const int kExternalMemoryAtLastMarkCompactOffset =
|
||||
kExternalMemoryLimitOffset + kApiInt64Size;
|
||||
static const int kIsolateRootsOffset =
|
||||
static const int kIsolateFastCCallCallerFpOffset =
|
||||
kExternalMemoryAtLastMarkCompactOffset + kApiInt64Size;
|
||||
static const int kIsolateFastCCallCallerPcOffset =
|
||||
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
|
||||
static const int kIsolateStackGuardOffset =
|
||||
kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize;
|
||||
static const int kIsolateRootsOffset =
|
||||
kIsolateStackGuardOffset + 7 * kApiSystemPointerSize;
|
||||
|
||||
static const int kUndefinedValueRootIndex = 4;
|
||||
static const int kTheHoleValueRootIndex = 5;
|
||||
|
|
@ -165,12 +183,10 @@ class Internals {
|
|||
static const int kNodeStateMask = 0x7;
|
||||
static const int kNodeStateIsWeakValue = 2;
|
||||
static const int kNodeStateIsPendingValue = 3;
|
||||
static const int kNodeIsIndependentShift = 3;
|
||||
static const int kNodeIsActiveShift = 4;
|
||||
|
||||
static const int kFirstNonstringType = 0x40;
|
||||
static const int kOddballType = 0x43;
|
||||
static const int kForeignType = 0x47;
|
||||
static const int kForeignType = 0x46;
|
||||
static const int kJSSpecialApiObjectType = 0x410;
|
||||
static const int kJSApiObjectType = 0x420;
|
||||
static const int kJSObjectType = 0x421;
|
||||
|
|
@ -313,14 +329,11 @@ class Internals {
|
|||
#ifdef V8_COMPRESS_POINTERS
|
||||
// See v8:7703 or src/ptr-compr.* for details about pointer compression.
|
||||
static constexpr size_t kPtrComprHeapReservationSize = size_t{1} << 32;
|
||||
static constexpr size_t kPtrComprIsolateRootBias =
|
||||
kPtrComprHeapReservationSize / 2;
|
||||
static constexpr size_t kPtrComprIsolateRootAlignment = size_t{1} << 32;
|
||||
|
||||
V8_INLINE static internal::Address GetRootFromOnHeapAddress(
|
||||
internal::Address addr) {
|
||||
return (addr + kPtrComprIsolateRootBias) &
|
||||
-static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
||||
return addr & -static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
||||
}
|
||||
|
||||
V8_INLINE static internal::Address DecompressTaggedAnyField(
|
||||
|
|
@ -367,6 +380,10 @@ V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);
|
|||
// language mode is strict.
|
||||
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate);
|
||||
|
||||
// A base class for backing stores, which is needed due to vagaries of
|
||||
// how static casts work with std::shared_ptr.
|
||||
class BackingStoreBase {};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ class TaskRunner {
|
|||
TaskRunner() = default;
|
||||
virtual ~TaskRunner() = default;
|
||||
|
||||
private:
|
||||
TaskRunner(const TaskRunner&) = delete;
|
||||
TaskRunner& operator=(const TaskRunner&) = delete;
|
||||
};
|
||||
|
|
@ -368,9 +367,8 @@ class Platform {
|
|||
* |isolate|. Tasks posted for the same isolate should be execute in order of
|
||||
* scheduling. The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallOnForegroundThread(Isolate* isolate, Task* task)) = 0;
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallOnForegroundThread(Isolate* isolate, Task* task) { abort(); }
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a foreground thread wrt a specific
|
||||
|
|
@ -378,10 +376,11 @@ class Platform {
|
|||
* Tasks posted for the same isolate should be execute in order of
|
||||
* scheduling. The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
||||
double delay_in_seconds)) = 0;
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
||||
double delay_in_seconds) {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a foreground thread wrt a specific
|
||||
|
|
@ -391,20 +390,15 @@ class Platform {
|
|||
* starved for an arbitrarily long time if no idle time is available.
|
||||
* The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallIdleOnForegroundThread(Isolate* isolate,
|
||||
IdleTask* task)) {
|
||||
// This must be overriden if |IdleTasksEnabled()|.
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if idle tasks are enabled for the given |isolate|.
|
||||
*/
|
||||
virtual bool IdleTasksEnabled(Isolate* isolate) {
|
||||
return false;
|
||||
}
|
||||
virtual bool IdleTasksEnabled(Isolate* isolate) { return false; }
|
||||
|
||||
/**
|
||||
* Monotonically increasing time in seconds from an arbitrary fixed point in
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@
|
|||
#ifndef V8_V8_PROFILER_H_
|
||||
#define V8_V8_PROFILER_H_
|
||||
|
||||
#include <limits.h>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "v8.h" // NOLINT(build/include)
|
||||
|
||||
/**
|
||||
|
|
@ -17,14 +20,18 @@ namespace v8 {
|
|||
class HeapGraphNode;
|
||||
struct HeapStatsUpdate;
|
||||
|
||||
typedef uint32_t SnapshotObjectId;
|
||||
|
||||
using NativeObject = void*;
|
||||
using SnapshotObjectId = uint32_t;
|
||||
|
||||
struct CpuProfileDeoptFrame {
|
||||
int script_id;
|
||||
size_t position;
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
class CpuProfile;
|
||||
} // namespace internal
|
||||
|
||||
} // namespace v8
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
|
|
@ -47,75 +54,6 @@ template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>;
|
|||
|
||||
namespace v8 {
|
||||
|
||||
// TickSample captures the information collected for each sample.
|
||||
struct V8_EXPORT TickSample {
|
||||
// Internal profiling (with --prof + tools/$OS-tick-processor) wants to
|
||||
// include the runtime function we're calling. Externally exposed tick
|
||||
// samples don't care.
|
||||
enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame };
|
||||
|
||||
TickSample()
|
||||
: state(OTHER),
|
||||
pc(nullptr),
|
||||
external_callback_entry(nullptr),
|
||||
frames_count(0),
|
||||
has_external_callback(false),
|
||||
update_stats(true) {}
|
||||
|
||||
/**
|
||||
* Initialize a tick sample from the isolate.
|
||||
* \param isolate The isolate.
|
||||
* \param state Execution state.
|
||||
* \param record_c_entry_frame Include or skip the runtime function.
|
||||
* \param update_stats Whether update the sample to the aggregated stats.
|
||||
* \param use_simulator_reg_state When set to true and V8 is running under a
|
||||
* simulator, the method will use the simulator
|
||||
* register state rather than the one provided
|
||||
* with |state| argument. Otherwise the method
|
||||
* will use provided register |state| as is.
|
||||
*/
|
||||
void Init(Isolate* isolate, const v8::RegisterState& state,
|
||||
RecordCEntryFrame record_c_entry_frame, bool update_stats,
|
||||
bool use_simulator_reg_state = true);
|
||||
/**
|
||||
* Get a call stack sample from the isolate.
|
||||
* \param isolate The isolate.
|
||||
* \param state Register state.
|
||||
* \param record_c_entry_frame Include or skip the runtime function.
|
||||
* \param frames Caller allocated buffer to store stack frames.
|
||||
* \param frames_limit Maximum number of frames to capture. The buffer must
|
||||
* be large enough to hold the number of frames.
|
||||
* \param sample_info The sample info is filled up by the function
|
||||
* provides number of actual captured stack frames and
|
||||
* the current VM state.
|
||||
* \param use_simulator_reg_state When set to true and V8 is running under a
|
||||
* simulator, the method will use the simulator
|
||||
* register state rather than the one provided
|
||||
* with |state| argument. Otherwise the method
|
||||
* will use provided register |state| as is.
|
||||
* \note GetStackSample is thread and signal safe and should only be called
|
||||
* when the JS thread is paused or interrupted.
|
||||
* Otherwise the behavior is undefined.
|
||||
*/
|
||||
static bool GetStackSample(Isolate* isolate, v8::RegisterState* state,
|
||||
RecordCEntryFrame record_c_entry_frame,
|
||||
void** frames, size_t frames_limit,
|
||||
v8::SampleInfo* sample_info,
|
||||
bool use_simulator_reg_state = true);
|
||||
StateTag state; // The state of the VM.
|
||||
void* pc; // Instruction pointer.
|
||||
union {
|
||||
void* tos; // Top stack value (*sp).
|
||||
void* external_callback_entry;
|
||||
};
|
||||
static const unsigned kMaxFramesCountLog2 = 8;
|
||||
static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1;
|
||||
void* stack[kMaxFramesCount]; // Call stack.
|
||||
unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames.
|
||||
bool has_external_callback : 1;
|
||||
bool update_stats : 1; // Whether the sample should update aggregated stats.
|
||||
};
|
||||
|
||||
/**
|
||||
* CpuProfileNode represents a node in a call graph.
|
||||
*/
|
||||
|
|
@ -206,11 +144,6 @@ class V8_EXPORT CpuProfileNode {
|
|||
*/
|
||||
unsigned GetHitCount() const;
|
||||
|
||||
/** Returns function entry UID. */
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use GetScriptId, GetLineNumber, and GetColumnNumber instead.",
|
||||
unsigned GetCallUid() const);
|
||||
|
||||
/** Returns id of the node. The id is unique within the tree */
|
||||
unsigned GetNodeId() const;
|
||||
|
||||
|
|
@ -297,6 +230,66 @@ enum CpuProfilingMode {
|
|||
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,
|
||||
};
|
||||
|
||||
enum CpuProfilingLoggingMode {
|
||||
// Enables logging when a profile is active, and disables logging when all
|
||||
// profiles are detached.
|
||||
kLazyLogging,
|
||||
// Enables logging for the lifetime of the CpuProfiler. Calls to
|
||||
// StartRecording are faster, at the expense of runtime overhead.
|
||||
kEagerLogging,
|
||||
};
|
||||
|
||||
/**
|
||||
* 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,
|
||||
MaybeLocal<Context> filter_context = MaybeLocal<Context>());
|
||||
|
||||
CpuProfilingMode mode() const { return mode_; }
|
||||
unsigned max_samples() const { return max_samples_; }
|
||||
int sampling_interval_us() const { return sampling_interval_us_; }
|
||||
|
||||
private:
|
||||
friend class internal::CpuProfile;
|
||||
|
||||
bool has_filter_context() const { return !filter_context_.IsEmpty(); }
|
||||
void* raw_filter_context() const;
|
||||
|
||||
CpuProfilingMode mode_;
|
||||
unsigned max_samples_;
|
||||
int sampling_interval_us_;
|
||||
CopyablePersistentTraits<Context>::CopyablePersistent filter_context_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for controlling CPU profiling. Instance of the
|
||||
* profiler can be created using v8::CpuProfiler::New method.
|
||||
|
|
@ -308,7 +301,9 @@ class V8_EXPORT CpuProfiler {
|
|||
* initialized. The profiler object must be disposed after use by calling
|
||||
* |Dispose| method.
|
||||
*/
|
||||
static CpuProfiler* New(Isolate* isolate);
|
||||
static CpuProfiler* New(Isolate* isolate,
|
||||
CpuProfilingNamingMode = kDebugNaming,
|
||||
CpuProfilingLoggingMode = kLazyLogging);
|
||||
|
||||
/**
|
||||
* Synchronously collect current stack sample in all profilers attached to
|
||||
|
|
@ -339,18 +334,26 @@ class V8_EXPORT CpuProfiler {
|
|||
void SetUsePreciseSampling(bool);
|
||||
|
||||
/**
|
||||
* Starts collecting CPU profile. Title may be an empty string. It
|
||||
* is allowed to have several profiles being collected at
|
||||
* once. Attempts to start collecting several profiles with the same
|
||||
* title are silently ignored. While collecting a profile, functions
|
||||
* from all security contexts are included in it. The token-based
|
||||
* filtering is only performed when querying for a profile.
|
||||
* Starts collecting a CPU profile. Title may be an empty string. Several
|
||||
* profiles may be collected at once. Attempts to start collecting several
|
||||
* profiles with the same title are silently ignored.
|
||||
*/
|
||||
void StartProfiling(Local<String> title, CpuProfilingOptions options);
|
||||
|
||||
/**
|
||||
* Starts profiling with the same semantics as above, except with expanded
|
||||
* parameters.
|
||||
*
|
||||
* |record_samples| parameter controls whether individual samples should
|
||||
* 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(Local<String> title, CpuProfilingMode mode,
|
||||
bool record_samples = false);
|
||||
void StartProfiling(
|
||||
Local<String> title, CpuProfilingMode mode, bool record_samples = false,
|
||||
unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
|
||||
/**
|
||||
* The same as StartProfiling above, but the CpuProfilingMode defaults to
|
||||
* kLeafNodeLineNumbers mode, which was the previous default behavior of the
|
||||
|
|
@ -364,20 +367,6 @@ class V8_EXPORT CpuProfiler {
|
|||
*/
|
||||
CpuProfile* StopProfiling(Local<String> title);
|
||||
|
||||
/**
|
||||
* Force collection of a sample. Must be called on the VM thread.
|
||||
* Recording the forced sample does not contribute to the aggregated
|
||||
* profile statistics.
|
||||
*/
|
||||
V8_DEPRECATED("Use static CollectSample(Isolate*) instead.",
|
||||
void CollectSample());
|
||||
|
||||
/**
|
||||
* Tells the profiler whether the embedder is idle.
|
||||
*/
|
||||
V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.",
|
||||
void SetIdle(bool is_idle));
|
||||
|
||||
/**
|
||||
* Generate more detailed source positions to code objects. This results in
|
||||
* better results when mapping profiling samples to script source.
|
||||
|
|
@ -391,7 +380,6 @@ class V8_EXPORT CpuProfiler {
|
|||
CpuProfiler& operator=(const CpuProfiler&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* HeapSnapshotEdge represents a directed connection between heap
|
||||
* graph nodes: from retainers to retained nodes.
|
||||
|
|
@ -742,7 +730,12 @@ class V8_EXPORT EmbedderGraph {
|
|||
*/
|
||||
virtual const char* NamePrefix() { return nullptr; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Returns the NativeObject that can be used for querying the
|
||||
* |HeapSnapshot|.
|
||||
*/
|
||||
virtual NativeObject GetNativeObject() { return nullptr; }
|
||||
|
||||
Node(const Node&) = delete;
|
||||
Node& operator=(const Node&) = delete;
|
||||
};
|
||||
|
|
@ -805,6 +798,12 @@ class V8_EXPORT HeapProfiler {
|
|||
*/
|
||||
SnapshotObjectId GetObjectId(Local<Value> value);
|
||||
|
||||
/**
|
||||
* Returns SnapshotObjectId for a native object referenced by |value| if it
|
||||
* has been seen by the heap profiler, kUnknownObjectId otherwise.
|
||||
*/
|
||||
SnapshotObjectId GetObjectId(NativeObject value);
|
||||
|
||||
/**
|
||||
* Returns heap object with given SnapshotObjectId if the object is alive,
|
||||
* otherwise empty handle is returned.
|
||||
|
|
@ -973,7 +972,8 @@ struct HeapStatsUpdate {
|
|||
V(LazyCompile) \
|
||||
V(RegExp) \
|
||||
V(Script) \
|
||||
V(Stub)
|
||||
V(Stub) \
|
||||
V(Relocation)
|
||||
|
||||
/**
|
||||
* Note that this enum may be extended in the future. Please include a default
|
||||
|
|
@ -1006,10 +1006,12 @@ class V8_EXPORT CodeEvent {
|
|||
const char* GetComment();
|
||||
|
||||
static const char* GetCodeEventTypeName(CodeEventType code_event_type);
|
||||
|
||||
uintptr_t GetPreviousCodeStartAddress();
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface to listen to code creation events.
|
||||
* Interface to listen to code creation and code relocation events.
|
||||
*/
|
||||
class V8_EXPORT CodeEventHandler {
|
||||
public:
|
||||
|
|
@ -1021,9 +1023,26 @@ class V8_EXPORT CodeEventHandler {
|
|||
explicit CodeEventHandler(Isolate* isolate);
|
||||
virtual ~CodeEventHandler();
|
||||
|
||||
/**
|
||||
* Handle is called every time a code object is created or moved. Information
|
||||
* about each code event will be available through the `code_event`
|
||||
* parameter.
|
||||
*
|
||||
* When the CodeEventType is kRelocationType, the code for this CodeEvent has
|
||||
* moved from `GetPreviousCodeStartAddress()` to `GetCodeStartAddress()`.
|
||||
*/
|
||||
virtual void Handle(CodeEvent* code_event) = 0;
|
||||
|
||||
/**
|
||||
* Call `Enable()` to starts listening to code creation and code relocation
|
||||
* events. These events will be handled by `Handle()`.
|
||||
*/
|
||||
void Enable();
|
||||
|
||||
/**
|
||||
* Call `Disable()` to stop listening to code creation and code relocation
|
||||
* events.
|
||||
*/
|
||||
void Disable();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -11,10 +11,9 @@
|
|||
* Testing support for the V8 JavaScript engine.
|
||||
*/
|
||||
namespace v8 {
|
||||
|
||||
class V8_EXPORT Testing {
|
||||
public:
|
||||
enum StressType {
|
||||
enum V8_DEPRECATED("Don't use this (d8-specific testing logic).") StressType {
|
||||
kStressTypeOpt,
|
||||
kStressTypeDeopt
|
||||
};
|
||||
|
|
@ -22,27 +21,30 @@ class V8_EXPORT Testing {
|
|||
/**
|
||||
* Set the type of stressing to do. The default if not set is kStressTypeOpt.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void SetStressRunType(StressType type);
|
||||
|
||||
/**
|
||||
* Get the number of runs of a given test that is required to get the full
|
||||
* stress coverage.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static int GetStressRuns();
|
||||
|
||||
/**
|
||||
* Indicate the number of the run which is about to start. The value of run
|
||||
* should be between 0 and one less than the result from GetStressRuns()
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void PrepareStressRun(int run);
|
||||
|
||||
/**
|
||||
* Force deoptimization of all functions.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void DeoptimizeAll(Isolate* isolate);
|
||||
};
|
||||
|
||||
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_V8_TEST_H_
|
||||
|
|
|
|||
|
|
@ -194,14 +194,6 @@ class PersistentValueMapBase {
|
|||
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.
|
||||
*/
|
||||
|
|
@ -352,16 +344,6 @@ class PersistentValueMapBase {
|
|||
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>
|
||||
class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
// These macros define the version number for the current version.
|
||||
// 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.
|
||||
#define V8_MAJOR_VERSION 7
|
||||
#define V8_MINOR_VERSION 5
|
||||
#define V8_BUILD_NUMBER 288
|
||||
#define V8_PATCH_LEVEL 30
|
||||
#define V8_MAJOR_VERSION 8
|
||||
#define V8_MINOR_VERSION 0
|
||||
#define V8_BUILD_NUMBER 426
|
||||
#define V8_PATCH_LEVEL 16
|
||||
|
||||
// Use 1 for candidates and 0 otherwise.
|
||||
// (Boolean macro values are not supported by all preprocessors.)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Operating system detection
|
||||
// Operating system detection (host)
|
||||
//
|
||||
// V8_OS_ANDROID - Android
|
||||
// V8_OS_BSD - BSDish (Mac OS X, Net/Free/Open/DragonFlyBSD)
|
||||
|
|
@ -122,6 +122,67 @@
|
|||
# define V8_OS_WIN 1
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Operating system detection (target)
|
||||
//
|
||||
// V8_TARGET_OS_ANDROID
|
||||
// V8_TARGET_OS_FUCHSIA
|
||||
// V8_TARGET_OS_IOS
|
||||
// V8_TARGET_OS_LINUX
|
||||
// V8_TARGET_OS_MACOSX
|
||||
// V8_TARGET_OS_WIN
|
||||
//
|
||||
// If not set explicitly, these fall back to corresponding V8_OS_ values.
|
||||
|
||||
#ifdef V8_HAVE_TARGET_OS
|
||||
|
||||
// The target OS is provided, just check that at least one known value is set.
|
||||
# if !defined(V8_TARGET_OS_ANDROID) \
|
||||
&& !defined(V8_TARGET_OS_FUCHSIA) \
|
||||
&& !defined(V8_TARGET_OS_IOS) \
|
||||
&& !defined(V8_TARGET_OS_LINUX) \
|
||||
&& !defined(V8_TARGET_OS_MACOSX) \
|
||||
&& !defined(V8_TARGET_OS_WIN)
|
||||
# error No known target OS defined.
|
||||
# endif
|
||||
|
||||
#else // V8_HAVE_TARGET_OS
|
||||
|
||||
# if defined(V8_TARGET_OS_ANDROID) \
|
||||
|| defined(V8_TARGET_OS_FUCHSIA) \
|
||||
|| defined(V8_TARGET_OS_IOS) \
|
||||
|| defined(V8_TARGET_OS_LINUX) \
|
||||
|| defined(V8_TARGET_OS_MACOSX) \
|
||||
|| defined(V8_TARGET_OS_WIN)
|
||||
# error A target OS is defined but V8_HAVE_TARGET_OS is unset.
|
||||
# endif
|
||||
|
||||
// Fall back to the detected host OS.
|
||||
#ifdef V8_OS_ANDROID
|
||||
# define V8_TARGET_OS_ANDROID
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_FUCHSIA
|
||||
# define V8_TARGET_OS_FUCHSIA
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_IOS
|
||||
# define V8_TARGET_OS_IOS
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_LINUX
|
||||
# define V8_TARGET_OS_LINUX
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_MACOSX
|
||||
# define V8_TARGET_OS_MACOSX
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
# define V8_TARGET_OS_WIN
|
||||
#endif
|
||||
|
||||
#endif // V8_HAVE_TARGET_OS
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// C library detection
|
||||
|
|
@ -169,7 +230,7 @@
|
|||
//
|
||||
// V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
|
||||
// supported
|
||||
// V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
|
||||
// V8_HAS_ATTRIBUTE_NONNULL - __attribute__((nonnull)) supported
|
||||
// V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
|
||||
// V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
|
||||
// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
|
||||
|
|
@ -186,10 +247,10 @@
|
|||
// V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported
|
||||
// V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported
|
||||
// V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported
|
||||
// V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
|
||||
// V8_HAS_COMPUTED_GOTO - computed goto/labels as values
|
||||
// supported
|
||||
// V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
|
||||
// V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported
|
||||
// V8_HAS_DECLSPEC_NORETURN - __declspec(noreturn) supported
|
||||
// V8_HAS___FORCEINLINE - __forceinline supported
|
||||
//
|
||||
// Note that testing for compilers and/or features must be done using #if
|
||||
|
|
@ -205,15 +266,14 @@
|
|||
#endif
|
||||
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE \
|
||||
(__has_extension(attribute_deprecated_with_message))
|
||||
# define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(__has_attribute(warn_unused_result))
|
||||
|
||||
# define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
|
||||
# define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
|
||||
# define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
|
||||
# define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
|
||||
|
|
@ -226,9 +286,13 @@
|
|||
# define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
|
||||
# define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
|
||||
|
||||
# if __cplusplus >= 201402L
|
||||
# define V8_CAN_HAVE_DCHECK_IN_CONSTEXPR 1
|
||||
# endif
|
||||
// Clang has no __has_feature for computed gotos.
|
||||
// GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
# define V8_HAS_COMPUTED_GOTO 1
|
||||
|
||||
// Whether constexpr has full C++14 semantics, in particular that non-constexpr
|
||||
// code is allowed as long as it's not executed for any constexpr instantiation.
|
||||
# define V8_HAS_CXX14_CONSTEXPR 1
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
|
|
@ -247,30 +311,34 @@
|
|||
// always_inline is available in gcc 4.0 but not very reliable until 4.4.
|
||||
// Works around "sorry, unimplemented: inlining failed" build errors with
|
||||
// older compilers.
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0))
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0))
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE 1
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE 1
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED 1
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY 1
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
|
||||
|
||||
# define V8_HAS_BUILTIN_CLZ (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_CTZ (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
|
||||
# define V8_HAS_BUILTIN_FRAME_ADDRESS (V8_GNUC_PREREQ(2, 96, 0))
|
||||
# define V8_HAS_BUILTIN_POPCOUNT (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
|
||||
# define V8_HAS_BUILTIN_CLZ 1
|
||||
# define V8_HAS_BUILTIN_CTZ 1
|
||||
# define V8_HAS_BUILTIN_EXPECT 1
|
||||
# define V8_HAS_BUILTIN_FRAME_ADDRESS 1
|
||||
# define V8_HAS_BUILTIN_POPCOUNT 1
|
||||
|
||||
// GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
#define V8_HAS_COMPUTED_GOTO 1
|
||||
|
||||
// Whether constexpr has full C++14 semantics, in particular that non-constexpr
|
||||
// code is allowed as long as it's not executed for any constexpr instantiation.
|
||||
// GCC only supports this since version 6.
|
||||
# define V8_HAS_CXX14_CONSTEXPR (V8_GNUC_PREREQ(6, 0, 0))
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define V8_CC_MSVC 1
|
||||
|
||||
# define V8_HAS_DECLSPEC_DEPRECATED 1
|
||||
# define V8_HAS_DECLSPEC_NOINLINE 1
|
||||
# define V8_HAS_DECLSPEC_SELECTANY 1
|
||||
# define V8_HAS_DECLSPEC_NORETURN 1
|
||||
|
||||
# define V8_HAS___FORCEINLINE 1
|
||||
|
||||
|
|
@ -291,6 +359,23 @@
|
|||
# define V8_INLINE inline
|
||||
#endif
|
||||
|
||||
#if V8_HAS_BUILTIN_ASSUME_ALIGNED
|
||||
# define V8_ASSUME_ALIGNED(ptr, alignment) \
|
||||
__builtin_assume_aligned((ptr), (alignment))
|
||||
#else
|
||||
# define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
|
||||
#endif
|
||||
|
||||
|
||||
// A macro to mark specific arguments as non-null.
|
||||
// Use like:
|
||||
// int add(int* x, int y, int* z) V8_NONNULL(1, 3) { return *x + y + *z; }
|
||||
#if V8_HAS_ATTRIBUTE_NONNULL
|
||||
# define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
#else
|
||||
# define V8_NONNULL(...) /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
|
||||
// A macro used to tell the compiler to never inline a particular function.
|
||||
// Don't bother for debug builds.
|
||||
|
|
@ -306,31 +391,18 @@
|
|||
|
||||
|
||||
// A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
|
||||
#if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
|
||||
#define V8_DEPRECATED(message, declarator) \
|
||||
declarator __attribute__((deprecated(message)))
|
||||
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
|
||||
#define V8_DEPRECATED(message, declarator) \
|
||||
declarator __attribute__((deprecated))
|
||||
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
|
||||
#define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
|
||||
#if defined(V8_DEPRECATION_WARNINGS)
|
||||
# define V8_DEPRECATED(message) [[deprecated(message)]]
|
||||
#else
|
||||
#define V8_DEPRECATED(message, declarator) declarator
|
||||
# define V8_DEPRECATED(message)
|
||||
#endif
|
||||
|
||||
|
||||
// A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS) && \
|
||||
V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
|
||||
#define V8_DEPRECATE_SOON(message, declarator) \
|
||||
declarator __attribute__((deprecated(message)))
|
||||
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
|
||||
#define V8_DEPRECATE_SOON(message, declarator) \
|
||||
declarator __attribute__((deprecated))
|
||||
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
|
||||
#define V8_DEPRECATE_SOON(message, declarator) __declspec(deprecated) declarator
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
|
||||
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
|
||||
#else
|
||||
#define V8_DEPRECATE_SOON(message, declarator) declarator
|
||||
# define V8_DEPRECATE_SOON(message)
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -353,6 +425,12 @@
|
|||
#define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
|
||||
#error Inconsistent build configuration: To build the V8 shared library \
|
||||
set BUILDING_V8_SHARED, to include its headers for linking against the \
|
||||
V8 shared library set USING_V8_SHARED.
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
|
||||
// Setup for Windows DLL export/import. When building the V8 DLL the
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef V8_LIBPLATFORM_LIBPLATFORM_H_
|
||||
#define V8_LIBPLATFORM_LIBPLATFORM_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "libplatform/libplatform-export.h"
|
||||
#include "libplatform/v8-tracing.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
|
|
@ -70,11 +72,10 @@ V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform,
|
|||
* The |platform| has to be created using |NewDefaultPlatform|.
|
||||
*
|
||||
*/
|
||||
V8_PLATFORM_EXPORT V8_DEPRECATE_SOON(
|
||||
"Access the DefaultPlatform directly",
|
||||
void SetTracingController(
|
||||
v8::Platform* platform,
|
||||
v8::platform::tracing::TracingController* tracing_controller));
|
||||
V8_DEPRECATE_SOON("Access the DefaultPlatform directly")
|
||||
V8_PLATFORM_EXPORT void SetTracingController(
|
||||
v8::Platform* platform,
|
||||
v8::platform::tracing::TracingController* tracing_controller);
|
||||
|
||||
} // namespace platform
|
||||
} // namespace v8
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@
|
|||
#include "libplatform/libplatform-export.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
|
||||
namespace perfetto {
|
||||
class TracingSession;
|
||||
}
|
||||
|
||||
namespace v8 {
|
||||
|
||||
namespace base {
|
||||
|
|
@ -23,12 +27,15 @@ class Mutex;
|
|||
namespace platform {
|
||||
namespace tracing {
|
||||
|
||||
class TraceEventListener;
|
||||
class JSONTraceEventListener;
|
||||
|
||||
const int kTraceMaxNumArgs = 2;
|
||||
|
||||
class V8_PLATFORM_EXPORT TraceObject {
|
||||
public:
|
||||
union ArgValue {
|
||||
bool as_bool;
|
||||
V8_DEPRECATED("use as_uint ? true : false") bool as_bool;
|
||||
uint64_t as_uint;
|
||||
int64_t as_int;
|
||||
double as_double;
|
||||
|
|
@ -237,7 +244,17 @@ class V8_PLATFORM_EXPORT TracingController
|
|||
|
||||
TracingController();
|
||||
~TracingController() override;
|
||||
|
||||
// Takes ownership of |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);
|
||||
// Provide an optional listener for testing that will receive trace events.
|
||||
// Must be called before StartTracing().
|
||||
void SetTraceEventListenerForTesting(TraceEventListener* listener);
|
||||
#endif
|
||||
|
||||
// v8::TracingController implementation.
|
||||
const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
|
||||
|
|
@ -280,6 +297,12 @@ class V8_PLATFORM_EXPORT TracingController
|
|||
std::unique_ptr<base::Mutex> mutex_;
|
||||
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
|
||||
std::atomic_bool recording_{false};
|
||||
#ifdef V8_USE_PERFETTO
|
||||
std::ostream* output_stream_ = nullptr;
|
||||
std::unique_ptr<JSONTraceEventListener> json_listener_;
|
||||
TraceEventListener* listener_for_testing_ = nullptr;
|
||||
std::unique_ptr<perfetto::TracingSession> tracing_session_;
|
||||
#endif
|
||||
|
||||
// Disallow copy and assign
|
||||
TracingController(const TracingController&) = delete;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <cctype>
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "v8.h" // NOLINT(build/include)
|
||||
|
||||
|
|
@ -24,6 +25,7 @@ namespace Runtime {
|
|||
namespace API {
|
||||
class RemoteObject;
|
||||
class StackTrace;
|
||||
class StackTraceId;
|
||||
}
|
||||
}
|
||||
namespace Schema {
|
||||
|
|
@ -87,7 +89,6 @@ class V8_EXPORT V8ContextInfo {
|
|||
|
||||
static int executionContextId(v8::Local<v8::Context> context);
|
||||
|
||||
private:
|
||||
// Disallow copying and allocating this one.
|
||||
enum NotNullTagEnum { NotNullLiteral };
|
||||
void* operator new(size_t) = delete;
|
||||
|
|
@ -110,6 +111,8 @@ class V8_EXPORT V8StackTrace {
|
|||
virtual ~V8StackTrace() = default;
|
||||
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
||||
buildInspectorObject() const = 0;
|
||||
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
||||
buildInspectorObject(int maxAsyncDepth) const = 0;
|
||||
virtual std::unique_ptr<StringBuffer> toString() const = 0;
|
||||
|
||||
// Safe to pass between threads, drops async chain.
|
||||
|
|
@ -131,7 +134,7 @@ class V8_EXPORT V8InspectorSession {
|
|||
// Dispatching protocol messages.
|
||||
static bool canDispatchMethod(const StringView& method);
|
||||
virtual void dispatchProtocolMessage(const StringView& message) = 0;
|
||||
virtual std::unique_ptr<StringBuffer> stateJSON() = 0;
|
||||
virtual std::vector<uint8_t> state() = 0;
|
||||
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
||||
supportedDomains() = 0;
|
||||
|
||||
|
|
@ -228,12 +231,20 @@ class V8_EXPORT V8InspectorClient {
|
|||
struct V8_EXPORT V8StackTraceId {
|
||||
uintptr_t id;
|
||||
std::pair<int64_t, int64_t> debugger_id;
|
||||
bool should_pause = false;
|
||||
|
||||
V8StackTraceId();
|
||||
V8StackTraceId(const V8StackTraceId&) = default;
|
||||
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id);
|
||||
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id,
|
||||
bool should_pause);
|
||||
explicit V8StackTraceId(const StringView&);
|
||||
V8StackTraceId& operator=(const V8StackTraceId&) = default;
|
||||
V8StackTraceId& operator=(V8StackTraceId&&) noexcept = default;
|
||||
~V8StackTraceId() = default;
|
||||
|
||||
bool IsInvalid() const;
|
||||
std::unique_ptr<StringBuffer> ToString();
|
||||
};
|
||||
|
||||
class V8_EXPORT V8Inspector {
|
||||
|
|
@ -289,6 +300,24 @@ class V8_EXPORT V8Inspector {
|
|||
virtual std::unique_ptr<V8StackTrace> createStackTrace(
|
||||
v8::Local<v8::StackTrace>) = 0;
|
||||
virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
|
||||
|
||||
// Performance counters.
|
||||
class V8_EXPORT Counters : public std::enable_shared_from_this<Counters> {
|
||||
public:
|
||||
explicit Counters(v8::Isolate* isolate);
|
||||
~Counters();
|
||||
const std::unordered_map<std::string, int>& getCountersMap() const {
|
||||
return m_countersMap;
|
||||
}
|
||||
|
||||
private:
|
||||
static int* getCounterPtr(const char* name);
|
||||
|
||||
v8::Isolate* m_isolate;
|
||||
std::unordered_map<std::string, int> m_countersMap;
|
||||
};
|
||||
|
||||
virtual std::shared_ptr<Counters> enableCounters() = 0;
|
||||
};
|
||||
|
||||
} // namespace v8_inspector
|
||||
|
|
|
|||
|
|
@ -48,28 +48,32 @@ const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
|
|||
template <size_t tagged_ptr_size>
|
||||
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.
|
||||
template <>
|
||||
struct SmiTagging<4> {
|
||||
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) {
|
||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||
// Shift down (requires >> to be sign extending).
|
||||
return static_cast<int>(static_cast<intptr_t>(value)) >> shift_bits;
|
||||
// Truncate and shift down (requires >> to be sign extending).
|
||||
return static_cast<int32_t>(static_cast<uint32_t>(value)) >> shift_bits;
|
||||
}
|
||||
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
|
||||
// To be representable as an tagged small integer, the two
|
||||
// most-significant bits of 'value' must be either 00 or 11 due to
|
||||
// sign-extension. To check this we add 01 to the two
|
||||
// most-significant bits, and check if the most-significant bit is 0.
|
||||
//
|
||||
// CAUTION: The original code below:
|
||||
// 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;
|
||||
// Is value in range [kSmiMinValue, kSmiMaxValue].
|
||||
// Use unsigned operations in order to avoid undefined behaviour in case of
|
||||
// signed integer overflow.
|
||||
return (static_cast<uintptr_t>(value) -
|
||||
static_cast<uintptr_t>(kSmiMinValue)) <=
|
||||
(static_cast<uintptr_t>(kSmiMaxValue) -
|
||||
static_cast<uintptr_t>(kSmiMinValue));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -77,6 +81,11 @@ struct SmiTagging<4> {
|
|||
template <>
|
||||
struct SmiTagging<8> {
|
||||
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) {
|
||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||
// Shift down and throw away top 32 bits.
|
||||
|
|
@ -98,15 +107,17 @@ const int kApiTaggedSize = kApiSystemPointerSize;
|
|||
#endif
|
||||
|
||||
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
|
||||
typedef SmiTagging<kApiInt32Size> PlatformSmiTagging;
|
||||
using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
|
||||
#else
|
||||
typedef SmiTagging<kApiTaggedSize> PlatformSmiTagging;
|
||||
using PlatformSmiTagging = SmiTagging<kApiTaggedSize>;
|
||||
#endif
|
||||
|
||||
// TODO(ishell): Consinder adding kSmiShiftBits = kSmiShiftSize + kSmiTagSize
|
||||
// since it's used much more often than the inividual constants.
|
||||
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
|
||||
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
|
||||
const int kSmiMinValue = (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
|
||||
const int kSmiMaxValue = -(kSmiMinValue + 1);
|
||||
const int kSmiMinValue = static_cast<int>(PlatformSmiTagging::kSmiMinValue);
|
||||
const int kSmiMaxValue = static_cast<int>(PlatformSmiTagging::kSmiMaxValue);
|
||||
constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
|
||||
constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
|
||||
|
||||
|
|
@ -135,7 +146,7 @@ class Internals {
|
|||
static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize;
|
||||
static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize;
|
||||
static const int kEmbedderDataSlotSize = kApiSystemPointerSize;
|
||||
static const int kNativeContextEmbedderDataOffset = 7 * kApiTaggedSize;
|
||||
static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize;
|
||||
static const int kFullStringRepresentationMask = 0x0f;
|
||||
static const int kStringEncodingMask = 0x8;
|
||||
static const int kExternalTwoByteRepresentationTag = 0x02;
|
||||
|
|
@ -143,6 +154,7 @@ class Internals {
|
|||
|
||||
static const uint32_t kNumIsolateDataSlots = 4;
|
||||
|
||||
// IsolateData layout guarantees.
|
||||
static const int kIsolateEmbedderDataOffset = 0;
|
||||
static const int kExternalMemoryOffset =
|
||||
kNumIsolateDataSlots * kApiSystemPointerSize;
|
||||
|
|
@ -150,8 +162,14 @@ class Internals {
|
|||
kExternalMemoryOffset + kApiInt64Size;
|
||||
static const int kExternalMemoryAtLastMarkCompactOffset =
|
||||
kExternalMemoryLimitOffset + kApiInt64Size;
|
||||
static const int kIsolateRootsOffset =
|
||||
static const int kIsolateFastCCallCallerFpOffset =
|
||||
kExternalMemoryAtLastMarkCompactOffset + kApiInt64Size;
|
||||
static const int kIsolateFastCCallCallerPcOffset =
|
||||
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
|
||||
static const int kIsolateStackGuardOffset =
|
||||
kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize;
|
||||
static const int kIsolateRootsOffset =
|
||||
kIsolateStackGuardOffset + 7 * kApiSystemPointerSize;
|
||||
|
||||
static const int kUndefinedValueRootIndex = 4;
|
||||
static const int kTheHoleValueRootIndex = 5;
|
||||
|
|
@ -165,12 +183,10 @@ class Internals {
|
|||
static const int kNodeStateMask = 0x7;
|
||||
static const int kNodeStateIsWeakValue = 2;
|
||||
static const int kNodeStateIsPendingValue = 3;
|
||||
static const int kNodeIsIndependentShift = 3;
|
||||
static const int kNodeIsActiveShift = 4;
|
||||
|
||||
static const int kFirstNonstringType = 0x40;
|
||||
static const int kOddballType = 0x43;
|
||||
static const int kForeignType = 0x47;
|
||||
static const int kForeignType = 0x46;
|
||||
static const int kJSSpecialApiObjectType = 0x410;
|
||||
static const int kJSApiObjectType = 0x420;
|
||||
static const int kJSObjectType = 0x421;
|
||||
|
|
@ -313,14 +329,11 @@ class Internals {
|
|||
#ifdef V8_COMPRESS_POINTERS
|
||||
// See v8:7703 or src/ptr-compr.* for details about pointer compression.
|
||||
static constexpr size_t kPtrComprHeapReservationSize = size_t{1} << 32;
|
||||
static constexpr size_t kPtrComprIsolateRootBias =
|
||||
kPtrComprHeapReservationSize / 2;
|
||||
static constexpr size_t kPtrComprIsolateRootAlignment = size_t{1} << 32;
|
||||
|
||||
V8_INLINE static internal::Address GetRootFromOnHeapAddress(
|
||||
internal::Address addr) {
|
||||
return (addr + kPtrComprIsolateRootBias) &
|
||||
-static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
||||
return addr & -static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
||||
}
|
||||
|
||||
V8_INLINE static internal::Address DecompressTaggedAnyField(
|
||||
|
|
@ -367,6 +380,10 @@ V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);
|
|||
// language mode is strict.
|
||||
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate);
|
||||
|
||||
// A base class for backing stores, which is needed due to vagaries of
|
||||
// how static casts work with std::shared_ptr.
|
||||
class BackingStoreBase {};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ class TaskRunner {
|
|||
TaskRunner() = default;
|
||||
virtual ~TaskRunner() = default;
|
||||
|
||||
private:
|
||||
TaskRunner(const TaskRunner&) = delete;
|
||||
TaskRunner& operator=(const TaskRunner&) = delete;
|
||||
};
|
||||
|
|
@ -368,9 +367,8 @@ class Platform {
|
|||
* |isolate|. Tasks posted for the same isolate should be execute in order of
|
||||
* scheduling. The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallOnForegroundThread(Isolate* isolate, Task* task)) = 0;
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallOnForegroundThread(Isolate* isolate, Task* task) { abort(); }
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a foreground thread wrt a specific
|
||||
|
|
@ -378,10 +376,11 @@ class Platform {
|
|||
* Tasks posted for the same isolate should be execute in order of
|
||||
* scheduling. The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
||||
double delay_in_seconds)) = 0;
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
||||
double delay_in_seconds) {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a foreground thread wrt a specific
|
||||
|
|
@ -391,20 +390,15 @@ class Platform {
|
|||
* starved for an arbitrarily long time if no idle time is available.
|
||||
* The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallIdleOnForegroundThread(Isolate* isolate,
|
||||
IdleTask* task)) {
|
||||
// This must be overriden if |IdleTasksEnabled()|.
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if idle tasks are enabled for the given |isolate|.
|
||||
*/
|
||||
virtual bool IdleTasksEnabled(Isolate* isolate) {
|
||||
return false;
|
||||
}
|
||||
virtual bool IdleTasksEnabled(Isolate* isolate) { return false; }
|
||||
|
||||
/**
|
||||
* Monotonically increasing time in seconds from an arbitrary fixed point in
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@
|
|||
#ifndef V8_V8_PROFILER_H_
|
||||
#define V8_V8_PROFILER_H_
|
||||
|
||||
#include <limits.h>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "v8.h" // NOLINT(build/include)
|
||||
|
||||
/**
|
||||
|
|
@ -17,14 +20,18 @@ namespace v8 {
|
|||
class HeapGraphNode;
|
||||
struct HeapStatsUpdate;
|
||||
|
||||
typedef uint32_t SnapshotObjectId;
|
||||
|
||||
using NativeObject = void*;
|
||||
using SnapshotObjectId = uint32_t;
|
||||
|
||||
struct CpuProfileDeoptFrame {
|
||||
int script_id;
|
||||
size_t position;
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
class CpuProfile;
|
||||
} // namespace internal
|
||||
|
||||
} // namespace v8
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
|
|
@ -47,75 +54,6 @@ template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>;
|
|||
|
||||
namespace v8 {
|
||||
|
||||
// TickSample captures the information collected for each sample.
|
||||
struct V8_EXPORT TickSample {
|
||||
// Internal profiling (with --prof + tools/$OS-tick-processor) wants to
|
||||
// include the runtime function we're calling. Externally exposed tick
|
||||
// samples don't care.
|
||||
enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame };
|
||||
|
||||
TickSample()
|
||||
: state(OTHER),
|
||||
pc(nullptr),
|
||||
external_callback_entry(nullptr),
|
||||
frames_count(0),
|
||||
has_external_callback(false),
|
||||
update_stats(true) {}
|
||||
|
||||
/**
|
||||
* Initialize a tick sample from the isolate.
|
||||
* \param isolate The isolate.
|
||||
* \param state Execution state.
|
||||
* \param record_c_entry_frame Include or skip the runtime function.
|
||||
* \param update_stats Whether update the sample to the aggregated stats.
|
||||
* \param use_simulator_reg_state When set to true and V8 is running under a
|
||||
* simulator, the method will use the simulator
|
||||
* register state rather than the one provided
|
||||
* with |state| argument. Otherwise the method
|
||||
* will use provided register |state| as is.
|
||||
*/
|
||||
void Init(Isolate* isolate, const v8::RegisterState& state,
|
||||
RecordCEntryFrame record_c_entry_frame, bool update_stats,
|
||||
bool use_simulator_reg_state = true);
|
||||
/**
|
||||
* Get a call stack sample from the isolate.
|
||||
* \param isolate The isolate.
|
||||
* \param state Register state.
|
||||
* \param record_c_entry_frame Include or skip the runtime function.
|
||||
* \param frames Caller allocated buffer to store stack frames.
|
||||
* \param frames_limit Maximum number of frames to capture. The buffer must
|
||||
* be large enough to hold the number of frames.
|
||||
* \param sample_info The sample info is filled up by the function
|
||||
* provides number of actual captured stack frames and
|
||||
* the current VM state.
|
||||
* \param use_simulator_reg_state When set to true and V8 is running under a
|
||||
* simulator, the method will use the simulator
|
||||
* register state rather than the one provided
|
||||
* with |state| argument. Otherwise the method
|
||||
* will use provided register |state| as is.
|
||||
* \note GetStackSample is thread and signal safe and should only be called
|
||||
* when the JS thread is paused or interrupted.
|
||||
* Otherwise the behavior is undefined.
|
||||
*/
|
||||
static bool GetStackSample(Isolate* isolate, v8::RegisterState* state,
|
||||
RecordCEntryFrame record_c_entry_frame,
|
||||
void** frames, size_t frames_limit,
|
||||
v8::SampleInfo* sample_info,
|
||||
bool use_simulator_reg_state = true);
|
||||
StateTag state; // The state of the VM.
|
||||
void* pc; // Instruction pointer.
|
||||
union {
|
||||
void* tos; // Top stack value (*sp).
|
||||
void* external_callback_entry;
|
||||
};
|
||||
static const unsigned kMaxFramesCountLog2 = 8;
|
||||
static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1;
|
||||
void* stack[kMaxFramesCount]; // Call stack.
|
||||
unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames.
|
||||
bool has_external_callback : 1;
|
||||
bool update_stats : 1; // Whether the sample should update aggregated stats.
|
||||
};
|
||||
|
||||
/**
|
||||
* CpuProfileNode represents a node in a call graph.
|
||||
*/
|
||||
|
|
@ -206,11 +144,6 @@ class V8_EXPORT CpuProfileNode {
|
|||
*/
|
||||
unsigned GetHitCount() const;
|
||||
|
||||
/** Returns function entry UID. */
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use GetScriptId, GetLineNumber, and GetColumnNumber instead.",
|
||||
unsigned GetCallUid() const);
|
||||
|
||||
/** Returns id of the node. The id is unique within the tree */
|
||||
unsigned GetNodeId() const;
|
||||
|
||||
|
|
@ -297,6 +230,66 @@ enum CpuProfilingMode {
|
|||
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,
|
||||
};
|
||||
|
||||
enum CpuProfilingLoggingMode {
|
||||
// Enables logging when a profile is active, and disables logging when all
|
||||
// profiles are detached.
|
||||
kLazyLogging,
|
||||
// Enables logging for the lifetime of the CpuProfiler. Calls to
|
||||
// StartRecording are faster, at the expense of runtime overhead.
|
||||
kEagerLogging,
|
||||
};
|
||||
|
||||
/**
|
||||
* 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,
|
||||
MaybeLocal<Context> filter_context = MaybeLocal<Context>());
|
||||
|
||||
CpuProfilingMode mode() const { return mode_; }
|
||||
unsigned max_samples() const { return max_samples_; }
|
||||
int sampling_interval_us() const { return sampling_interval_us_; }
|
||||
|
||||
private:
|
||||
friend class internal::CpuProfile;
|
||||
|
||||
bool has_filter_context() const { return !filter_context_.IsEmpty(); }
|
||||
void* raw_filter_context() const;
|
||||
|
||||
CpuProfilingMode mode_;
|
||||
unsigned max_samples_;
|
||||
int sampling_interval_us_;
|
||||
CopyablePersistentTraits<Context>::CopyablePersistent filter_context_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for controlling CPU profiling. Instance of the
|
||||
* profiler can be created using v8::CpuProfiler::New method.
|
||||
|
|
@ -308,7 +301,9 @@ class V8_EXPORT CpuProfiler {
|
|||
* initialized. The profiler object must be disposed after use by calling
|
||||
* |Dispose| method.
|
||||
*/
|
||||
static CpuProfiler* New(Isolate* isolate);
|
||||
static CpuProfiler* New(Isolate* isolate,
|
||||
CpuProfilingNamingMode = kDebugNaming,
|
||||
CpuProfilingLoggingMode = kLazyLogging);
|
||||
|
||||
/**
|
||||
* Synchronously collect current stack sample in all profilers attached to
|
||||
|
|
@ -339,18 +334,26 @@ class V8_EXPORT CpuProfiler {
|
|||
void SetUsePreciseSampling(bool);
|
||||
|
||||
/**
|
||||
* Starts collecting CPU profile. Title may be an empty string. It
|
||||
* is allowed to have several profiles being collected at
|
||||
* once. Attempts to start collecting several profiles with the same
|
||||
* title are silently ignored. While collecting a profile, functions
|
||||
* from all security contexts are included in it. The token-based
|
||||
* filtering is only performed when querying for a profile.
|
||||
* Starts collecting a CPU profile. Title may be an empty string. Several
|
||||
* profiles may be collected at once. Attempts to start collecting several
|
||||
* profiles with the same title are silently ignored.
|
||||
*/
|
||||
void StartProfiling(Local<String> title, CpuProfilingOptions options);
|
||||
|
||||
/**
|
||||
* Starts profiling with the same semantics as above, except with expanded
|
||||
* parameters.
|
||||
*
|
||||
* |record_samples| parameter controls whether individual samples should
|
||||
* 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(Local<String> title, CpuProfilingMode mode,
|
||||
bool record_samples = false);
|
||||
void StartProfiling(
|
||||
Local<String> title, CpuProfilingMode mode, bool record_samples = false,
|
||||
unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
|
||||
/**
|
||||
* The same as StartProfiling above, but the CpuProfilingMode defaults to
|
||||
* kLeafNodeLineNumbers mode, which was the previous default behavior of the
|
||||
|
|
@ -364,20 +367,6 @@ class V8_EXPORT CpuProfiler {
|
|||
*/
|
||||
CpuProfile* StopProfiling(Local<String> title);
|
||||
|
||||
/**
|
||||
* Force collection of a sample. Must be called on the VM thread.
|
||||
* Recording the forced sample does not contribute to the aggregated
|
||||
* profile statistics.
|
||||
*/
|
||||
V8_DEPRECATED("Use static CollectSample(Isolate*) instead.",
|
||||
void CollectSample());
|
||||
|
||||
/**
|
||||
* Tells the profiler whether the embedder is idle.
|
||||
*/
|
||||
V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.",
|
||||
void SetIdle(bool is_idle));
|
||||
|
||||
/**
|
||||
* Generate more detailed source positions to code objects. This results in
|
||||
* better results when mapping profiling samples to script source.
|
||||
|
|
@ -391,7 +380,6 @@ class V8_EXPORT CpuProfiler {
|
|||
CpuProfiler& operator=(const CpuProfiler&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* HeapSnapshotEdge represents a directed connection between heap
|
||||
* graph nodes: from retainers to retained nodes.
|
||||
|
|
@ -742,7 +730,12 @@ class V8_EXPORT EmbedderGraph {
|
|||
*/
|
||||
virtual const char* NamePrefix() { return nullptr; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Returns the NativeObject that can be used for querying the
|
||||
* |HeapSnapshot|.
|
||||
*/
|
||||
virtual NativeObject GetNativeObject() { return nullptr; }
|
||||
|
||||
Node(const Node&) = delete;
|
||||
Node& operator=(const Node&) = delete;
|
||||
};
|
||||
|
|
@ -805,6 +798,12 @@ class V8_EXPORT HeapProfiler {
|
|||
*/
|
||||
SnapshotObjectId GetObjectId(Local<Value> value);
|
||||
|
||||
/**
|
||||
* Returns SnapshotObjectId for a native object referenced by |value| if it
|
||||
* has been seen by the heap profiler, kUnknownObjectId otherwise.
|
||||
*/
|
||||
SnapshotObjectId GetObjectId(NativeObject value);
|
||||
|
||||
/**
|
||||
* Returns heap object with given SnapshotObjectId if the object is alive,
|
||||
* otherwise empty handle is returned.
|
||||
|
|
@ -973,7 +972,8 @@ struct HeapStatsUpdate {
|
|||
V(LazyCompile) \
|
||||
V(RegExp) \
|
||||
V(Script) \
|
||||
V(Stub)
|
||||
V(Stub) \
|
||||
V(Relocation)
|
||||
|
||||
/**
|
||||
* Note that this enum may be extended in the future. Please include a default
|
||||
|
|
@ -1006,10 +1006,12 @@ class V8_EXPORT CodeEvent {
|
|||
const char* GetComment();
|
||||
|
||||
static const char* GetCodeEventTypeName(CodeEventType code_event_type);
|
||||
|
||||
uintptr_t GetPreviousCodeStartAddress();
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface to listen to code creation events.
|
||||
* Interface to listen to code creation and code relocation events.
|
||||
*/
|
||||
class V8_EXPORT CodeEventHandler {
|
||||
public:
|
||||
|
|
@ -1021,9 +1023,26 @@ class V8_EXPORT CodeEventHandler {
|
|||
explicit CodeEventHandler(Isolate* isolate);
|
||||
virtual ~CodeEventHandler();
|
||||
|
||||
/**
|
||||
* Handle is called every time a code object is created or moved. Information
|
||||
* about each code event will be available through the `code_event`
|
||||
* parameter.
|
||||
*
|
||||
* When the CodeEventType is kRelocationType, the code for this CodeEvent has
|
||||
* moved from `GetPreviousCodeStartAddress()` to `GetCodeStartAddress()`.
|
||||
*/
|
||||
virtual void Handle(CodeEvent* code_event) = 0;
|
||||
|
||||
/**
|
||||
* Call `Enable()` to starts listening to code creation and code relocation
|
||||
* events. These events will be handled by `Handle()`.
|
||||
*/
|
||||
void Enable();
|
||||
|
||||
/**
|
||||
* Call `Disable()` to stop listening to code creation and code relocation
|
||||
* events.
|
||||
*/
|
||||
void Disable();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -11,10 +11,9 @@
|
|||
* Testing support for the V8 JavaScript engine.
|
||||
*/
|
||||
namespace v8 {
|
||||
|
||||
class V8_EXPORT Testing {
|
||||
public:
|
||||
enum StressType {
|
||||
enum V8_DEPRECATED("Don't use this (d8-specific testing logic).") StressType {
|
||||
kStressTypeOpt,
|
||||
kStressTypeDeopt
|
||||
};
|
||||
|
|
@ -22,27 +21,30 @@ class V8_EXPORT Testing {
|
|||
/**
|
||||
* Set the type of stressing to do. The default if not set is kStressTypeOpt.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void SetStressRunType(StressType type);
|
||||
|
||||
/**
|
||||
* Get the number of runs of a given test that is required to get the full
|
||||
* stress coverage.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static int GetStressRuns();
|
||||
|
||||
/**
|
||||
* Indicate the number of the run which is about to start. The value of run
|
||||
* should be between 0 and one less than the result from GetStressRuns()
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void PrepareStressRun(int run);
|
||||
|
||||
/**
|
||||
* Force deoptimization of all functions.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void DeoptimizeAll(Isolate* isolate);
|
||||
};
|
||||
|
||||
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_V8_TEST_H_
|
||||
|
|
|
|||
|
|
@ -194,14 +194,6 @@ class PersistentValueMapBase {
|
|||
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.
|
||||
*/
|
||||
|
|
@ -352,16 +344,6 @@ class PersistentValueMapBase {
|
|||
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>
|
||||
class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
// These macros define the version number for the current version.
|
||||
// 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.
|
||||
#define V8_MAJOR_VERSION 7
|
||||
#define V8_MINOR_VERSION 5
|
||||
#define V8_BUILD_NUMBER 288
|
||||
#define V8_PATCH_LEVEL 22
|
||||
#define V8_MAJOR_VERSION 8
|
||||
#define V8_MINOR_VERSION 0
|
||||
#define V8_BUILD_NUMBER 426
|
||||
#define V8_PATCH_LEVEL 16
|
||||
|
||||
// Use 1 for candidates and 0 otherwise.
|
||||
// (Boolean macro values are not supported by all preprocessors.)
|
||||
|
|
|
|||
1597
ios/include/v8/v8.h
1597
ios/include/v8/v8.h
File diff suppressed because it is too large
Load Diff
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Operating system detection
|
||||
// Operating system detection (host)
|
||||
//
|
||||
// V8_OS_ANDROID - Android
|
||||
// V8_OS_BSD - BSDish (Mac OS X, Net/Free/Open/DragonFlyBSD)
|
||||
|
|
@ -122,6 +122,67 @@
|
|||
# define V8_OS_WIN 1
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Operating system detection (target)
|
||||
//
|
||||
// V8_TARGET_OS_ANDROID
|
||||
// V8_TARGET_OS_FUCHSIA
|
||||
// V8_TARGET_OS_IOS
|
||||
// V8_TARGET_OS_LINUX
|
||||
// V8_TARGET_OS_MACOSX
|
||||
// V8_TARGET_OS_WIN
|
||||
//
|
||||
// If not set explicitly, these fall back to corresponding V8_OS_ values.
|
||||
|
||||
#ifdef V8_HAVE_TARGET_OS
|
||||
|
||||
// The target OS is provided, just check that at least one known value is set.
|
||||
# if !defined(V8_TARGET_OS_ANDROID) \
|
||||
&& !defined(V8_TARGET_OS_FUCHSIA) \
|
||||
&& !defined(V8_TARGET_OS_IOS) \
|
||||
&& !defined(V8_TARGET_OS_LINUX) \
|
||||
&& !defined(V8_TARGET_OS_MACOSX) \
|
||||
&& !defined(V8_TARGET_OS_WIN)
|
||||
# error No known target OS defined.
|
||||
# endif
|
||||
|
||||
#else // V8_HAVE_TARGET_OS
|
||||
|
||||
# if defined(V8_TARGET_OS_ANDROID) \
|
||||
|| defined(V8_TARGET_OS_FUCHSIA) \
|
||||
|| defined(V8_TARGET_OS_IOS) \
|
||||
|| defined(V8_TARGET_OS_LINUX) \
|
||||
|| defined(V8_TARGET_OS_MACOSX) \
|
||||
|| defined(V8_TARGET_OS_WIN)
|
||||
# error A target OS is defined but V8_HAVE_TARGET_OS is unset.
|
||||
# endif
|
||||
|
||||
// Fall back to the detected host OS.
|
||||
#ifdef V8_OS_ANDROID
|
||||
# define V8_TARGET_OS_ANDROID
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_FUCHSIA
|
||||
# define V8_TARGET_OS_FUCHSIA
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_IOS
|
||||
# define V8_TARGET_OS_IOS
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_LINUX
|
||||
# define V8_TARGET_OS_LINUX
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_MACOSX
|
||||
# define V8_TARGET_OS_MACOSX
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
# define V8_TARGET_OS_WIN
|
||||
#endif
|
||||
|
||||
#endif // V8_HAVE_TARGET_OS
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// C library detection
|
||||
|
|
@ -169,7 +230,7 @@
|
|||
//
|
||||
// V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
|
||||
// supported
|
||||
// V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
|
||||
// V8_HAS_ATTRIBUTE_NONNULL - __attribute__((nonnull)) supported
|
||||
// V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
|
||||
// V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
|
||||
// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
|
||||
|
|
@ -186,10 +247,10 @@
|
|||
// V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported
|
||||
// V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported
|
||||
// V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported
|
||||
// V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
|
||||
// V8_HAS_COMPUTED_GOTO - computed goto/labels as values
|
||||
// supported
|
||||
// V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
|
||||
// V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported
|
||||
// V8_HAS_DECLSPEC_NORETURN - __declspec(noreturn) supported
|
||||
// V8_HAS___FORCEINLINE - __forceinline supported
|
||||
//
|
||||
// Note that testing for compilers and/or features must be done using #if
|
||||
|
|
@ -205,15 +266,14 @@
|
|||
#endif
|
||||
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE \
|
||||
(__has_extension(attribute_deprecated_with_message))
|
||||
# define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(__has_attribute(warn_unused_result))
|
||||
|
||||
# define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
|
||||
# define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
|
||||
# define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
|
||||
# define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
|
||||
|
|
@ -226,9 +286,13 @@
|
|||
# define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
|
||||
# define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
|
||||
|
||||
# if __cplusplus >= 201402L
|
||||
# define V8_CAN_HAVE_DCHECK_IN_CONSTEXPR 1
|
||||
# endif
|
||||
// Clang has no __has_feature for computed gotos.
|
||||
// GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
# define V8_HAS_COMPUTED_GOTO 1
|
||||
|
||||
// Whether constexpr has full C++14 semantics, in particular that non-constexpr
|
||||
// code is allowed as long as it's not executed for any constexpr instantiation.
|
||||
# define V8_HAS_CXX14_CONSTEXPR 1
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
|
|
@ -247,30 +311,34 @@
|
|||
// always_inline is available in gcc 4.0 but not very reliable until 4.4.
|
||||
// Works around "sorry, unimplemented: inlining failed" build errors with
|
||||
// older compilers.
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0))
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0))
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE 1
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE 1
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED 1
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY 1
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
|
||||
|
||||
# define V8_HAS_BUILTIN_CLZ (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_CTZ (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
|
||||
# define V8_HAS_BUILTIN_FRAME_ADDRESS (V8_GNUC_PREREQ(2, 96, 0))
|
||||
# define V8_HAS_BUILTIN_POPCOUNT (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
|
||||
# define V8_HAS_BUILTIN_CLZ 1
|
||||
# define V8_HAS_BUILTIN_CTZ 1
|
||||
# define V8_HAS_BUILTIN_EXPECT 1
|
||||
# define V8_HAS_BUILTIN_FRAME_ADDRESS 1
|
||||
# define V8_HAS_BUILTIN_POPCOUNT 1
|
||||
|
||||
// GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
#define V8_HAS_COMPUTED_GOTO 1
|
||||
|
||||
// Whether constexpr has full C++14 semantics, in particular that non-constexpr
|
||||
// code is allowed as long as it's not executed for any constexpr instantiation.
|
||||
// GCC only supports this since version 6.
|
||||
# define V8_HAS_CXX14_CONSTEXPR (V8_GNUC_PREREQ(6, 0, 0))
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define V8_CC_MSVC 1
|
||||
|
||||
# define V8_HAS_DECLSPEC_DEPRECATED 1
|
||||
# define V8_HAS_DECLSPEC_NOINLINE 1
|
||||
# define V8_HAS_DECLSPEC_SELECTANY 1
|
||||
# define V8_HAS_DECLSPEC_NORETURN 1
|
||||
|
||||
# define V8_HAS___FORCEINLINE 1
|
||||
|
||||
|
|
@ -291,6 +359,23 @@
|
|||
# define V8_INLINE inline
|
||||
#endif
|
||||
|
||||
#if V8_HAS_BUILTIN_ASSUME_ALIGNED
|
||||
# define V8_ASSUME_ALIGNED(ptr, alignment) \
|
||||
__builtin_assume_aligned((ptr), (alignment))
|
||||
#else
|
||||
# define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
|
||||
#endif
|
||||
|
||||
|
||||
// A macro to mark specific arguments as non-null.
|
||||
// Use like:
|
||||
// int add(int* x, int y, int* z) V8_NONNULL(1, 3) { return *x + y + *z; }
|
||||
#if V8_HAS_ATTRIBUTE_NONNULL
|
||||
# define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
#else
|
||||
# define V8_NONNULL(...) /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
|
||||
// A macro used to tell the compiler to never inline a particular function.
|
||||
// Don't bother for debug builds.
|
||||
|
|
@ -306,31 +391,18 @@
|
|||
|
||||
|
||||
// A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
|
||||
#if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
|
||||
#define V8_DEPRECATED(message, declarator) \
|
||||
declarator __attribute__((deprecated(message)))
|
||||
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
|
||||
#define V8_DEPRECATED(message, declarator) \
|
||||
declarator __attribute__((deprecated))
|
||||
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
|
||||
#define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
|
||||
#if defined(V8_DEPRECATION_WARNINGS)
|
||||
# define V8_DEPRECATED(message) [[deprecated(message)]]
|
||||
#else
|
||||
#define V8_DEPRECATED(message, declarator) declarator
|
||||
# define V8_DEPRECATED(message)
|
||||
#endif
|
||||
|
||||
|
||||
// A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS) && \
|
||||
V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
|
||||
#define V8_DEPRECATE_SOON(message, declarator) \
|
||||
declarator __attribute__((deprecated(message)))
|
||||
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
|
||||
#define V8_DEPRECATE_SOON(message, declarator) \
|
||||
declarator __attribute__((deprecated))
|
||||
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
|
||||
#define V8_DEPRECATE_SOON(message, declarator) __declspec(deprecated) declarator
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
|
||||
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
|
||||
#else
|
||||
#define V8_DEPRECATE_SOON(message, declarator) declarator
|
||||
# define V8_DEPRECATE_SOON(message)
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -353,6 +425,12 @@
|
|||
#define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
|
||||
#error Inconsistent build configuration: To build the V8 shared library \
|
||||
set BUILDING_V8_SHARED, to include its headers for linking against the \
|
||||
V8 shared library set USING_V8_SHARED.
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
|
||||
// Setup for Windows DLL export/import. When building the V8 DLL the
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef V8_LIBPLATFORM_LIBPLATFORM_H_
|
||||
#define V8_LIBPLATFORM_LIBPLATFORM_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "libplatform/libplatform-export.h"
|
||||
#include "libplatform/v8-tracing.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
|
|
@ -70,11 +72,10 @@ V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform,
|
|||
* The |platform| has to be created using |NewDefaultPlatform|.
|
||||
*
|
||||
*/
|
||||
V8_PLATFORM_EXPORT V8_DEPRECATE_SOON(
|
||||
"Access the DefaultPlatform directly",
|
||||
void SetTracingController(
|
||||
v8::Platform* platform,
|
||||
v8::platform::tracing::TracingController* tracing_controller));
|
||||
V8_DEPRECATE_SOON("Access the DefaultPlatform directly")
|
||||
V8_PLATFORM_EXPORT void SetTracingController(
|
||||
v8::Platform* platform,
|
||||
v8::platform::tracing::TracingController* tracing_controller);
|
||||
|
||||
} // namespace platform
|
||||
} // namespace v8
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@
|
|||
#include "libplatform/libplatform-export.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
|
||||
namespace perfetto {
|
||||
class TracingSession;
|
||||
}
|
||||
|
||||
namespace v8 {
|
||||
|
||||
namespace base {
|
||||
|
|
@ -23,12 +27,15 @@ class Mutex;
|
|||
namespace platform {
|
||||
namespace tracing {
|
||||
|
||||
class TraceEventListener;
|
||||
class JSONTraceEventListener;
|
||||
|
||||
const int kTraceMaxNumArgs = 2;
|
||||
|
||||
class V8_PLATFORM_EXPORT TraceObject {
|
||||
public:
|
||||
union ArgValue {
|
||||
bool as_bool;
|
||||
V8_DEPRECATED("use as_uint ? true : false") bool as_bool;
|
||||
uint64_t as_uint;
|
||||
int64_t as_int;
|
||||
double as_double;
|
||||
|
|
@ -237,7 +244,17 @@ class V8_PLATFORM_EXPORT TracingController
|
|||
|
||||
TracingController();
|
||||
~TracingController() override;
|
||||
|
||||
// Takes ownership of |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);
|
||||
// Provide an optional listener for testing that will receive trace events.
|
||||
// Must be called before StartTracing().
|
||||
void SetTraceEventListenerForTesting(TraceEventListener* listener);
|
||||
#endif
|
||||
|
||||
// v8::TracingController implementation.
|
||||
const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
|
||||
|
|
@ -280,6 +297,12 @@ class V8_PLATFORM_EXPORT TracingController
|
|||
std::unique_ptr<base::Mutex> mutex_;
|
||||
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
|
||||
std::atomic_bool recording_{false};
|
||||
#ifdef V8_USE_PERFETTO
|
||||
std::ostream* output_stream_ = nullptr;
|
||||
std::unique_ptr<JSONTraceEventListener> json_listener_;
|
||||
TraceEventListener* listener_for_testing_ = nullptr;
|
||||
std::unique_ptr<perfetto::TracingSession> tracing_session_;
|
||||
#endif
|
||||
|
||||
// Disallow copy and assign
|
||||
TracingController(const TracingController&) = delete;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <cctype>
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "v8.h" // NOLINT(build/include)
|
||||
|
||||
|
|
@ -24,6 +25,7 @@ namespace Runtime {
|
|||
namespace API {
|
||||
class RemoteObject;
|
||||
class StackTrace;
|
||||
class StackTraceId;
|
||||
}
|
||||
}
|
||||
namespace Schema {
|
||||
|
|
@ -87,7 +89,6 @@ class V8_EXPORT V8ContextInfo {
|
|||
|
||||
static int executionContextId(v8::Local<v8::Context> context);
|
||||
|
||||
private:
|
||||
// Disallow copying and allocating this one.
|
||||
enum NotNullTagEnum { NotNullLiteral };
|
||||
void* operator new(size_t) = delete;
|
||||
|
|
@ -110,6 +111,8 @@ class V8_EXPORT V8StackTrace {
|
|||
virtual ~V8StackTrace() = default;
|
||||
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
||||
buildInspectorObject() const = 0;
|
||||
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
||||
buildInspectorObject(int maxAsyncDepth) const = 0;
|
||||
virtual std::unique_ptr<StringBuffer> toString() const = 0;
|
||||
|
||||
// Safe to pass between threads, drops async chain.
|
||||
|
|
@ -131,7 +134,7 @@ class V8_EXPORT V8InspectorSession {
|
|||
// Dispatching protocol messages.
|
||||
static bool canDispatchMethod(const StringView& method);
|
||||
virtual void dispatchProtocolMessage(const StringView& message) = 0;
|
||||
virtual std::unique_ptr<StringBuffer> stateJSON() = 0;
|
||||
virtual std::vector<uint8_t> state() = 0;
|
||||
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
||||
supportedDomains() = 0;
|
||||
|
||||
|
|
@ -228,12 +231,20 @@ class V8_EXPORT V8InspectorClient {
|
|||
struct V8_EXPORT V8StackTraceId {
|
||||
uintptr_t id;
|
||||
std::pair<int64_t, int64_t> debugger_id;
|
||||
bool should_pause = false;
|
||||
|
||||
V8StackTraceId();
|
||||
V8StackTraceId(const V8StackTraceId&) = default;
|
||||
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id);
|
||||
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id,
|
||||
bool should_pause);
|
||||
explicit V8StackTraceId(const StringView&);
|
||||
V8StackTraceId& operator=(const V8StackTraceId&) = default;
|
||||
V8StackTraceId& operator=(V8StackTraceId&&) noexcept = default;
|
||||
~V8StackTraceId() = default;
|
||||
|
||||
bool IsInvalid() const;
|
||||
std::unique_ptr<StringBuffer> ToString();
|
||||
};
|
||||
|
||||
class V8_EXPORT V8Inspector {
|
||||
|
|
@ -289,6 +300,24 @@ class V8_EXPORT V8Inspector {
|
|||
virtual std::unique_ptr<V8StackTrace> createStackTrace(
|
||||
v8::Local<v8::StackTrace>) = 0;
|
||||
virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
|
||||
|
||||
// Performance counters.
|
||||
class V8_EXPORT Counters : public std::enable_shared_from_this<Counters> {
|
||||
public:
|
||||
explicit Counters(v8::Isolate* isolate);
|
||||
~Counters();
|
||||
const std::unordered_map<std::string, int>& getCountersMap() const {
|
||||
return m_countersMap;
|
||||
}
|
||||
|
||||
private:
|
||||
static int* getCounterPtr(const char* name);
|
||||
|
||||
v8::Isolate* m_isolate;
|
||||
std::unordered_map<std::string, int> m_countersMap;
|
||||
};
|
||||
|
||||
virtual std::shared_ptr<Counters> enableCounters() = 0;
|
||||
};
|
||||
|
||||
} // namespace v8_inspector
|
||||
|
|
|
|||
|
|
@ -48,28 +48,32 @@ const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
|
|||
template <size_t tagged_ptr_size>
|
||||
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.
|
||||
template <>
|
||||
struct SmiTagging<4> {
|
||||
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) {
|
||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||
// Shift down (requires >> to be sign extending).
|
||||
return static_cast<int>(static_cast<intptr_t>(value)) >> shift_bits;
|
||||
// Truncate and shift down (requires >> to be sign extending).
|
||||
return static_cast<int32_t>(static_cast<uint32_t>(value)) >> shift_bits;
|
||||
}
|
||||
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
|
||||
// To be representable as an tagged small integer, the two
|
||||
// most-significant bits of 'value' must be either 00 or 11 due to
|
||||
// sign-extension. To check this we add 01 to the two
|
||||
// most-significant bits, and check if the most-significant bit is 0.
|
||||
//
|
||||
// CAUTION: The original code below:
|
||||
// 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;
|
||||
// Is value in range [kSmiMinValue, kSmiMaxValue].
|
||||
// Use unsigned operations in order to avoid undefined behaviour in case of
|
||||
// signed integer overflow.
|
||||
return (static_cast<uintptr_t>(value) -
|
||||
static_cast<uintptr_t>(kSmiMinValue)) <=
|
||||
(static_cast<uintptr_t>(kSmiMaxValue) -
|
||||
static_cast<uintptr_t>(kSmiMinValue));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -77,6 +81,11 @@ struct SmiTagging<4> {
|
|||
template <>
|
||||
struct SmiTagging<8> {
|
||||
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) {
|
||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||
// Shift down and throw away top 32 bits.
|
||||
|
|
@ -98,15 +107,17 @@ const int kApiTaggedSize = kApiSystemPointerSize;
|
|||
#endif
|
||||
|
||||
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
|
||||
typedef SmiTagging<kApiInt32Size> PlatformSmiTagging;
|
||||
using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
|
||||
#else
|
||||
typedef SmiTagging<kApiTaggedSize> PlatformSmiTagging;
|
||||
using PlatformSmiTagging = SmiTagging<kApiTaggedSize>;
|
||||
#endif
|
||||
|
||||
// TODO(ishell): Consinder adding kSmiShiftBits = kSmiShiftSize + kSmiTagSize
|
||||
// since it's used much more often than the inividual constants.
|
||||
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
|
||||
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
|
||||
const int kSmiMinValue = (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
|
||||
const int kSmiMaxValue = -(kSmiMinValue + 1);
|
||||
const int kSmiMinValue = static_cast<int>(PlatformSmiTagging::kSmiMinValue);
|
||||
const int kSmiMaxValue = static_cast<int>(PlatformSmiTagging::kSmiMaxValue);
|
||||
constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
|
||||
constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
|
||||
|
||||
|
|
@ -135,7 +146,7 @@ class Internals {
|
|||
static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize;
|
||||
static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize;
|
||||
static const int kEmbedderDataSlotSize = kApiSystemPointerSize;
|
||||
static const int kNativeContextEmbedderDataOffset = 7 * kApiTaggedSize;
|
||||
static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize;
|
||||
static const int kFullStringRepresentationMask = 0x0f;
|
||||
static const int kStringEncodingMask = 0x8;
|
||||
static const int kExternalTwoByteRepresentationTag = 0x02;
|
||||
|
|
@ -143,6 +154,7 @@ class Internals {
|
|||
|
||||
static const uint32_t kNumIsolateDataSlots = 4;
|
||||
|
||||
// IsolateData layout guarantees.
|
||||
static const int kIsolateEmbedderDataOffset = 0;
|
||||
static const int kExternalMemoryOffset =
|
||||
kNumIsolateDataSlots * kApiSystemPointerSize;
|
||||
|
|
@ -150,8 +162,14 @@ class Internals {
|
|||
kExternalMemoryOffset + kApiInt64Size;
|
||||
static const int kExternalMemoryAtLastMarkCompactOffset =
|
||||
kExternalMemoryLimitOffset + kApiInt64Size;
|
||||
static const int kIsolateRootsOffset =
|
||||
static const int kIsolateFastCCallCallerFpOffset =
|
||||
kExternalMemoryAtLastMarkCompactOffset + kApiInt64Size;
|
||||
static const int kIsolateFastCCallCallerPcOffset =
|
||||
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
|
||||
static const int kIsolateStackGuardOffset =
|
||||
kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize;
|
||||
static const int kIsolateRootsOffset =
|
||||
kIsolateStackGuardOffset + 7 * kApiSystemPointerSize;
|
||||
|
||||
static const int kUndefinedValueRootIndex = 4;
|
||||
static const int kTheHoleValueRootIndex = 5;
|
||||
|
|
@ -165,12 +183,10 @@ class Internals {
|
|||
static const int kNodeStateMask = 0x7;
|
||||
static const int kNodeStateIsWeakValue = 2;
|
||||
static const int kNodeStateIsPendingValue = 3;
|
||||
static const int kNodeIsIndependentShift = 3;
|
||||
static const int kNodeIsActiveShift = 4;
|
||||
|
||||
static const int kFirstNonstringType = 0x40;
|
||||
static const int kOddballType = 0x43;
|
||||
static const int kForeignType = 0x47;
|
||||
static const int kForeignType = 0x46;
|
||||
static const int kJSSpecialApiObjectType = 0x410;
|
||||
static const int kJSApiObjectType = 0x420;
|
||||
static const int kJSObjectType = 0x421;
|
||||
|
|
@ -313,14 +329,11 @@ class Internals {
|
|||
#ifdef V8_COMPRESS_POINTERS
|
||||
// See v8:7703 or src/ptr-compr.* for details about pointer compression.
|
||||
static constexpr size_t kPtrComprHeapReservationSize = size_t{1} << 32;
|
||||
static constexpr size_t kPtrComprIsolateRootBias =
|
||||
kPtrComprHeapReservationSize / 2;
|
||||
static constexpr size_t kPtrComprIsolateRootAlignment = size_t{1} << 32;
|
||||
|
||||
V8_INLINE static internal::Address GetRootFromOnHeapAddress(
|
||||
internal::Address addr) {
|
||||
return (addr + kPtrComprIsolateRootBias) &
|
||||
-static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
||||
return addr & -static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
||||
}
|
||||
|
||||
V8_INLINE static internal::Address DecompressTaggedAnyField(
|
||||
|
|
@ -367,6 +380,10 @@ V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);
|
|||
// language mode is strict.
|
||||
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate);
|
||||
|
||||
// A base class for backing stores, which is needed due to vagaries of
|
||||
// how static casts work with std::shared_ptr.
|
||||
class BackingStoreBase {};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ class TaskRunner {
|
|||
TaskRunner() = default;
|
||||
virtual ~TaskRunner() = default;
|
||||
|
||||
private:
|
||||
TaskRunner(const TaskRunner&) = delete;
|
||||
TaskRunner& operator=(const TaskRunner&) = delete;
|
||||
};
|
||||
|
|
@ -368,9 +367,8 @@ class Platform {
|
|||
* |isolate|. Tasks posted for the same isolate should be execute in order of
|
||||
* scheduling. The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallOnForegroundThread(Isolate* isolate, Task* task)) = 0;
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallOnForegroundThread(Isolate* isolate, Task* task) { abort(); }
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a foreground thread wrt a specific
|
||||
|
|
@ -378,10 +376,11 @@ class Platform {
|
|||
* Tasks posted for the same isolate should be execute in order of
|
||||
* scheduling. The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
||||
double delay_in_seconds)) = 0;
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
||||
double delay_in_seconds) {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a foreground thread wrt a specific
|
||||
|
|
@ -391,20 +390,15 @@ class Platform {
|
|||
* starved for an arbitrarily long time if no idle time is available.
|
||||
* The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallIdleOnForegroundThread(Isolate* isolate,
|
||||
IdleTask* task)) {
|
||||
// This must be overriden if |IdleTasksEnabled()|.
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if idle tasks are enabled for the given |isolate|.
|
||||
*/
|
||||
virtual bool IdleTasksEnabled(Isolate* isolate) {
|
||||
return false;
|
||||
}
|
||||
virtual bool IdleTasksEnabled(Isolate* isolate) { return false; }
|
||||
|
||||
/**
|
||||
* Monotonically increasing time in seconds from an arbitrary fixed point in
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@
|
|||
#ifndef V8_V8_PROFILER_H_
|
||||
#define V8_V8_PROFILER_H_
|
||||
|
||||
#include <limits.h>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "v8.h" // NOLINT(build/include)
|
||||
|
||||
/**
|
||||
|
|
@ -17,14 +20,18 @@ namespace v8 {
|
|||
class HeapGraphNode;
|
||||
struct HeapStatsUpdate;
|
||||
|
||||
typedef uint32_t SnapshotObjectId;
|
||||
|
||||
using NativeObject = void*;
|
||||
using SnapshotObjectId = uint32_t;
|
||||
|
||||
struct CpuProfileDeoptFrame {
|
||||
int script_id;
|
||||
size_t position;
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
class CpuProfile;
|
||||
} // namespace internal
|
||||
|
||||
} // namespace v8
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
|
|
@ -47,75 +54,6 @@ template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>;
|
|||
|
||||
namespace v8 {
|
||||
|
||||
// TickSample captures the information collected for each sample.
|
||||
struct V8_EXPORT TickSample {
|
||||
// Internal profiling (with --prof + tools/$OS-tick-processor) wants to
|
||||
// include the runtime function we're calling. Externally exposed tick
|
||||
// samples don't care.
|
||||
enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame };
|
||||
|
||||
TickSample()
|
||||
: state(OTHER),
|
||||
pc(nullptr),
|
||||
external_callback_entry(nullptr),
|
||||
frames_count(0),
|
||||
has_external_callback(false),
|
||||
update_stats(true) {}
|
||||
|
||||
/**
|
||||
* Initialize a tick sample from the isolate.
|
||||
* \param isolate The isolate.
|
||||
* \param state Execution state.
|
||||
* \param record_c_entry_frame Include or skip the runtime function.
|
||||
* \param update_stats Whether update the sample to the aggregated stats.
|
||||
* \param use_simulator_reg_state When set to true and V8 is running under a
|
||||
* simulator, the method will use the simulator
|
||||
* register state rather than the one provided
|
||||
* with |state| argument. Otherwise the method
|
||||
* will use provided register |state| as is.
|
||||
*/
|
||||
void Init(Isolate* isolate, const v8::RegisterState& state,
|
||||
RecordCEntryFrame record_c_entry_frame, bool update_stats,
|
||||
bool use_simulator_reg_state = true);
|
||||
/**
|
||||
* Get a call stack sample from the isolate.
|
||||
* \param isolate The isolate.
|
||||
* \param state Register state.
|
||||
* \param record_c_entry_frame Include or skip the runtime function.
|
||||
* \param frames Caller allocated buffer to store stack frames.
|
||||
* \param frames_limit Maximum number of frames to capture. The buffer must
|
||||
* be large enough to hold the number of frames.
|
||||
* \param sample_info The sample info is filled up by the function
|
||||
* provides number of actual captured stack frames and
|
||||
* the current VM state.
|
||||
* \param use_simulator_reg_state When set to true and V8 is running under a
|
||||
* simulator, the method will use the simulator
|
||||
* register state rather than the one provided
|
||||
* with |state| argument. Otherwise the method
|
||||
* will use provided register |state| as is.
|
||||
* \note GetStackSample is thread and signal safe and should only be called
|
||||
* when the JS thread is paused or interrupted.
|
||||
* Otherwise the behavior is undefined.
|
||||
*/
|
||||
static bool GetStackSample(Isolate* isolate, v8::RegisterState* state,
|
||||
RecordCEntryFrame record_c_entry_frame,
|
||||
void** frames, size_t frames_limit,
|
||||
v8::SampleInfo* sample_info,
|
||||
bool use_simulator_reg_state = true);
|
||||
StateTag state; // The state of the VM.
|
||||
void* pc; // Instruction pointer.
|
||||
union {
|
||||
void* tos; // Top stack value (*sp).
|
||||
void* external_callback_entry;
|
||||
};
|
||||
static const unsigned kMaxFramesCountLog2 = 8;
|
||||
static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1;
|
||||
void* stack[kMaxFramesCount]; // Call stack.
|
||||
unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames.
|
||||
bool has_external_callback : 1;
|
||||
bool update_stats : 1; // Whether the sample should update aggregated stats.
|
||||
};
|
||||
|
||||
/**
|
||||
* CpuProfileNode represents a node in a call graph.
|
||||
*/
|
||||
|
|
@ -206,11 +144,6 @@ class V8_EXPORT CpuProfileNode {
|
|||
*/
|
||||
unsigned GetHitCount() const;
|
||||
|
||||
/** Returns function entry UID. */
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use GetScriptId, GetLineNumber, and GetColumnNumber instead.",
|
||||
unsigned GetCallUid() const);
|
||||
|
||||
/** Returns id of the node. The id is unique within the tree */
|
||||
unsigned GetNodeId() const;
|
||||
|
||||
|
|
@ -297,6 +230,66 @@ enum CpuProfilingMode {
|
|||
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,
|
||||
};
|
||||
|
||||
enum CpuProfilingLoggingMode {
|
||||
// Enables logging when a profile is active, and disables logging when all
|
||||
// profiles are detached.
|
||||
kLazyLogging,
|
||||
// Enables logging for the lifetime of the CpuProfiler. Calls to
|
||||
// StartRecording are faster, at the expense of runtime overhead.
|
||||
kEagerLogging,
|
||||
};
|
||||
|
||||
/**
|
||||
* 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,
|
||||
MaybeLocal<Context> filter_context = MaybeLocal<Context>());
|
||||
|
||||
CpuProfilingMode mode() const { return mode_; }
|
||||
unsigned max_samples() const { return max_samples_; }
|
||||
int sampling_interval_us() const { return sampling_interval_us_; }
|
||||
|
||||
private:
|
||||
friend class internal::CpuProfile;
|
||||
|
||||
bool has_filter_context() const { return !filter_context_.IsEmpty(); }
|
||||
void* raw_filter_context() const;
|
||||
|
||||
CpuProfilingMode mode_;
|
||||
unsigned max_samples_;
|
||||
int sampling_interval_us_;
|
||||
CopyablePersistentTraits<Context>::CopyablePersistent filter_context_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for controlling CPU profiling. Instance of the
|
||||
* profiler can be created using v8::CpuProfiler::New method.
|
||||
|
|
@ -308,7 +301,9 @@ class V8_EXPORT CpuProfiler {
|
|||
* initialized. The profiler object must be disposed after use by calling
|
||||
* |Dispose| method.
|
||||
*/
|
||||
static CpuProfiler* New(Isolate* isolate);
|
||||
static CpuProfiler* New(Isolate* isolate,
|
||||
CpuProfilingNamingMode = kDebugNaming,
|
||||
CpuProfilingLoggingMode = kLazyLogging);
|
||||
|
||||
/**
|
||||
* Synchronously collect current stack sample in all profilers attached to
|
||||
|
|
@ -339,18 +334,26 @@ class V8_EXPORT CpuProfiler {
|
|||
void SetUsePreciseSampling(bool);
|
||||
|
||||
/**
|
||||
* Starts collecting CPU profile. Title may be an empty string. It
|
||||
* is allowed to have several profiles being collected at
|
||||
* once. Attempts to start collecting several profiles with the same
|
||||
* title are silently ignored. While collecting a profile, functions
|
||||
* from all security contexts are included in it. The token-based
|
||||
* filtering is only performed when querying for a profile.
|
||||
* Starts collecting a CPU profile. Title may be an empty string. Several
|
||||
* profiles may be collected at once. Attempts to start collecting several
|
||||
* profiles with the same title are silently ignored.
|
||||
*/
|
||||
void StartProfiling(Local<String> title, CpuProfilingOptions options);
|
||||
|
||||
/**
|
||||
* Starts profiling with the same semantics as above, except with expanded
|
||||
* parameters.
|
||||
*
|
||||
* |record_samples| parameter controls whether individual samples should
|
||||
* 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(Local<String> title, CpuProfilingMode mode,
|
||||
bool record_samples = false);
|
||||
void StartProfiling(
|
||||
Local<String> title, CpuProfilingMode mode, bool record_samples = false,
|
||||
unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
|
||||
/**
|
||||
* The same as StartProfiling above, but the CpuProfilingMode defaults to
|
||||
* kLeafNodeLineNumbers mode, which was the previous default behavior of the
|
||||
|
|
@ -364,20 +367,6 @@ class V8_EXPORT CpuProfiler {
|
|||
*/
|
||||
CpuProfile* StopProfiling(Local<String> title);
|
||||
|
||||
/**
|
||||
* Force collection of a sample. Must be called on the VM thread.
|
||||
* Recording the forced sample does not contribute to the aggregated
|
||||
* profile statistics.
|
||||
*/
|
||||
V8_DEPRECATED("Use static CollectSample(Isolate*) instead.",
|
||||
void CollectSample());
|
||||
|
||||
/**
|
||||
* Tells the profiler whether the embedder is idle.
|
||||
*/
|
||||
V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.",
|
||||
void SetIdle(bool is_idle));
|
||||
|
||||
/**
|
||||
* Generate more detailed source positions to code objects. This results in
|
||||
* better results when mapping profiling samples to script source.
|
||||
|
|
@ -391,7 +380,6 @@ class V8_EXPORT CpuProfiler {
|
|||
CpuProfiler& operator=(const CpuProfiler&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* HeapSnapshotEdge represents a directed connection between heap
|
||||
* graph nodes: from retainers to retained nodes.
|
||||
|
|
@ -742,7 +730,12 @@ class V8_EXPORT EmbedderGraph {
|
|||
*/
|
||||
virtual const char* NamePrefix() { return nullptr; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Returns the NativeObject that can be used for querying the
|
||||
* |HeapSnapshot|.
|
||||
*/
|
||||
virtual NativeObject GetNativeObject() { return nullptr; }
|
||||
|
||||
Node(const Node&) = delete;
|
||||
Node& operator=(const Node&) = delete;
|
||||
};
|
||||
|
|
@ -805,6 +798,12 @@ class V8_EXPORT HeapProfiler {
|
|||
*/
|
||||
SnapshotObjectId GetObjectId(Local<Value> value);
|
||||
|
||||
/**
|
||||
* Returns SnapshotObjectId for a native object referenced by |value| if it
|
||||
* has been seen by the heap profiler, kUnknownObjectId otherwise.
|
||||
*/
|
||||
SnapshotObjectId GetObjectId(NativeObject value);
|
||||
|
||||
/**
|
||||
* Returns heap object with given SnapshotObjectId if the object is alive,
|
||||
* otherwise empty handle is returned.
|
||||
|
|
@ -973,7 +972,8 @@ struct HeapStatsUpdate {
|
|||
V(LazyCompile) \
|
||||
V(RegExp) \
|
||||
V(Script) \
|
||||
V(Stub)
|
||||
V(Stub) \
|
||||
V(Relocation)
|
||||
|
||||
/**
|
||||
* Note that this enum may be extended in the future. Please include a default
|
||||
|
|
@ -1006,10 +1006,12 @@ class V8_EXPORT CodeEvent {
|
|||
const char* GetComment();
|
||||
|
||||
static const char* GetCodeEventTypeName(CodeEventType code_event_type);
|
||||
|
||||
uintptr_t GetPreviousCodeStartAddress();
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface to listen to code creation events.
|
||||
* Interface to listen to code creation and code relocation events.
|
||||
*/
|
||||
class V8_EXPORT CodeEventHandler {
|
||||
public:
|
||||
|
|
@ -1021,9 +1023,26 @@ class V8_EXPORT CodeEventHandler {
|
|||
explicit CodeEventHandler(Isolate* isolate);
|
||||
virtual ~CodeEventHandler();
|
||||
|
||||
/**
|
||||
* Handle is called every time a code object is created or moved. Information
|
||||
* about each code event will be available through the `code_event`
|
||||
* parameter.
|
||||
*
|
||||
* When the CodeEventType is kRelocationType, the code for this CodeEvent has
|
||||
* moved from `GetPreviousCodeStartAddress()` to `GetCodeStartAddress()`.
|
||||
*/
|
||||
virtual void Handle(CodeEvent* code_event) = 0;
|
||||
|
||||
/**
|
||||
* Call `Enable()` to starts listening to code creation and code relocation
|
||||
* events. These events will be handled by `Handle()`.
|
||||
*/
|
||||
void Enable();
|
||||
|
||||
/**
|
||||
* Call `Disable()` to stop listening to code creation and code relocation
|
||||
* events.
|
||||
*/
|
||||
void Disable();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -11,10 +11,9 @@
|
|||
* Testing support for the V8 JavaScript engine.
|
||||
*/
|
||||
namespace v8 {
|
||||
|
||||
class V8_EXPORT Testing {
|
||||
public:
|
||||
enum StressType {
|
||||
enum V8_DEPRECATED("Don't use this (d8-specific testing logic).") StressType {
|
||||
kStressTypeOpt,
|
||||
kStressTypeDeopt
|
||||
};
|
||||
|
|
@ -22,27 +21,30 @@ class V8_EXPORT Testing {
|
|||
/**
|
||||
* Set the type of stressing to do. The default if not set is kStressTypeOpt.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void SetStressRunType(StressType type);
|
||||
|
||||
/**
|
||||
* Get the number of runs of a given test that is required to get the full
|
||||
* stress coverage.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static int GetStressRuns();
|
||||
|
||||
/**
|
||||
* Indicate the number of the run which is about to start. The value of run
|
||||
* should be between 0 and one less than the result from GetStressRuns()
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void PrepareStressRun(int run);
|
||||
|
||||
/**
|
||||
* Force deoptimization of all functions.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void DeoptimizeAll(Isolate* isolate);
|
||||
};
|
||||
|
||||
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_V8_TEST_H_
|
||||
|
|
|
|||
|
|
@ -194,14 +194,6 @@ class PersistentValueMapBase {
|
|||
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.
|
||||
*/
|
||||
|
|
@ -352,16 +344,6 @@ class PersistentValueMapBase {
|
|||
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>
|
||||
class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
// These macros define the version number for the current version.
|
||||
// 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.
|
||||
#define V8_MAJOR_VERSION 7
|
||||
#define V8_MINOR_VERSION 5
|
||||
#define V8_BUILD_NUMBER 288
|
||||
#define V8_PATCH_LEVEL 22
|
||||
#define V8_MAJOR_VERSION 8
|
||||
#define V8_MINOR_VERSION 0
|
||||
#define V8_BUILD_NUMBER 426
|
||||
#define V8_PATCH_LEVEL 16
|
||||
|
||||
// Use 1 for candidates and 0 otherwise.
|
||||
// (Boolean macro values are not supported by all preprocessors.)
|
||||
|
|
|
|||
1597
mac/include/v8/v8.h
1597
mac/include/v8/v8.h
File diff suppressed because it is too large
Load Diff
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Operating system detection
|
||||
// Operating system detection (host)
|
||||
//
|
||||
// V8_OS_ANDROID - Android
|
||||
// V8_OS_BSD - BSDish (Mac OS X, Net/Free/Open/DragonFlyBSD)
|
||||
|
|
@ -122,6 +122,67 @@
|
|||
# define V8_OS_WIN 1
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Operating system detection (target)
|
||||
//
|
||||
// V8_TARGET_OS_ANDROID
|
||||
// V8_TARGET_OS_FUCHSIA
|
||||
// V8_TARGET_OS_IOS
|
||||
// V8_TARGET_OS_LINUX
|
||||
// V8_TARGET_OS_MACOSX
|
||||
// V8_TARGET_OS_WIN
|
||||
//
|
||||
// If not set explicitly, these fall back to corresponding V8_OS_ values.
|
||||
|
||||
#ifdef V8_HAVE_TARGET_OS
|
||||
|
||||
// The target OS is provided, just check that at least one known value is set.
|
||||
# if !defined(V8_TARGET_OS_ANDROID) \
|
||||
&& !defined(V8_TARGET_OS_FUCHSIA) \
|
||||
&& !defined(V8_TARGET_OS_IOS) \
|
||||
&& !defined(V8_TARGET_OS_LINUX) \
|
||||
&& !defined(V8_TARGET_OS_MACOSX) \
|
||||
&& !defined(V8_TARGET_OS_WIN)
|
||||
# error No known target OS defined.
|
||||
# endif
|
||||
|
||||
#else // V8_HAVE_TARGET_OS
|
||||
|
||||
# if defined(V8_TARGET_OS_ANDROID) \
|
||||
|| defined(V8_TARGET_OS_FUCHSIA) \
|
||||
|| defined(V8_TARGET_OS_IOS) \
|
||||
|| defined(V8_TARGET_OS_LINUX) \
|
||||
|| defined(V8_TARGET_OS_MACOSX) \
|
||||
|| defined(V8_TARGET_OS_WIN)
|
||||
# error A target OS is defined but V8_HAVE_TARGET_OS is unset.
|
||||
# endif
|
||||
|
||||
// Fall back to the detected host OS.
|
||||
#ifdef V8_OS_ANDROID
|
||||
# define V8_TARGET_OS_ANDROID
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_FUCHSIA
|
||||
# define V8_TARGET_OS_FUCHSIA
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_IOS
|
||||
# define V8_TARGET_OS_IOS
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_LINUX
|
||||
# define V8_TARGET_OS_LINUX
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_MACOSX
|
||||
# define V8_TARGET_OS_MACOSX
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
# define V8_TARGET_OS_WIN
|
||||
#endif
|
||||
|
||||
#endif // V8_HAVE_TARGET_OS
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// C library detection
|
||||
|
|
@ -169,7 +230,7 @@
|
|||
//
|
||||
// V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
|
||||
// supported
|
||||
// V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
|
||||
// V8_HAS_ATTRIBUTE_NONNULL - __attribute__((nonnull)) supported
|
||||
// V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
|
||||
// V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
|
||||
// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
|
||||
|
|
@ -186,10 +247,10 @@
|
|||
// V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported
|
||||
// V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported
|
||||
// V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported
|
||||
// V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
|
||||
// V8_HAS_COMPUTED_GOTO - computed goto/labels as values
|
||||
// supported
|
||||
// V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
|
||||
// V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported
|
||||
// V8_HAS_DECLSPEC_NORETURN - __declspec(noreturn) supported
|
||||
// V8_HAS___FORCEINLINE - __forceinline supported
|
||||
//
|
||||
// Note that testing for compilers and/or features must be done using #if
|
||||
|
|
@ -205,15 +266,14 @@
|
|||
#endif
|
||||
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE \
|
||||
(__has_extension(attribute_deprecated_with_message))
|
||||
# define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(__has_attribute(warn_unused_result))
|
||||
|
||||
# define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
|
||||
# define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
|
||||
# define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
|
||||
# define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
|
||||
|
|
@ -226,9 +286,13 @@
|
|||
# define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
|
||||
# define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
|
||||
|
||||
# if __cplusplus >= 201402L
|
||||
# define V8_CAN_HAVE_DCHECK_IN_CONSTEXPR 1
|
||||
# endif
|
||||
// Clang has no __has_feature for computed gotos.
|
||||
// GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
# define V8_HAS_COMPUTED_GOTO 1
|
||||
|
||||
// Whether constexpr has full C++14 semantics, in particular that non-constexpr
|
||||
// code is allowed as long as it's not executed for any constexpr instantiation.
|
||||
# define V8_HAS_CXX14_CONSTEXPR 1
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
|
|
@ -247,30 +311,34 @@
|
|||
// always_inline is available in gcc 4.0 but not very reliable until 4.4.
|
||||
// Works around "sorry, unimplemented: inlining failed" build errors with
|
||||
// older compilers.
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0))
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0))
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE 1
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE 1
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED 1
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY 1
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
|
||||
|
||||
# define V8_HAS_BUILTIN_CLZ (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_CTZ (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
|
||||
# define V8_HAS_BUILTIN_FRAME_ADDRESS (V8_GNUC_PREREQ(2, 96, 0))
|
||||
# define V8_HAS_BUILTIN_POPCOUNT (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
|
||||
# define V8_HAS_BUILTIN_CLZ 1
|
||||
# define V8_HAS_BUILTIN_CTZ 1
|
||||
# define V8_HAS_BUILTIN_EXPECT 1
|
||||
# define V8_HAS_BUILTIN_FRAME_ADDRESS 1
|
||||
# define V8_HAS_BUILTIN_POPCOUNT 1
|
||||
|
||||
// GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
#define V8_HAS_COMPUTED_GOTO 1
|
||||
|
||||
// Whether constexpr has full C++14 semantics, in particular that non-constexpr
|
||||
// code is allowed as long as it's not executed for any constexpr instantiation.
|
||||
// GCC only supports this since version 6.
|
||||
# define V8_HAS_CXX14_CONSTEXPR (V8_GNUC_PREREQ(6, 0, 0))
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define V8_CC_MSVC 1
|
||||
|
||||
# define V8_HAS_DECLSPEC_DEPRECATED 1
|
||||
# define V8_HAS_DECLSPEC_NOINLINE 1
|
||||
# define V8_HAS_DECLSPEC_SELECTANY 1
|
||||
# define V8_HAS_DECLSPEC_NORETURN 1
|
||||
|
||||
# define V8_HAS___FORCEINLINE 1
|
||||
|
||||
|
|
@ -291,6 +359,23 @@
|
|||
# define V8_INLINE inline
|
||||
#endif
|
||||
|
||||
#if V8_HAS_BUILTIN_ASSUME_ALIGNED
|
||||
# define V8_ASSUME_ALIGNED(ptr, alignment) \
|
||||
__builtin_assume_aligned((ptr), (alignment))
|
||||
#else
|
||||
# define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
|
||||
#endif
|
||||
|
||||
|
||||
// A macro to mark specific arguments as non-null.
|
||||
// Use like:
|
||||
// int add(int* x, int y, int* z) V8_NONNULL(1, 3) { return *x + y + *z; }
|
||||
#if V8_HAS_ATTRIBUTE_NONNULL
|
||||
# define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
#else
|
||||
# define V8_NONNULL(...) /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
|
||||
// A macro used to tell the compiler to never inline a particular function.
|
||||
// Don't bother for debug builds.
|
||||
|
|
@ -306,31 +391,18 @@
|
|||
|
||||
|
||||
// A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
|
||||
#if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
|
||||
#define V8_DEPRECATED(message, declarator) \
|
||||
declarator __attribute__((deprecated(message)))
|
||||
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
|
||||
#define V8_DEPRECATED(message, declarator) \
|
||||
declarator __attribute__((deprecated))
|
||||
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
|
||||
#define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
|
||||
#if defined(V8_DEPRECATION_WARNINGS)
|
||||
# define V8_DEPRECATED(message) [[deprecated(message)]]
|
||||
#else
|
||||
#define V8_DEPRECATED(message, declarator) declarator
|
||||
# define V8_DEPRECATED(message)
|
||||
#endif
|
||||
|
||||
|
||||
// A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS) && \
|
||||
V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
|
||||
#define V8_DEPRECATE_SOON(message, declarator) \
|
||||
declarator __attribute__((deprecated(message)))
|
||||
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
|
||||
#define V8_DEPRECATE_SOON(message, declarator) \
|
||||
declarator __attribute__((deprecated))
|
||||
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
|
||||
#define V8_DEPRECATE_SOON(message, declarator) __declspec(deprecated) declarator
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
|
||||
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
|
||||
#else
|
||||
#define V8_DEPRECATE_SOON(message, declarator) declarator
|
||||
# define V8_DEPRECATE_SOON(message)
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -353,6 +425,12 @@
|
|||
#define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
|
||||
#error Inconsistent build configuration: To build the V8 shared library \
|
||||
set BUILDING_V8_SHARED, to include its headers for linking against the \
|
||||
V8 shared library set USING_V8_SHARED.
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
|
||||
// Setup for Windows DLL export/import. When building the V8 DLL the
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef V8_LIBPLATFORM_LIBPLATFORM_H_
|
||||
#define V8_LIBPLATFORM_LIBPLATFORM_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "libplatform/libplatform-export.h"
|
||||
#include "libplatform/v8-tracing.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
|
|
@ -70,11 +72,10 @@ V8_PLATFORM_EXPORT void RunIdleTasks(v8::Platform* platform,
|
|||
* The |platform| has to be created using |NewDefaultPlatform|.
|
||||
*
|
||||
*/
|
||||
V8_PLATFORM_EXPORT V8_DEPRECATE_SOON(
|
||||
"Access the DefaultPlatform directly",
|
||||
void SetTracingController(
|
||||
v8::Platform* platform,
|
||||
v8::platform::tracing::TracingController* tracing_controller));
|
||||
V8_DEPRECATE_SOON("Access the DefaultPlatform directly")
|
||||
V8_PLATFORM_EXPORT void SetTracingController(
|
||||
v8::Platform* platform,
|
||||
v8::platform::tracing::TracingController* tracing_controller);
|
||||
|
||||
} // namespace platform
|
||||
} // namespace v8
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@
|
|||
#include "libplatform/libplatform-export.h"
|
||||
#include "v8-platform.h" // NOLINT(build/include)
|
||||
|
||||
namespace perfetto {
|
||||
class TracingSession;
|
||||
}
|
||||
|
||||
namespace v8 {
|
||||
|
||||
namespace base {
|
||||
|
|
@ -23,12 +27,15 @@ class Mutex;
|
|||
namespace platform {
|
||||
namespace tracing {
|
||||
|
||||
class TraceEventListener;
|
||||
class JSONTraceEventListener;
|
||||
|
||||
const int kTraceMaxNumArgs = 2;
|
||||
|
||||
class V8_PLATFORM_EXPORT TraceObject {
|
||||
public:
|
||||
union ArgValue {
|
||||
bool as_bool;
|
||||
V8_DEPRECATED("use as_uint ? true : false") bool as_bool;
|
||||
uint64_t as_uint;
|
||||
int64_t as_int;
|
||||
double as_double;
|
||||
|
|
@ -237,7 +244,17 @@ class V8_PLATFORM_EXPORT TracingController
|
|||
|
||||
TracingController();
|
||||
~TracingController() override;
|
||||
|
||||
// Takes ownership of |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);
|
||||
// Provide an optional listener for testing that will receive trace events.
|
||||
// Must be called before StartTracing().
|
||||
void SetTraceEventListenerForTesting(TraceEventListener* listener);
|
||||
#endif
|
||||
|
||||
// v8::TracingController implementation.
|
||||
const uint8_t* GetCategoryGroupEnabled(const char* category_group) override;
|
||||
|
|
@ -280,6 +297,12 @@ class V8_PLATFORM_EXPORT TracingController
|
|||
std::unique_ptr<base::Mutex> mutex_;
|
||||
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
|
||||
std::atomic_bool recording_{false};
|
||||
#ifdef V8_USE_PERFETTO
|
||||
std::ostream* output_stream_ = nullptr;
|
||||
std::unique_ptr<JSONTraceEventListener> json_listener_;
|
||||
TraceEventListener* listener_for_testing_ = nullptr;
|
||||
std::unique_ptr<perfetto::TracingSession> tracing_session_;
|
||||
#endif
|
||||
|
||||
// Disallow copy and assign
|
||||
TracingController(const TracingController&) = delete;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <cctype>
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "v8.h" // NOLINT(build/include)
|
||||
|
||||
|
|
@ -24,6 +25,7 @@ namespace Runtime {
|
|||
namespace API {
|
||||
class RemoteObject;
|
||||
class StackTrace;
|
||||
class StackTraceId;
|
||||
}
|
||||
}
|
||||
namespace Schema {
|
||||
|
|
@ -87,7 +89,6 @@ class V8_EXPORT V8ContextInfo {
|
|||
|
||||
static int executionContextId(v8::Local<v8::Context> context);
|
||||
|
||||
private:
|
||||
// Disallow copying and allocating this one.
|
||||
enum NotNullTagEnum { NotNullLiteral };
|
||||
void* operator new(size_t) = delete;
|
||||
|
|
@ -110,6 +111,8 @@ class V8_EXPORT V8StackTrace {
|
|||
virtual ~V8StackTrace() = default;
|
||||
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
||||
buildInspectorObject() const = 0;
|
||||
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
||||
buildInspectorObject(int maxAsyncDepth) const = 0;
|
||||
virtual std::unique_ptr<StringBuffer> toString() const = 0;
|
||||
|
||||
// Safe to pass between threads, drops async chain.
|
||||
|
|
@ -131,7 +134,7 @@ class V8_EXPORT V8InspectorSession {
|
|||
// Dispatching protocol messages.
|
||||
static bool canDispatchMethod(const StringView& method);
|
||||
virtual void dispatchProtocolMessage(const StringView& message) = 0;
|
||||
virtual std::unique_ptr<StringBuffer> stateJSON() = 0;
|
||||
virtual std::vector<uint8_t> state() = 0;
|
||||
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
||||
supportedDomains() = 0;
|
||||
|
||||
|
|
@ -228,12 +231,20 @@ class V8_EXPORT V8InspectorClient {
|
|||
struct V8_EXPORT V8StackTraceId {
|
||||
uintptr_t id;
|
||||
std::pair<int64_t, int64_t> debugger_id;
|
||||
bool should_pause = false;
|
||||
|
||||
V8StackTraceId();
|
||||
V8StackTraceId(const V8StackTraceId&) = default;
|
||||
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id);
|
||||
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id,
|
||||
bool should_pause);
|
||||
explicit V8StackTraceId(const StringView&);
|
||||
V8StackTraceId& operator=(const V8StackTraceId&) = default;
|
||||
V8StackTraceId& operator=(V8StackTraceId&&) noexcept = default;
|
||||
~V8StackTraceId() = default;
|
||||
|
||||
bool IsInvalid() const;
|
||||
std::unique_ptr<StringBuffer> ToString();
|
||||
};
|
||||
|
||||
class V8_EXPORT V8Inspector {
|
||||
|
|
@ -289,6 +300,24 @@ class V8_EXPORT V8Inspector {
|
|||
virtual std::unique_ptr<V8StackTrace> createStackTrace(
|
||||
v8::Local<v8::StackTrace>) = 0;
|
||||
virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
|
||||
|
||||
// Performance counters.
|
||||
class V8_EXPORT Counters : public std::enable_shared_from_this<Counters> {
|
||||
public:
|
||||
explicit Counters(v8::Isolate* isolate);
|
||||
~Counters();
|
||||
const std::unordered_map<std::string, int>& getCountersMap() const {
|
||||
return m_countersMap;
|
||||
}
|
||||
|
||||
private:
|
||||
static int* getCounterPtr(const char* name);
|
||||
|
||||
v8::Isolate* m_isolate;
|
||||
std::unordered_map<std::string, int> m_countersMap;
|
||||
};
|
||||
|
||||
virtual std::shared_ptr<Counters> enableCounters() = 0;
|
||||
};
|
||||
|
||||
} // namespace v8_inspector
|
||||
|
|
|
|||
|
|
@ -48,28 +48,32 @@ const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
|
|||
template <size_t tagged_ptr_size>
|
||||
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.
|
||||
template <>
|
||||
struct SmiTagging<4> {
|
||||
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) {
|
||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||
// Shift down (requires >> to be sign extending).
|
||||
return static_cast<int>(static_cast<intptr_t>(value)) >> shift_bits;
|
||||
// Truncate and shift down (requires >> to be sign extending).
|
||||
return static_cast<int32_t>(static_cast<uint32_t>(value)) >> shift_bits;
|
||||
}
|
||||
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
|
||||
// To be representable as an tagged small integer, the two
|
||||
// most-significant bits of 'value' must be either 00 or 11 due to
|
||||
// sign-extension. To check this we add 01 to the two
|
||||
// most-significant bits, and check if the most-significant bit is 0.
|
||||
//
|
||||
// CAUTION: The original code below:
|
||||
// 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;
|
||||
// Is value in range [kSmiMinValue, kSmiMaxValue].
|
||||
// Use unsigned operations in order to avoid undefined behaviour in case of
|
||||
// signed integer overflow.
|
||||
return (static_cast<uintptr_t>(value) -
|
||||
static_cast<uintptr_t>(kSmiMinValue)) <=
|
||||
(static_cast<uintptr_t>(kSmiMaxValue) -
|
||||
static_cast<uintptr_t>(kSmiMinValue));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -77,6 +81,11 @@ struct SmiTagging<4> {
|
|||
template <>
|
||||
struct SmiTagging<8> {
|
||||
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) {
|
||||
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
||||
// Shift down and throw away top 32 bits.
|
||||
|
|
@ -98,15 +107,17 @@ const int kApiTaggedSize = kApiSystemPointerSize;
|
|||
#endif
|
||||
|
||||
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
|
||||
typedef SmiTagging<kApiInt32Size> PlatformSmiTagging;
|
||||
using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
|
||||
#else
|
||||
typedef SmiTagging<kApiTaggedSize> PlatformSmiTagging;
|
||||
using PlatformSmiTagging = SmiTagging<kApiTaggedSize>;
|
||||
#endif
|
||||
|
||||
// TODO(ishell): Consinder adding kSmiShiftBits = kSmiShiftSize + kSmiTagSize
|
||||
// since it's used much more often than the inividual constants.
|
||||
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
|
||||
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
|
||||
const int kSmiMinValue = (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
|
||||
const int kSmiMaxValue = -(kSmiMinValue + 1);
|
||||
const int kSmiMinValue = static_cast<int>(PlatformSmiTagging::kSmiMinValue);
|
||||
const int kSmiMaxValue = static_cast<int>(PlatformSmiTagging::kSmiMaxValue);
|
||||
constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
|
||||
constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
|
||||
|
||||
|
|
@ -135,7 +146,7 @@ class Internals {
|
|||
static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize;
|
||||
static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize;
|
||||
static const int kEmbedderDataSlotSize = kApiSystemPointerSize;
|
||||
static const int kNativeContextEmbedderDataOffset = 7 * kApiTaggedSize;
|
||||
static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize;
|
||||
static const int kFullStringRepresentationMask = 0x0f;
|
||||
static const int kStringEncodingMask = 0x8;
|
||||
static const int kExternalTwoByteRepresentationTag = 0x02;
|
||||
|
|
@ -143,6 +154,7 @@ class Internals {
|
|||
|
||||
static const uint32_t kNumIsolateDataSlots = 4;
|
||||
|
||||
// IsolateData layout guarantees.
|
||||
static const int kIsolateEmbedderDataOffset = 0;
|
||||
static const int kExternalMemoryOffset =
|
||||
kNumIsolateDataSlots * kApiSystemPointerSize;
|
||||
|
|
@ -150,8 +162,14 @@ class Internals {
|
|||
kExternalMemoryOffset + kApiInt64Size;
|
||||
static const int kExternalMemoryAtLastMarkCompactOffset =
|
||||
kExternalMemoryLimitOffset + kApiInt64Size;
|
||||
static const int kIsolateRootsOffset =
|
||||
static const int kIsolateFastCCallCallerFpOffset =
|
||||
kExternalMemoryAtLastMarkCompactOffset + kApiInt64Size;
|
||||
static const int kIsolateFastCCallCallerPcOffset =
|
||||
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
|
||||
static const int kIsolateStackGuardOffset =
|
||||
kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize;
|
||||
static const int kIsolateRootsOffset =
|
||||
kIsolateStackGuardOffset + 7 * kApiSystemPointerSize;
|
||||
|
||||
static const int kUndefinedValueRootIndex = 4;
|
||||
static const int kTheHoleValueRootIndex = 5;
|
||||
|
|
@ -165,12 +183,10 @@ class Internals {
|
|||
static const int kNodeStateMask = 0x7;
|
||||
static const int kNodeStateIsWeakValue = 2;
|
||||
static const int kNodeStateIsPendingValue = 3;
|
||||
static const int kNodeIsIndependentShift = 3;
|
||||
static const int kNodeIsActiveShift = 4;
|
||||
|
||||
static const int kFirstNonstringType = 0x40;
|
||||
static const int kOddballType = 0x43;
|
||||
static const int kForeignType = 0x47;
|
||||
static const int kForeignType = 0x46;
|
||||
static const int kJSSpecialApiObjectType = 0x410;
|
||||
static const int kJSApiObjectType = 0x420;
|
||||
static const int kJSObjectType = 0x421;
|
||||
|
|
@ -313,14 +329,11 @@ class Internals {
|
|||
#ifdef V8_COMPRESS_POINTERS
|
||||
// See v8:7703 or src/ptr-compr.* for details about pointer compression.
|
||||
static constexpr size_t kPtrComprHeapReservationSize = size_t{1} << 32;
|
||||
static constexpr size_t kPtrComprIsolateRootBias =
|
||||
kPtrComprHeapReservationSize / 2;
|
||||
static constexpr size_t kPtrComprIsolateRootAlignment = size_t{1} << 32;
|
||||
|
||||
V8_INLINE static internal::Address GetRootFromOnHeapAddress(
|
||||
internal::Address addr) {
|
||||
return (addr + kPtrComprIsolateRootBias) &
|
||||
-static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
||||
return addr & -static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
||||
}
|
||||
|
||||
V8_INLINE static internal::Address DecompressTaggedAnyField(
|
||||
|
|
@ -367,6 +380,10 @@ V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);
|
|||
// language mode is strict.
|
||||
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate);
|
||||
|
||||
// A base class for backing stores, which is needed due to vagaries of
|
||||
// how static casts work with std::shared_ptr.
|
||||
class BackingStoreBase {};
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ class TaskRunner {
|
|||
TaskRunner() = default;
|
||||
virtual ~TaskRunner() = default;
|
||||
|
||||
private:
|
||||
TaskRunner(const TaskRunner&) = delete;
|
||||
TaskRunner& operator=(const TaskRunner&) = delete;
|
||||
};
|
||||
|
|
@ -368,9 +367,8 @@ class Platform {
|
|||
* |isolate|. Tasks posted for the same isolate should be execute in order of
|
||||
* scheduling. The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallOnForegroundThread(Isolate* isolate, Task* task)) = 0;
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallOnForegroundThread(Isolate* isolate, Task* task) { abort(); }
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a foreground thread wrt a specific
|
||||
|
|
@ -378,10 +376,11 @@ class Platform {
|
|||
* Tasks posted for the same isolate should be execute in order of
|
||||
* scheduling. The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
||||
double delay_in_seconds)) = 0;
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallDelayedOnForegroundThread(Isolate* isolate, Task* task,
|
||||
double delay_in_seconds) {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedules a task to be invoked on a foreground thread wrt a specific
|
||||
|
|
@ -391,20 +390,15 @@ class Platform {
|
|||
* starved for an arbitrarily long time if no idle time is available.
|
||||
* The definition of "foreground" is opaque to V8.
|
||||
*/
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use a taskrunner acquired by GetForegroundTaskRunner instead.",
|
||||
virtual void CallIdleOnForegroundThread(Isolate* isolate,
|
||||
IdleTask* task)) {
|
||||
// This must be overriden if |IdleTasksEnabled()|.
|
||||
V8_DEPRECATED("Use a taskrunner acquired by GetForegroundTaskRunner instead.")
|
||||
virtual void CallIdleOnForegroundThread(Isolate* isolate, IdleTask* task) {
|
||||
abort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if idle tasks are enabled for the given |isolate|.
|
||||
*/
|
||||
virtual bool IdleTasksEnabled(Isolate* isolate) {
|
||||
return false;
|
||||
}
|
||||
virtual bool IdleTasksEnabled(Isolate* isolate) { return false; }
|
||||
|
||||
/**
|
||||
* Monotonically increasing time in seconds from an arbitrary fixed point in
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@
|
|||
#ifndef V8_V8_PROFILER_H_
|
||||
#define V8_V8_PROFILER_H_
|
||||
|
||||
#include <limits.h>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "v8.h" // NOLINT(build/include)
|
||||
|
||||
/**
|
||||
|
|
@ -17,14 +20,18 @@ namespace v8 {
|
|||
class HeapGraphNode;
|
||||
struct HeapStatsUpdate;
|
||||
|
||||
typedef uint32_t SnapshotObjectId;
|
||||
|
||||
using NativeObject = void*;
|
||||
using SnapshotObjectId = uint32_t;
|
||||
|
||||
struct CpuProfileDeoptFrame {
|
||||
int script_id;
|
||||
size_t position;
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
class CpuProfile;
|
||||
} // namespace internal
|
||||
|
||||
} // namespace v8
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
|
|
@ -47,75 +54,6 @@ template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>;
|
|||
|
||||
namespace v8 {
|
||||
|
||||
// TickSample captures the information collected for each sample.
|
||||
struct V8_EXPORT TickSample {
|
||||
// Internal profiling (with --prof + tools/$OS-tick-processor) wants to
|
||||
// include the runtime function we're calling. Externally exposed tick
|
||||
// samples don't care.
|
||||
enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame };
|
||||
|
||||
TickSample()
|
||||
: state(OTHER),
|
||||
pc(nullptr),
|
||||
external_callback_entry(nullptr),
|
||||
frames_count(0),
|
||||
has_external_callback(false),
|
||||
update_stats(true) {}
|
||||
|
||||
/**
|
||||
* Initialize a tick sample from the isolate.
|
||||
* \param isolate The isolate.
|
||||
* \param state Execution state.
|
||||
* \param record_c_entry_frame Include or skip the runtime function.
|
||||
* \param update_stats Whether update the sample to the aggregated stats.
|
||||
* \param use_simulator_reg_state When set to true and V8 is running under a
|
||||
* simulator, the method will use the simulator
|
||||
* register state rather than the one provided
|
||||
* with |state| argument. Otherwise the method
|
||||
* will use provided register |state| as is.
|
||||
*/
|
||||
void Init(Isolate* isolate, const v8::RegisterState& state,
|
||||
RecordCEntryFrame record_c_entry_frame, bool update_stats,
|
||||
bool use_simulator_reg_state = true);
|
||||
/**
|
||||
* Get a call stack sample from the isolate.
|
||||
* \param isolate The isolate.
|
||||
* \param state Register state.
|
||||
* \param record_c_entry_frame Include or skip the runtime function.
|
||||
* \param frames Caller allocated buffer to store stack frames.
|
||||
* \param frames_limit Maximum number of frames to capture. The buffer must
|
||||
* be large enough to hold the number of frames.
|
||||
* \param sample_info The sample info is filled up by the function
|
||||
* provides number of actual captured stack frames and
|
||||
* the current VM state.
|
||||
* \param use_simulator_reg_state When set to true and V8 is running under a
|
||||
* simulator, the method will use the simulator
|
||||
* register state rather than the one provided
|
||||
* with |state| argument. Otherwise the method
|
||||
* will use provided register |state| as is.
|
||||
* \note GetStackSample is thread and signal safe and should only be called
|
||||
* when the JS thread is paused or interrupted.
|
||||
* Otherwise the behavior is undefined.
|
||||
*/
|
||||
static bool GetStackSample(Isolate* isolate, v8::RegisterState* state,
|
||||
RecordCEntryFrame record_c_entry_frame,
|
||||
void** frames, size_t frames_limit,
|
||||
v8::SampleInfo* sample_info,
|
||||
bool use_simulator_reg_state = true);
|
||||
StateTag state; // The state of the VM.
|
||||
void* pc; // Instruction pointer.
|
||||
union {
|
||||
void* tos; // Top stack value (*sp).
|
||||
void* external_callback_entry;
|
||||
};
|
||||
static const unsigned kMaxFramesCountLog2 = 8;
|
||||
static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1;
|
||||
void* stack[kMaxFramesCount]; // Call stack.
|
||||
unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames.
|
||||
bool has_external_callback : 1;
|
||||
bool update_stats : 1; // Whether the sample should update aggregated stats.
|
||||
};
|
||||
|
||||
/**
|
||||
* CpuProfileNode represents a node in a call graph.
|
||||
*/
|
||||
|
|
@ -206,11 +144,6 @@ class V8_EXPORT CpuProfileNode {
|
|||
*/
|
||||
unsigned GetHitCount() const;
|
||||
|
||||
/** Returns function entry UID. */
|
||||
V8_DEPRECATE_SOON(
|
||||
"Use GetScriptId, GetLineNumber, and GetColumnNumber instead.",
|
||||
unsigned GetCallUid() const);
|
||||
|
||||
/** Returns id of the node. The id is unique within the tree */
|
||||
unsigned GetNodeId() const;
|
||||
|
||||
|
|
@ -297,6 +230,66 @@ enum CpuProfilingMode {
|
|||
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,
|
||||
};
|
||||
|
||||
enum CpuProfilingLoggingMode {
|
||||
// Enables logging when a profile is active, and disables logging when all
|
||||
// profiles are detached.
|
||||
kLazyLogging,
|
||||
// Enables logging for the lifetime of the CpuProfiler. Calls to
|
||||
// StartRecording are faster, at the expense of runtime overhead.
|
||||
kEagerLogging,
|
||||
};
|
||||
|
||||
/**
|
||||
* 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,
|
||||
MaybeLocal<Context> filter_context = MaybeLocal<Context>());
|
||||
|
||||
CpuProfilingMode mode() const { return mode_; }
|
||||
unsigned max_samples() const { return max_samples_; }
|
||||
int sampling_interval_us() const { return sampling_interval_us_; }
|
||||
|
||||
private:
|
||||
friend class internal::CpuProfile;
|
||||
|
||||
bool has_filter_context() const { return !filter_context_.IsEmpty(); }
|
||||
void* raw_filter_context() const;
|
||||
|
||||
CpuProfilingMode mode_;
|
||||
unsigned max_samples_;
|
||||
int sampling_interval_us_;
|
||||
CopyablePersistentTraits<Context>::CopyablePersistent filter_context_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface for controlling CPU profiling. Instance of the
|
||||
* profiler can be created using v8::CpuProfiler::New method.
|
||||
|
|
@ -308,7 +301,9 @@ class V8_EXPORT CpuProfiler {
|
|||
* initialized. The profiler object must be disposed after use by calling
|
||||
* |Dispose| method.
|
||||
*/
|
||||
static CpuProfiler* New(Isolate* isolate);
|
||||
static CpuProfiler* New(Isolate* isolate,
|
||||
CpuProfilingNamingMode = kDebugNaming,
|
||||
CpuProfilingLoggingMode = kLazyLogging);
|
||||
|
||||
/**
|
||||
* Synchronously collect current stack sample in all profilers attached to
|
||||
|
|
@ -339,18 +334,26 @@ class V8_EXPORT CpuProfiler {
|
|||
void SetUsePreciseSampling(bool);
|
||||
|
||||
/**
|
||||
* Starts collecting CPU profile. Title may be an empty string. It
|
||||
* is allowed to have several profiles being collected at
|
||||
* once. Attempts to start collecting several profiles with the same
|
||||
* title are silently ignored. While collecting a profile, functions
|
||||
* from all security contexts are included in it. The token-based
|
||||
* filtering is only performed when querying for a profile.
|
||||
* Starts collecting a CPU profile. Title may be an empty string. Several
|
||||
* profiles may be collected at once. Attempts to start collecting several
|
||||
* profiles with the same title are silently ignored.
|
||||
*/
|
||||
void StartProfiling(Local<String> title, CpuProfilingOptions options);
|
||||
|
||||
/**
|
||||
* Starts profiling with the same semantics as above, except with expanded
|
||||
* parameters.
|
||||
*
|
||||
* |record_samples| parameter controls whether individual samples should
|
||||
* 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(Local<String> title, CpuProfilingMode mode,
|
||||
bool record_samples = false);
|
||||
void StartProfiling(
|
||||
Local<String> title, CpuProfilingMode mode, bool record_samples = false,
|
||||
unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
|
||||
/**
|
||||
* The same as StartProfiling above, but the CpuProfilingMode defaults to
|
||||
* kLeafNodeLineNumbers mode, which was the previous default behavior of the
|
||||
|
|
@ -364,20 +367,6 @@ class V8_EXPORT CpuProfiler {
|
|||
*/
|
||||
CpuProfile* StopProfiling(Local<String> title);
|
||||
|
||||
/**
|
||||
* Force collection of a sample. Must be called on the VM thread.
|
||||
* Recording the forced sample does not contribute to the aggregated
|
||||
* profile statistics.
|
||||
*/
|
||||
V8_DEPRECATED("Use static CollectSample(Isolate*) instead.",
|
||||
void CollectSample());
|
||||
|
||||
/**
|
||||
* Tells the profiler whether the embedder is idle.
|
||||
*/
|
||||
V8_DEPRECATED("Use Isolate::SetIdle(bool) instead.",
|
||||
void SetIdle(bool is_idle));
|
||||
|
||||
/**
|
||||
* Generate more detailed source positions to code objects. This results in
|
||||
* better results when mapping profiling samples to script source.
|
||||
|
|
@ -391,7 +380,6 @@ class V8_EXPORT CpuProfiler {
|
|||
CpuProfiler& operator=(const CpuProfiler&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* HeapSnapshotEdge represents a directed connection between heap
|
||||
* graph nodes: from retainers to retained nodes.
|
||||
|
|
@ -742,7 +730,12 @@ class V8_EXPORT EmbedderGraph {
|
|||
*/
|
||||
virtual const char* NamePrefix() { return nullptr; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Returns the NativeObject that can be used for querying the
|
||||
* |HeapSnapshot|.
|
||||
*/
|
||||
virtual NativeObject GetNativeObject() { return nullptr; }
|
||||
|
||||
Node(const Node&) = delete;
|
||||
Node& operator=(const Node&) = delete;
|
||||
};
|
||||
|
|
@ -805,6 +798,12 @@ class V8_EXPORT HeapProfiler {
|
|||
*/
|
||||
SnapshotObjectId GetObjectId(Local<Value> value);
|
||||
|
||||
/**
|
||||
* Returns SnapshotObjectId for a native object referenced by |value| if it
|
||||
* has been seen by the heap profiler, kUnknownObjectId otherwise.
|
||||
*/
|
||||
SnapshotObjectId GetObjectId(NativeObject value);
|
||||
|
||||
/**
|
||||
* Returns heap object with given SnapshotObjectId if the object is alive,
|
||||
* otherwise empty handle is returned.
|
||||
|
|
@ -973,7 +972,8 @@ struct HeapStatsUpdate {
|
|||
V(LazyCompile) \
|
||||
V(RegExp) \
|
||||
V(Script) \
|
||||
V(Stub)
|
||||
V(Stub) \
|
||||
V(Relocation)
|
||||
|
||||
/**
|
||||
* Note that this enum may be extended in the future. Please include a default
|
||||
|
|
@ -1006,10 +1006,12 @@ class V8_EXPORT CodeEvent {
|
|||
const char* GetComment();
|
||||
|
||||
static const char* GetCodeEventTypeName(CodeEventType code_event_type);
|
||||
|
||||
uintptr_t GetPreviousCodeStartAddress();
|
||||
};
|
||||
|
||||
/**
|
||||
* Interface to listen to code creation events.
|
||||
* Interface to listen to code creation and code relocation events.
|
||||
*/
|
||||
class V8_EXPORT CodeEventHandler {
|
||||
public:
|
||||
|
|
@ -1021,9 +1023,26 @@ class V8_EXPORT CodeEventHandler {
|
|||
explicit CodeEventHandler(Isolate* isolate);
|
||||
virtual ~CodeEventHandler();
|
||||
|
||||
/**
|
||||
* Handle is called every time a code object is created or moved. Information
|
||||
* about each code event will be available through the `code_event`
|
||||
* parameter.
|
||||
*
|
||||
* When the CodeEventType is kRelocationType, the code for this CodeEvent has
|
||||
* moved from `GetPreviousCodeStartAddress()` to `GetCodeStartAddress()`.
|
||||
*/
|
||||
virtual void Handle(CodeEvent* code_event) = 0;
|
||||
|
||||
/**
|
||||
* Call `Enable()` to starts listening to code creation and code relocation
|
||||
* events. These events will be handled by `Handle()`.
|
||||
*/
|
||||
void Enable();
|
||||
|
||||
/**
|
||||
* Call `Disable()` to stop listening to code creation and code relocation
|
||||
* events.
|
||||
*/
|
||||
void Disable();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -11,10 +11,9 @@
|
|||
* Testing support for the V8 JavaScript engine.
|
||||
*/
|
||||
namespace v8 {
|
||||
|
||||
class V8_EXPORT Testing {
|
||||
public:
|
||||
enum StressType {
|
||||
enum V8_DEPRECATED("Don't use this (d8-specific testing logic).") StressType {
|
||||
kStressTypeOpt,
|
||||
kStressTypeDeopt
|
||||
};
|
||||
|
|
@ -22,27 +21,30 @@ class V8_EXPORT Testing {
|
|||
/**
|
||||
* Set the type of stressing to do. The default if not set is kStressTypeOpt.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void SetStressRunType(StressType type);
|
||||
|
||||
/**
|
||||
* Get the number of runs of a given test that is required to get the full
|
||||
* stress coverage.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static int GetStressRuns();
|
||||
|
||||
/**
|
||||
* Indicate the number of the run which is about to start. The value of run
|
||||
* should be between 0 and one less than the result from GetStressRuns()
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void PrepareStressRun(int run);
|
||||
|
||||
/**
|
||||
* Force deoptimization of all functions.
|
||||
*/
|
||||
V8_DEPRECATED("Don't use this (d8-specific testing logic).")
|
||||
static void DeoptimizeAll(Isolate* isolate);
|
||||
};
|
||||
|
||||
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_V8_TEST_H_
|
||||
|
|
|
|||
|
|
@ -194,14 +194,6 @@ class PersistentValueMapBase {
|
|||
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.
|
||||
*/
|
||||
|
|
@ -352,16 +344,6 @@ class PersistentValueMapBase {
|
|||
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>
|
||||
class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@
|
|||
// These macros define the version number for the current version.
|
||||
// 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.
|
||||
#define V8_MAJOR_VERSION 7
|
||||
#define V8_MINOR_VERSION 5
|
||||
#define V8_BUILD_NUMBER 288
|
||||
#define V8_PATCH_LEVEL 22
|
||||
#define V8_MAJOR_VERSION 8
|
||||
#define V8_MINOR_VERSION 0
|
||||
#define V8_BUILD_NUMBER 426
|
||||
#define V8_PATCH_LEVEL 16
|
||||
|
||||
// Use 1 for candidates and 0 otherwise.
|
||||
// (Boolean macro values are not supported by all preprocessors.)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Operating system detection
|
||||
// Operating system detection (host)
|
||||
//
|
||||
// V8_OS_ANDROID - Android
|
||||
// V8_OS_BSD - BSDish (Mac OS X, Net/Free/Open/DragonFlyBSD)
|
||||
|
|
@ -122,6 +122,67 @@
|
|||
# define V8_OS_WIN 1
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Operating system detection (target)
|
||||
//
|
||||
// V8_TARGET_OS_ANDROID
|
||||
// V8_TARGET_OS_FUCHSIA
|
||||
// V8_TARGET_OS_IOS
|
||||
// V8_TARGET_OS_LINUX
|
||||
// V8_TARGET_OS_MACOSX
|
||||
// V8_TARGET_OS_WIN
|
||||
//
|
||||
// If not set explicitly, these fall back to corresponding V8_OS_ values.
|
||||
|
||||
#ifdef V8_HAVE_TARGET_OS
|
||||
|
||||
// The target OS is provided, just check that at least one known value is set.
|
||||
# if !defined(V8_TARGET_OS_ANDROID) \
|
||||
&& !defined(V8_TARGET_OS_FUCHSIA) \
|
||||
&& !defined(V8_TARGET_OS_IOS) \
|
||||
&& !defined(V8_TARGET_OS_LINUX) \
|
||||
&& !defined(V8_TARGET_OS_MACOSX) \
|
||||
&& !defined(V8_TARGET_OS_WIN)
|
||||
# error No known target OS defined.
|
||||
# endif
|
||||
|
||||
#else // V8_HAVE_TARGET_OS
|
||||
|
||||
# if defined(V8_TARGET_OS_ANDROID) \
|
||||
|| defined(V8_TARGET_OS_FUCHSIA) \
|
||||
|| defined(V8_TARGET_OS_IOS) \
|
||||
|| defined(V8_TARGET_OS_LINUX) \
|
||||
|| defined(V8_TARGET_OS_MACOSX) \
|
||||
|| defined(V8_TARGET_OS_WIN)
|
||||
# error A target OS is defined but V8_HAVE_TARGET_OS is unset.
|
||||
# endif
|
||||
|
||||
// Fall back to the detected host OS.
|
||||
#ifdef V8_OS_ANDROID
|
||||
# define V8_TARGET_OS_ANDROID
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_FUCHSIA
|
||||
# define V8_TARGET_OS_FUCHSIA
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_IOS
|
||||
# define V8_TARGET_OS_IOS
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_LINUX
|
||||
# define V8_TARGET_OS_LINUX
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_MACOSX
|
||||
# define V8_TARGET_OS_MACOSX
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
# define V8_TARGET_OS_WIN
|
||||
#endif
|
||||
|
||||
#endif // V8_HAVE_TARGET_OS
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// C library detection
|
||||
|
|
@ -169,7 +230,7 @@
|
|||
//
|
||||
// V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
|
||||
// supported
|
||||
// V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
|
||||
// V8_HAS_ATTRIBUTE_NONNULL - __attribute__((nonnull)) supported
|
||||
// V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
|
||||
// V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
|
||||
// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
|
||||
|
|
@ -186,10 +247,10 @@
|
|||
// V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported
|
||||
// V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported
|
||||
// V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported
|
||||
// V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
|
||||
// V8_HAS_COMPUTED_GOTO - computed goto/labels as values
|
||||
// supported
|
||||
// V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
|
||||
// V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported
|
||||
// V8_HAS_DECLSPEC_NORETURN - __declspec(noreturn) supported
|
||||
// V8_HAS___FORCEINLINE - __forceinline supported
|
||||
//
|
||||
// Note that testing for compilers and/or features must be done using #if
|
||||
|
|
@ -205,15 +266,14 @@
|
|||
#endif
|
||||
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE \
|
||||
(__has_extension(attribute_deprecated_with_message))
|
||||
# define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(__has_attribute(warn_unused_result))
|
||||
|
||||
# define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
|
||||
# define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
|
||||
# define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
|
||||
# define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
|
||||
|
|
@ -226,9 +286,13 @@
|
|||
# define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
|
||||
# define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
|
||||
|
||||
# if __cplusplus >= 201402L
|
||||
# define V8_CAN_HAVE_DCHECK_IN_CONSTEXPR 1
|
||||
# endif
|
||||
// Clang has no __has_feature for computed gotos.
|
||||
// GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
# define V8_HAS_COMPUTED_GOTO 1
|
||||
|
||||
// Whether constexpr has full C++14 semantics, in particular that non-constexpr
|
||||
// code is allowed as long as it's not executed for any constexpr instantiation.
|
||||
# define V8_HAS_CXX14_CONSTEXPR 1
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
|
|
@ -247,30 +311,34 @@
|
|||
// always_inline is available in gcc 4.0 but not very reliable until 4.4.
|
||||
// Works around "sorry, unimplemented: inlining failed" build errors with
|
||||
// older compilers.
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE (V8_GNUC_PREREQ(4, 5, 0))
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED (V8_GNUC_PREREQ(2, 95, 0))
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
||||
(!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
|
||||
# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE 1
|
||||
# define V8_HAS_ATTRIBUTE_NOINLINE 1
|
||||
# define V8_HAS_ATTRIBUTE_UNUSED 1
|
||||
# define V8_HAS_ATTRIBUTE_VISIBILITY 1
|
||||
# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
|
||||
|
||||
# define V8_HAS_BUILTIN_CLZ (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_CTZ (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
|
||||
# define V8_HAS_BUILTIN_FRAME_ADDRESS (V8_GNUC_PREREQ(2, 96, 0))
|
||||
# define V8_HAS_BUILTIN_POPCOUNT (V8_GNUC_PREREQ(3, 4, 0))
|
||||
# define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
|
||||
# define V8_HAS_BUILTIN_CLZ 1
|
||||
# define V8_HAS_BUILTIN_CTZ 1
|
||||
# define V8_HAS_BUILTIN_EXPECT 1
|
||||
# define V8_HAS_BUILTIN_FRAME_ADDRESS 1
|
||||
# define V8_HAS_BUILTIN_POPCOUNT 1
|
||||
|
||||
// GCC doc: https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
|
||||
#define V8_HAS_COMPUTED_GOTO 1
|
||||
|
||||
// Whether constexpr has full C++14 semantics, in particular that non-constexpr
|
||||
// code is allowed as long as it's not executed for any constexpr instantiation.
|
||||
// GCC only supports this since version 6.
|
||||
# define V8_HAS_CXX14_CONSTEXPR (V8_GNUC_PREREQ(6, 0, 0))
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define V8_CC_MSVC 1
|
||||
|
||||
# define V8_HAS_DECLSPEC_DEPRECATED 1
|
||||
# define V8_HAS_DECLSPEC_NOINLINE 1
|
||||
# define V8_HAS_DECLSPEC_SELECTANY 1
|
||||
# define V8_HAS_DECLSPEC_NORETURN 1
|
||||
|
||||
# define V8_HAS___FORCEINLINE 1
|
||||
|
||||
|
|
@ -291,6 +359,23 @@
|
|||
# define V8_INLINE inline
|
||||
#endif
|
||||
|
||||
#if V8_HAS_BUILTIN_ASSUME_ALIGNED
|
||||
# define V8_ASSUME_ALIGNED(ptr, alignment) \
|
||||
__builtin_assume_aligned((ptr), (alignment))
|
||||
#else
|
||||
# define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
|
||||
#endif
|
||||
|
||||
|
||||
// A macro to mark specific arguments as non-null.
|
||||
// Use like:
|
||||
// int add(int* x, int y, int* z) V8_NONNULL(1, 3) { return *x + y + *z; }
|
||||
#if V8_HAS_ATTRIBUTE_NONNULL
|
||||
# define V8_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
#else
|
||||
# define V8_NONNULL(...) /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
|
||||
// A macro used to tell the compiler to never inline a particular function.
|
||||
// Don't bother for debug builds.
|
||||
|
|
@ -306,31 +391,18 @@
|
|||
|
||||
|
||||
// A macro (V8_DEPRECATED) to mark classes or functions as deprecated.
|
||||
#if defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
|
||||
#define V8_DEPRECATED(message, declarator) \
|
||||
declarator __attribute__((deprecated(message)))
|
||||
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
|
||||
#define V8_DEPRECATED(message, declarator) \
|
||||
declarator __attribute__((deprecated))
|
||||
#elif defined(V8_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
|
||||
#define V8_DEPRECATED(message, declarator) __declspec(deprecated) declarator
|
||||
#if defined(V8_DEPRECATION_WARNINGS)
|
||||
# define V8_DEPRECATED(message) [[deprecated(message)]]
|
||||
#else
|
||||
#define V8_DEPRECATED(message, declarator) declarator
|
||||
# define V8_DEPRECATED(message)
|
||||
#endif
|
||||
|
||||
|
||||
// A macro (V8_DEPRECATE_SOON) to make it easier to see what will be deprecated.
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS) && \
|
||||
V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE
|
||||
#define V8_DEPRECATE_SOON(message, declarator) \
|
||||
declarator __attribute__((deprecated(message)))
|
||||
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_ATTRIBUTE_DEPRECATED
|
||||
#define V8_DEPRECATE_SOON(message, declarator) \
|
||||
declarator __attribute__((deprecated))
|
||||
#elif defined(V8_IMMINENT_DEPRECATION_WARNINGS) && V8_HAS_DECLSPEC_DEPRECATED
|
||||
#define V8_DEPRECATE_SOON(message, declarator) __declspec(deprecated) declarator
|
||||
#if defined(V8_IMMINENT_DEPRECATION_WARNINGS)
|
||||
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
|
||||
#else
|
||||
#define V8_DEPRECATE_SOON(message, declarator) declarator
|
||||
# define V8_DEPRECATE_SOON(message)
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -353,6 +425,12 @@
|
|||
#define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
|
||||
#endif
|
||||
|
||||
#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
|
||||
#error Inconsistent build configuration: To build the V8 shared library \
|
||||
set BUILDING_V8_SHARED, to include its headers for linking against the \
|
||||
V8 shared library set USING_V8_SHARED.
|
||||
#endif
|
||||
|
||||
#ifdef V8_OS_WIN
|
||||
|
||||
// Setup for Windows DLL export/import. When building the V8 DLL the
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue