libv8 7.3.492.27.1-universal-darwin-20 → 8.4.255.0-universal-darwin-20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libv8/version.rb +1 -1
- data/vendor/v8/include/cppgc/allocation.h +124 -0
- data/vendor/v8/include/cppgc/garbage-collected.h +192 -0
- data/vendor/v8/include/cppgc/heap.h +50 -0
- data/vendor/v8/include/cppgc/internal/accessors.h +26 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +44 -0
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +26 -0
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +90 -0
- data/vendor/v8/include/cppgc/internal/gc-info.h +43 -0
- data/vendor/v8/include/cppgc/internal/logging.h +50 -0
- data/vendor/v8/include/cppgc/internal/persistent-node.h +109 -0
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +133 -0
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +31 -0
- data/vendor/v8/include/cppgc/liveness-broker.h +50 -0
- data/vendor/v8/include/cppgc/macros.h +26 -0
- data/vendor/v8/include/cppgc/member.h +206 -0
- data/vendor/v8/include/cppgc/persistent.h +304 -0
- data/vendor/v8/include/cppgc/platform.h +31 -0
- data/vendor/v8/include/cppgc/prefinalizer.h +54 -0
- data/vendor/v8/include/cppgc/source-location.h +59 -0
- data/vendor/v8/include/cppgc/trace-trait.h +67 -0
- data/vendor/v8/include/cppgc/type-traits.h +109 -0
- data/vendor/v8/include/cppgc/visitor.h +137 -0
- data/vendor/v8/include/libplatform/libplatform.h +13 -19
- data/vendor/v8/include/libplatform/v8-tracing.h +50 -15
- data/vendor/v8/include/v8-fast-api-calls.h +412 -0
- data/vendor/v8/include/v8-inspector-protocol.h +4 -4
- data/vendor/v8/include/v8-inspector.h +60 -29
- data/vendor/v8/include/v8-internal.h +98 -82
- data/vendor/v8/include/v8-platform.h +181 -42
- data/vendor/v8/include/v8-profiler.h +162 -224
- data/vendor/v8/include/v8-util.h +1 -13
- data/vendor/v8/include/v8-version-string.h +1 -1
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm-trap-handler-posix.h +1 -1
- data/vendor/v8/include/v8-wasm-trap-handler-win.h +1 -1
- data/vendor/v8/include/v8.h +1990 -611
- data/vendor/v8/include/v8config.h +129 -48
- data/vendor/v8/out.gn/libv8/obj/libv8_libbase.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/libv8_libplatform.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/third_party/icu/libicui18n.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/third_party/icu/libicuuc.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/third_party/zlib/google/libcompression_utils_portable.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/third_party/zlib/libchrome_zlib.a +0 -0
- metadata +29 -3
- data/vendor/v8/include/v8-testing.h +0 -48
@@ -5,9 +5,9 @@
|
|
5
5
|
#ifndef V8_V8_INSPECTOR_PROTOCOL_H_
|
6
6
|
#define V8_V8_INSPECTOR_PROTOCOL_H_
|
7
7
|
|
8
|
-
#include "inspector/Debugger.h" // NOLINT(build/
|
9
|
-
#include "inspector/Runtime.h" // NOLINT(build/
|
10
|
-
#include "inspector/Schema.h" // NOLINT(build/
|
11
|
-
#include "v8-inspector.h" // NOLINT(build/
|
8
|
+
#include "inspector/Debugger.h" // NOLINT(build/include_directory)
|
9
|
+
#include "inspector/Runtime.h" // NOLINT(build/include_directory)
|
10
|
+
#include "inspector/Schema.h" // NOLINT(build/include_directory)
|
11
|
+
#include "v8-inspector.h" // NOLINT(build/include_directory)
|
12
12
|
|
13
13
|
#endif // V8_V8_INSPECTOR_PROTOCOL_H_
|
@@ -9,8 +9,9 @@
|
|
9
9
|
#include <cctype>
|
10
10
|
|
11
11
|
#include <memory>
|
12
|
+
#include <unordered_map>
|
12
13
|
|
13
|
-
#include "v8.h" // NOLINT(build/
|
14
|
+
#include "v8.h" // NOLINT(build/include_directory)
|
14
15
|
|
15
16
|
namespace v8_inspector {
|
16
17
|
|
@@ -24,6 +25,7 @@ namespace Runtime {
|
|
24
25
|
namespace API {
|
25
26
|
class RemoteObject;
|
26
27
|
class StackTrace;
|
28
|
+
class StackTraceId;
|
27
29
|
}
|
28
30
|
}
|
29
31
|
namespace Schema {
|
@@ -63,15 +65,15 @@ class V8_EXPORT StringView {
|
|
63
65
|
class V8_EXPORT StringBuffer {
|
64
66
|
public:
|
65
67
|
virtual ~StringBuffer() = default;
|
66
|
-
virtual
|
68
|
+
virtual StringView string() const = 0;
|
67
69
|
// This method copies contents.
|
68
|
-
static std::unique_ptr<StringBuffer> create(
|
70
|
+
static std::unique_ptr<StringBuffer> create(StringView);
|
69
71
|
};
|
70
72
|
|
71
73
|
class V8_EXPORT V8ContextInfo {
|
72
74
|
public:
|
73
75
|
V8ContextInfo(v8::Local<v8::Context> context, int contextGroupId,
|
74
|
-
|
76
|
+
StringView humanReadableName)
|
75
77
|
: context(context),
|
76
78
|
contextGroupId(contextGroupId),
|
77
79
|
humanReadableName(humanReadableName),
|
@@ -87,7 +89,6 @@ class V8_EXPORT V8ContextInfo {
|
|
87
89
|
|
88
90
|
static int executionContextId(v8::Local<v8::Context> context);
|
89
91
|
|
90
|
-
private:
|
91
92
|
// Disallow copying and allocating this one.
|
92
93
|
enum NotNullTagEnum { NotNullLiteral };
|
93
94
|
void* operator new(size_t) = delete;
|
@@ -110,6 +111,8 @@ class V8_EXPORT V8StackTrace {
|
|
110
111
|
virtual ~V8StackTrace() = default;
|
111
112
|
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
112
113
|
buildInspectorObject() const = 0;
|
114
|
+
virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
|
115
|
+
buildInspectorObject(int maxAsyncDepth) const = 0;
|
113
116
|
virtual std::unique_ptr<StringBuffer> toString() const = 0;
|
114
117
|
|
115
118
|
// Safe to pass between threads, drops async chain.
|
@@ -129,35 +132,36 @@ class V8_EXPORT V8InspectorSession {
|
|
129
132
|
virtual void addInspectedObject(std::unique_ptr<Inspectable>) = 0;
|
130
133
|
|
131
134
|
// Dispatching protocol messages.
|
132
|
-
static bool canDispatchMethod(
|
133
|
-
virtual void dispatchProtocolMessage(
|
134
|
-
virtual std::
|
135
|
+
static bool canDispatchMethod(StringView method);
|
136
|
+
virtual void dispatchProtocolMessage(StringView message) = 0;
|
137
|
+
virtual std::vector<uint8_t> state() = 0;
|
135
138
|
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
136
139
|
supportedDomains() = 0;
|
137
140
|
|
138
141
|
// Debugger actions.
|
139
|
-
virtual void schedulePauseOnNextStatement(
|
140
|
-
|
142
|
+
virtual void schedulePauseOnNextStatement(StringView breakReason,
|
143
|
+
StringView breakDetails) = 0;
|
141
144
|
virtual void cancelPauseOnNextStatement() = 0;
|
142
|
-
virtual void breakProgram(
|
143
|
-
|
145
|
+
virtual void breakProgram(StringView breakReason,
|
146
|
+
StringView breakDetails) = 0;
|
144
147
|
virtual void setSkipAllPauses(bool) = 0;
|
145
|
-
virtual void resume() = 0;
|
148
|
+
virtual void resume(bool setTerminateOnResume = false) = 0;
|
146
149
|
virtual void stepOver() = 0;
|
147
150
|
virtual std::vector<std::unique_ptr<protocol::Debugger::API::SearchMatch>>
|
148
|
-
searchInTextByLines(
|
149
|
-
bool
|
151
|
+
searchInTextByLines(StringView text, StringView query, bool caseSensitive,
|
152
|
+
bool isRegex) = 0;
|
150
153
|
|
151
154
|
// Remote objects.
|
152
155
|
virtual std::unique_ptr<protocol::Runtime::API::RemoteObject> wrapObject(
|
153
|
-
v8::Local<v8::Context>, v8::Local<v8::Value>,
|
156
|
+
v8::Local<v8::Context>, v8::Local<v8::Value>, StringView groupName,
|
154
157
|
bool generatePreview) = 0;
|
155
158
|
|
156
159
|
virtual bool unwrapObject(std::unique_ptr<StringBuffer>* error,
|
157
|
-
|
160
|
+
StringView objectId, v8::Local<v8::Value>*,
|
158
161
|
v8::Local<v8::Context>*,
|
159
162
|
std::unique_ptr<StringBuffer>* objectGroup) = 0;
|
160
|
-
virtual void releaseObjectGroup(
|
163
|
+
virtual void releaseObjectGroup(StringView) = 0;
|
164
|
+
virtual void triggerPreciseCoverageDeltaUpdate(StringView occassion) = 0;
|
161
165
|
};
|
162
166
|
|
163
167
|
class V8_EXPORT V8InspectorClient {
|
@@ -228,12 +232,20 @@ class V8_EXPORT V8InspectorClient {
|
|
228
232
|
struct V8_EXPORT V8StackTraceId {
|
229
233
|
uintptr_t id;
|
230
234
|
std::pair<int64_t, int64_t> debugger_id;
|
235
|
+
bool should_pause = false;
|
231
236
|
|
232
237
|
V8StackTraceId();
|
238
|
+
V8StackTraceId(const V8StackTraceId&) = default;
|
233
239
|
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id);
|
240
|
+
V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id,
|
241
|
+
bool should_pause);
|
242
|
+
explicit V8StackTraceId(StringView);
|
243
|
+
V8StackTraceId& operator=(const V8StackTraceId&) = default;
|
244
|
+
V8StackTraceId& operator=(V8StackTraceId&&) noexcept = default;
|
234
245
|
~V8StackTraceId() = default;
|
235
246
|
|
236
247
|
bool IsInvalid() const;
|
248
|
+
std::unique_ptr<StringBuffer> ToString();
|
237
249
|
};
|
238
250
|
|
239
251
|
class V8_EXPORT V8Inspector {
|
@@ -252,26 +264,26 @@ class V8_EXPORT V8Inspector {
|
|
252
264
|
virtual void idleFinished() = 0;
|
253
265
|
|
254
266
|
// Async stack traces instrumentation.
|
255
|
-
virtual void asyncTaskScheduled(
|
267
|
+
virtual void asyncTaskScheduled(StringView taskName, void* task,
|
256
268
|
bool recurring) = 0;
|
257
269
|
virtual void asyncTaskCanceled(void* task) = 0;
|
258
270
|
virtual void asyncTaskStarted(void* task) = 0;
|
259
271
|
virtual void asyncTaskFinished(void* task) = 0;
|
260
272
|
virtual void allAsyncTasksCanceled() = 0;
|
261
273
|
|
262
|
-
virtual V8StackTraceId storeCurrentStackTrace(
|
263
|
-
const StringView& description) = 0;
|
274
|
+
virtual V8StackTraceId storeCurrentStackTrace(StringView description) = 0;
|
264
275
|
virtual void externalAsyncTaskStarted(const V8StackTraceId& parent) = 0;
|
265
276
|
virtual void externalAsyncTaskFinished(const V8StackTraceId& parent) = 0;
|
266
277
|
|
267
278
|
// Exceptions instrumentation.
|
268
|
-
virtual unsigned exceptionThrown(
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
279
|
+
virtual unsigned exceptionThrown(v8::Local<v8::Context>, StringView message,
|
280
|
+
v8::Local<v8::Value> exception,
|
281
|
+
StringView detailedMessage, StringView url,
|
282
|
+
unsigned lineNumber, unsigned columnNumber,
|
283
|
+
std::unique_ptr<V8StackTrace>,
|
284
|
+
int scriptId) = 0;
|
273
285
|
virtual void exceptionRevoked(v8::Local<v8::Context>, unsigned exceptionId,
|
274
|
-
|
286
|
+
StringView message) = 0;
|
275
287
|
|
276
288
|
// Connection.
|
277
289
|
class V8_EXPORT Channel {
|
@@ -282,13 +294,32 @@ class V8_EXPORT V8Inspector {
|
|
282
294
|
virtual void sendNotification(std::unique_ptr<StringBuffer> message) = 0;
|
283
295
|
virtual void flushProtocolNotifications() = 0;
|
284
296
|
};
|
285
|
-
virtual std::unique_ptr<V8InspectorSession> connect(
|
286
|
-
|
297
|
+
virtual std::unique_ptr<V8InspectorSession> connect(int contextGroupId,
|
298
|
+
Channel*,
|
299
|
+
StringView state) = 0;
|
287
300
|
|
288
301
|
// API methods.
|
289
302
|
virtual std::unique_ptr<V8StackTrace> createStackTrace(
|
290
303
|
v8::Local<v8::StackTrace>) = 0;
|
291
304
|
virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
|
305
|
+
|
306
|
+
// Performance counters.
|
307
|
+
class V8_EXPORT Counters : public std::enable_shared_from_this<Counters> {
|
308
|
+
public:
|
309
|
+
explicit Counters(v8::Isolate* isolate);
|
310
|
+
~Counters();
|
311
|
+
const std::unordered_map<std::string, int>& getCountersMap() const {
|
312
|
+
return m_countersMap;
|
313
|
+
}
|
314
|
+
|
315
|
+
private:
|
316
|
+
static int* getCounterPtr(const char* name);
|
317
|
+
|
318
|
+
v8::Isolate* m_isolate;
|
319
|
+
std::unordered_map<std::string, int> m_countersMap;
|
320
|
+
};
|
321
|
+
|
322
|
+
virtual std::shared_ptr<Counters> enableCounters() = 0;
|
292
323
|
};
|
293
324
|
|
294
325
|
} // namespace v8_inspector
|
@@ -7,10 +7,11 @@
|
|
7
7
|
|
8
8
|
#include <stddef.h>
|
9
9
|
#include <stdint.h>
|
10
|
+
#include <string.h>
|
10
11
|
#include <type_traits>
|
11
12
|
|
12
|
-
#include "v8-version.h" // NOLINT(build/
|
13
|
-
#include "v8config.h" // NOLINT(build/
|
13
|
+
#include "v8-version.h" // NOLINT(build/include_directory)
|
14
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
14
15
|
|
15
16
|
namespace v8 {
|
16
17
|
|
@@ -29,9 +30,8 @@ static const Address kNullAddress = 0;
|
|
29
30
|
* Configuration of tagging scheme.
|
30
31
|
*/
|
31
32
|
const int kApiSystemPointerSize = sizeof(void*);
|
32
|
-
const int kApiTaggedSize = kApiSystemPointerSize;
|
33
33
|
const int kApiDoubleSize = sizeof(double);
|
34
|
-
const int
|
34
|
+
const int kApiInt32Size = sizeof(int32_t);
|
35
35
|
const int kApiInt64Size = sizeof(int64_t);
|
36
36
|
|
37
37
|
// Tag information for HeapObject.
|
@@ -48,28 +48,32 @@ const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
|
|
48
48
|
template <size_t tagged_ptr_size>
|
49
49
|
struct SmiTagging;
|
50
50
|
|
51
|
+
constexpr intptr_t kIntptrAllBitsSet = intptr_t{-1};
|
52
|
+
constexpr uintptr_t kUintptrAllBitsSet =
|
53
|
+
static_cast<uintptr_t>(kIntptrAllBitsSet);
|
54
|
+
|
51
55
|
// Smi constants for systems where tagged pointer is a 32-bit value.
|
52
56
|
template <>
|
53
57
|
struct SmiTagging<4> {
|
54
58
|
enum { kSmiShiftSize = 0, kSmiValueSize = 31 };
|
59
|
+
|
60
|
+
static constexpr intptr_t kSmiMinValue =
|
61
|
+
static_cast<intptr_t>(kUintptrAllBitsSet << (kSmiValueSize - 1));
|
62
|
+
static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1);
|
63
|
+
|
55
64
|
V8_INLINE static int SmiToInt(const internal::Address value) {
|
56
65
|
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
57
|
-
//
|
58
|
-
return static_cast<
|
66
|
+
// Truncate and shift down (requires >> to be sign extending).
|
67
|
+
return static_cast<int32_t>(static_cast<uint32_t>(value)) >> shift_bits;
|
59
68
|
}
|
60
69
|
V8_INLINE static constexpr bool IsValidSmi(intptr_t value) {
|
61
|
-
//
|
62
|
-
//
|
63
|
-
//
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
// may lead to incorrect results according to the C language spec, and
|
69
|
-
// in fact doesn't work correctly with gcc4.1.1 in some cases: The
|
70
|
-
// compiler may produce undefined results in case of signed integer
|
71
|
-
// overflow. The computation must be done w/ unsigned ints.
|
72
|
-
return static_cast<uintptr_t>(value) + 0x40000000U < 0x80000000U;
|
70
|
+
// Is value in range [kSmiMinValue, kSmiMaxValue].
|
71
|
+
// Use unsigned operations in order to avoid undefined behaviour in case of
|
72
|
+
// signed integer overflow.
|
73
|
+
return (static_cast<uintptr_t>(value) -
|
74
|
+
static_cast<uintptr_t>(kSmiMinValue)) <=
|
75
|
+
(static_cast<uintptr_t>(kSmiMaxValue) -
|
76
|
+
static_cast<uintptr_t>(kSmiMinValue));
|
73
77
|
}
|
74
78
|
};
|
75
79
|
|
@@ -77,6 +81,11 @@ struct SmiTagging<4> {
|
|
77
81
|
template <>
|
78
82
|
struct SmiTagging<8> {
|
79
83
|
enum { kSmiShiftSize = 31, kSmiValueSize = 32 };
|
84
|
+
|
85
|
+
static constexpr intptr_t kSmiMinValue =
|
86
|
+
static_cast<intptr_t>(kUintptrAllBitsSet << (kSmiValueSize - 1));
|
87
|
+
static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1);
|
88
|
+
|
80
89
|
V8_INLINE static int SmiToInt(const internal::Address value) {
|
81
90
|
int shift_bits = kSmiTagSize + kSmiShiftSize;
|
82
91
|
// Shift down and throw away top 32 bits.
|
@@ -88,22 +97,31 @@ struct SmiTagging<8> {
|
|
88
97
|
}
|
89
98
|
};
|
90
99
|
|
91
|
-
#
|
100
|
+
#ifdef V8_COMPRESS_POINTERS
|
92
101
|
static_assert(
|
93
102
|
kApiSystemPointerSize == kApiInt64Size,
|
94
103
|
"Pointer compression can be enabled only for 64-bit architectures");
|
104
|
+
const int kApiTaggedSize = kApiInt32Size;
|
105
|
+
#else
|
106
|
+
const int kApiTaggedSize = kApiSystemPointerSize;
|
95
107
|
#endif
|
96
108
|
|
97
|
-
|
98
|
-
|
109
|
+
constexpr bool PointerCompressionIsEnabled() {
|
110
|
+
return kApiTaggedSize != kApiSystemPointerSize;
|
111
|
+
}
|
112
|
+
|
113
|
+
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
|
114
|
+
using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
|
99
115
|
#else
|
100
|
-
|
116
|
+
using PlatformSmiTagging = SmiTagging<kApiTaggedSize>;
|
101
117
|
#endif
|
102
118
|
|
119
|
+
// TODO(ishell): Consinder adding kSmiShiftBits = kSmiShiftSize + kSmiTagSize
|
120
|
+
// since it's used much more often than the inividual constants.
|
103
121
|
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
|
104
122
|
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
|
105
|
-
const int kSmiMinValue =
|
106
|
-
const int kSmiMaxValue =
|
123
|
+
const int kSmiMinValue = static_cast<int>(PlatformSmiTagging::kSmiMinValue);
|
124
|
+
const int kSmiMaxValue = static_cast<int>(PlatformSmiTagging::kSmiMaxValue);
|
107
125
|
constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
|
108
126
|
constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
|
109
127
|
|
@@ -122,23 +140,16 @@ class Internals {
|
|
122
140
|
// These values match non-compiler-dependent values defined within
|
123
141
|
// the implementation of v8.
|
124
142
|
static const int kHeapObjectMapOffset = 0;
|
125
|
-
static const int kMapInstanceTypeOffset = 1 * kApiTaggedSize +
|
126
|
-
static const int kStringResourceOffset =
|
143
|
+
static const int kMapInstanceTypeOffset = 1 * kApiTaggedSize + kApiInt32Size;
|
144
|
+
static const int kStringResourceOffset =
|
145
|
+
1 * kApiTaggedSize + 2 * kApiInt32Size;
|
127
146
|
|
128
147
|
static const int kOddballKindOffset = 4 * kApiTaggedSize + kApiDoubleSize;
|
129
|
-
static const int kForeignAddressOffset = kApiTaggedSize;
|
130
148
|
static const int kJSObjectHeaderSize = 3 * kApiTaggedSize;
|
131
|
-
static const int kJSObjectHeaderSizeForEmbedderFields =
|
132
|
-
(kJSObjectHeaderSize + kApiSystemPointerSize - 1) &
|
133
|
-
-kApiSystemPointerSize;
|
134
149
|
static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize;
|
135
150
|
static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize;
|
136
|
-
static const int kEmbedderDataSlotSize =
|
137
|
-
|
138
|
-
2 *
|
139
|
-
#endif
|
140
|
-
kApiSystemPointerSize;
|
141
|
-
static const int kNativeContextEmbedderDataOffset = 7 * kApiTaggedSize;
|
151
|
+
static const int kEmbedderDataSlotSize = kApiSystemPointerSize;
|
152
|
+
static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize;
|
142
153
|
static const int kFullStringRepresentationMask = 0x0f;
|
143
154
|
static const int kStringEncodingMask = 0x8;
|
144
155
|
static const int kExternalTwoByteRepresentationTag = 0x02;
|
@@ -146,15 +157,22 @@ class Internals {
|
|
146
157
|
|
147
158
|
static const uint32_t kNumIsolateDataSlots = 4;
|
148
159
|
|
160
|
+
// IsolateData layout guarantees.
|
149
161
|
static const int kIsolateEmbedderDataOffset = 0;
|
150
162
|
static const int kExternalMemoryOffset =
|
151
|
-
kNumIsolateDataSlots *
|
163
|
+
kNumIsolateDataSlots * kApiSystemPointerSize;
|
152
164
|
static const int kExternalMemoryLimitOffset =
|
153
165
|
kExternalMemoryOffset + kApiInt64Size;
|
154
|
-
static const int
|
166
|
+
static const int kExternalMemoryLowSinceMarkCompactOffset =
|
155
167
|
kExternalMemoryLimitOffset + kApiInt64Size;
|
168
|
+
static const int kIsolateFastCCallCallerFpOffset =
|
169
|
+
kExternalMemoryLowSinceMarkCompactOffset + kApiInt64Size;
|
170
|
+
static const int kIsolateFastCCallCallerPcOffset =
|
171
|
+
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
|
172
|
+
static const int kIsolateStackGuardOffset =
|
173
|
+
kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize;
|
156
174
|
static const int kIsolateRootsOffset =
|
157
|
-
|
175
|
+
kIsolateStackGuardOffset + 7 * kApiSystemPointerSize;
|
158
176
|
|
159
177
|
static const int kUndefinedValueRootIndex = 4;
|
160
178
|
static const int kTheHoleValueRootIndex = 5;
|
@@ -163,18 +181,15 @@ class Internals {
|
|
163
181
|
static const int kFalseValueRootIndex = 8;
|
164
182
|
static const int kEmptyStringRootIndex = 9;
|
165
183
|
|
166
|
-
static const int kNodeClassIdOffset = 1 *
|
167
|
-
static const int kNodeFlagsOffset = 1 *
|
184
|
+
static const int kNodeClassIdOffset = 1 * kApiSystemPointerSize;
|
185
|
+
static const int kNodeFlagsOffset = 1 * kApiSystemPointerSize + 3;
|
168
186
|
static const int kNodeStateMask = 0x7;
|
169
187
|
static const int kNodeStateIsWeakValue = 2;
|
170
188
|
static const int kNodeStateIsPendingValue = 3;
|
171
|
-
static const int kNodeStateIsNearDeathValue = 4;
|
172
|
-
static const int kNodeIsIndependentShift = 3;
|
173
|
-
static const int kNodeIsActiveShift = 4;
|
174
189
|
|
175
|
-
static const int kFirstNonstringType =
|
176
|
-
static const int kOddballType =
|
177
|
-
static const int kForeignType =
|
190
|
+
static const int kFirstNonstringType = 0x40;
|
191
|
+
static const int kOddballType = 0x43;
|
192
|
+
static const int kForeignType = 0x46;
|
178
193
|
static const int kJSSpecialApiObjectType = 0x410;
|
179
194
|
static const int kJSApiObjectType = 0x420;
|
180
195
|
static const int kJSObjectType = 0x421;
|
@@ -182,6 +197,12 @@ class Internals {
|
|
182
197
|
static const int kUndefinedOddballKind = 5;
|
183
198
|
static const int kNullOddballKind = 3;
|
184
199
|
|
200
|
+
// Constants used by PropertyCallbackInfo to check if we should throw when an
|
201
|
+
// error occurs.
|
202
|
+
static const int kThrowOnError = 0;
|
203
|
+
static const int kDontThrow = 1;
|
204
|
+
static const int kInferShouldThrowMode = 2;
|
205
|
+
|
185
206
|
// Soft limit for AdjustAmountofExternalAllocatedMemory. Trigger an
|
186
207
|
// incremental GC once the external memory reaches this limit.
|
187
208
|
static constexpr int kExternalAllocationSoftLimit = 64 * 1024 * 1024;
|
@@ -273,15 +294,26 @@ class Internals {
|
|
273
294
|
V8_INLINE static T ReadRawField(internal::Address heap_object_ptr,
|
274
295
|
int offset) {
|
275
296
|
internal::Address addr = heap_object_ptr + offset - kHeapObjectTag;
|
297
|
+
#ifdef V8_COMPRESS_POINTERS
|
298
|
+
if (sizeof(T) > kApiTaggedSize) {
|
299
|
+
// TODO(ishell, v8:8875): When pointer compression is enabled 8-byte size
|
300
|
+
// fields (external pointers, doubles and BigInt data) are only
|
301
|
+
// kTaggedSize aligned so we have to use unaligned pointer friendly way of
|
302
|
+
// accessing them in order to avoid undefined behavior in C++ code.
|
303
|
+
T r;
|
304
|
+
memcpy(&r, reinterpret_cast<void*>(addr), sizeof(T));
|
305
|
+
return r;
|
306
|
+
}
|
307
|
+
#endif
|
276
308
|
return *reinterpret_cast<const T*>(addr);
|
277
309
|
}
|
278
310
|
|
279
311
|
V8_INLINE static internal::Address ReadTaggedPointerField(
|
280
312
|
internal::Address heap_object_ptr, int offset) {
|
281
313
|
#ifdef V8_COMPRESS_POINTERS
|
282
|
-
|
314
|
+
uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
|
283
315
|
internal::Address root = GetRootFromOnHeapAddress(heap_object_ptr);
|
284
|
-
return root + static_cast<internal::Address>(static_cast<
|
316
|
+
return root + static_cast<internal::Address>(static_cast<uintptr_t>(value));
|
285
317
|
#else
|
286
318
|
return ReadRawField<internal::Address>(heap_object_ptr, offset);
|
287
319
|
#endif
|
@@ -290,52 +322,27 @@ class Internals {
|
|
290
322
|
V8_INLINE static internal::Address ReadTaggedSignedField(
|
291
323
|
internal::Address heap_object_ptr, int offset) {
|
292
324
|
#ifdef V8_COMPRESS_POINTERS
|
293
|
-
|
294
|
-
return static_cast<internal::Address>(static_cast<
|
295
|
-
#else
|
296
|
-
return ReadRawField<internal::Address>(heap_object_ptr, offset);
|
297
|
-
#endif
|
298
|
-
}
|
299
|
-
|
300
|
-
V8_INLINE static internal::Address ReadTaggedAnyField(
|
301
|
-
internal::Address heap_object_ptr, int offset) {
|
302
|
-
#ifdef V8_COMPRESS_POINTERS
|
303
|
-
int32_t value = ReadRawField<int32_t>(heap_object_ptr, offset);
|
304
|
-
internal::Address root_mask = static_cast<internal::Address>(
|
305
|
-
-static_cast<intptr_t>(value & kSmiTagMask));
|
306
|
-
internal::Address root_or_zero =
|
307
|
-
root_mask & GetRootFromOnHeapAddress(heap_object_ptr);
|
308
|
-
return root_or_zero +
|
309
|
-
static_cast<internal::Address>(static_cast<intptr_t>(value));
|
325
|
+
uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
|
326
|
+
return static_cast<internal::Address>(static_cast<uintptr_t>(value));
|
310
327
|
#else
|
311
328
|
return ReadRawField<internal::Address>(heap_object_ptr, offset);
|
312
329
|
#endif
|
313
330
|
}
|
314
331
|
|
315
332
|
#ifdef V8_COMPRESS_POINTERS
|
333
|
+
// See v8:7703 or src/ptr-compr.* for details about pointer compression.
|
316
334
|
static constexpr size_t kPtrComprHeapReservationSize = size_t{1} << 32;
|
317
|
-
static constexpr size_t kPtrComprIsolateRootBias =
|
318
|
-
kPtrComprHeapReservationSize / 2;
|
319
335
|
static constexpr size_t kPtrComprIsolateRootAlignment = size_t{1} << 32;
|
320
336
|
|
321
337
|
V8_INLINE static internal::Address GetRootFromOnHeapAddress(
|
322
338
|
internal::Address addr) {
|
323
|
-
return
|
324
|
-
-static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
339
|
+
return addr & -static_cast<intptr_t>(kPtrComprIsolateRootAlignment);
|
325
340
|
}
|
326
341
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
typedef internal::Address A;
|
332
|
-
typedef internal::Internals I;
|
333
|
-
A ctx = *reinterpret_cast<const A*>(context);
|
334
|
-
A embedder_data =
|
335
|
-
I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
|
336
|
-
int value_offset =
|
337
|
-
I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index);
|
338
|
-
return I::ReadRawField<T>(embedder_data, value_offset);
|
342
|
+
V8_INLINE static internal::Address DecompressTaggedAnyField(
|
343
|
+
internal::Address heap_object_ptr, uint32_t value) {
|
344
|
+
internal::Address root = GetRootFromOnHeapAddress(heap_object_ptr);
|
345
|
+
return root + static_cast<internal::Address>(static_cast<uintptr_t>(value));
|
339
346
|
}
|
340
347
|
#endif // V8_COMPRESS_POINTERS
|
341
348
|
};
|
@@ -367,6 +374,15 @@ V8_INLINE void PerformCastCheck(T* data) {
|
|
367
374
|
// that's guaranteed to never be in ReadOnlySpace.
|
368
375
|
V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);
|
369
376
|
|
377
|
+
// Returns if we need to throw when an error occurs. This infers the language
|
378
|
+
// mode based on the current context and the closure. This returns true if the
|
379
|
+
// language mode is strict.
|
380
|
+
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate);
|
381
|
+
|
382
|
+
// A base class for backing stores, which is needed due to vagaries of
|
383
|
+
// how static casts work with std::shared_ptr.
|
384
|
+
class BackingStoreBase {};
|
385
|
+
|
370
386
|
} // namespace internal
|
371
387
|
} // namespace v8
|
372
388
|
|