Skip to content

Commit bf82dcd

Browse files
committed
deps: patch V8 to 9.5.172.21
Refs: v8/v8@9.5.172.19...9.5.172.21 PR-URL: #40432 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Beth Griggs <[email protected]>
1 parent b80b85e commit bf82dcd

12 files changed

+207
-169
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 9
1212
#define V8_MINOR_VERSION 5
1313
#define V8_BUILD_NUMBER 172
14-
#define V8_PATCH_LEVEL 19
14+
#define V8_PATCH_LEVEL 21
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/api/api.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ namespace debug {
4242
class AccessorPair;
4343
class GeneratorObject;
4444
class Script;
45-
class WeakMap;
45+
class EphemeronTable;
4646
} // namespace debug
4747

4848
// Constants used in the implementation of the API. The most natural thing
@@ -135,7 +135,7 @@ class RegisteredExtension {
135135
V(Proxy, JSProxy) \
136136
V(debug::GeneratorObject, JSGeneratorObject) \
137137
V(debug::Script, Script) \
138-
V(debug::WeakMap, JSWeakMap) \
138+
V(debug::EphemeronTable, EphemeronHashTable) \
139139
V(debug::AccessorPair, AccessorPair) \
140140
V(Promise, JSPromise) \
141141
V(Primitive, Object) \

deps/v8/src/debug/debug-interface.cc

+31-49
Original file line numberDiff line numberDiff line change
@@ -1177,61 +1177,43 @@ TypeProfile::ScriptData TypeProfile::GetScriptData(size_t i) const {
11771177
return ScriptData(i, type_profile_);
11781178
}
11791179

1180-
v8::MaybeLocal<v8::Value> WeakMap::Get(v8::Local<v8::Context> context,
1181-
v8::Local<v8::Value> key) {
1182-
PREPARE_FOR_EXECUTION(context, WeakMap, Get, Value);
1183-
auto self = Utils::OpenHandle(this);
1184-
Local<Value> result;
1185-
i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)};
1186-
has_pending_exception =
1187-
!ToLocal<Value>(i::Execution::CallBuiltin(isolate, isolate->weakmap_get(),
1188-
self, arraysize(argv), argv),
1189-
&result);
1190-
RETURN_ON_FAILED_EXECUTION(Value);
1191-
RETURN_ESCAPED(result);
1180+
MaybeLocal<v8::Value> EphemeronTable::Get(v8::Isolate* isolate,
1181+
v8::Local<v8::Value> key) {
1182+
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
1183+
auto self = i::Handle<i::EphemeronHashTable>::cast(Utils::OpenHandle(this));
1184+
i::Handle<i::Object> internal_key = Utils::OpenHandle(*key);
1185+
DCHECK(internal_key->IsJSReceiver());
1186+
1187+
i::Handle<i::Object> value(self->Lookup(internal_key), internal_isolate);
1188+
1189+
if (value->IsTheHole()) return {};
1190+
return Utils::ToLocal(value);
11921191
}
11931192

1194-
v8::Maybe<bool> WeakMap::Delete(v8::Local<v8::Context> context,
1195-
v8::Local<v8::Value> key) {
1196-
PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, WeakMap, Delete, Nothing<bool>(),
1197-
InternalEscapableScope, false);
1198-
auto self = Utils::OpenHandle(this);
1199-
Local<Value> result;
1200-
i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key)};
1201-
has_pending_exception = !ToLocal<Value>(
1202-
i::Execution::CallBuiltin(isolate, isolate->weakmap_delete(), self,
1203-
arraysize(argv), argv),
1204-
&result);
1205-
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
1206-
return Just(result->IsTrue());
1207-
}
1208-
1209-
v8::MaybeLocal<WeakMap> WeakMap::Set(v8::Local<v8::Context> context,
1210-
v8::Local<v8::Value> key,
1211-
v8::Local<v8::Value> value) {
1212-
PREPARE_FOR_EXECUTION(context, WeakMap, Set, WeakMap);
1213-
auto self = Utils::OpenHandle(this);
1214-
i::Handle<i::Object> result;
1215-
i::Handle<i::Object> argv[] = {Utils::OpenHandle(*key),
1216-
Utils::OpenHandle(*value)};
1217-
has_pending_exception =
1218-
!i::Execution::CallBuiltin(isolate, isolate->weakmap_set(), self,
1219-
arraysize(argv), argv)
1220-
.ToHandle(&result);
1221-
RETURN_ON_FAILED_EXECUTION(WeakMap);
1222-
RETURN_ESCAPED(Local<WeakMap>::Cast(Utils::ToLocal(result)));
1223-
}
1224-
1225-
Local<WeakMap> WeakMap::New(v8::Isolate* isolate) {
1193+
Local<EphemeronTable> EphemeronTable::Set(v8::Isolate* isolate,
1194+
v8::Local<v8::Value> key,
1195+
v8::Local<v8::Value> value) {
1196+
auto self = i::Handle<i::EphemeronHashTable>::cast(Utils::OpenHandle(this));
1197+
i::Handle<i::Object> internal_key = Utils::OpenHandle(*key);
1198+
i::Handle<i::Object> internal_value = Utils::OpenHandle(*value);
1199+
DCHECK(internal_key->IsJSReceiver());
1200+
1201+
i::Handle<i::EphemeronHashTable> result(
1202+
i::EphemeronHashTable::Put(self, internal_key, internal_value));
1203+
1204+
return ToApiHandle<EphemeronTable>(result);
1205+
}
1206+
1207+
Local<EphemeronTable> EphemeronTable::New(v8::Isolate* isolate) {
12261208
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
1227-
LOG_API(i_isolate, WeakMap, New);
12281209
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
1229-
i::Handle<i::JSWeakMap> obj = i_isolate->factory()->NewJSWeakMap();
1230-
return ToApiHandle<WeakMap>(obj);
1210+
i::Handle<i::EphemeronHashTable> table =
1211+
i::EphemeronHashTable::New(i_isolate, 0);
1212+
return ToApiHandle<EphemeronTable>(table);
12311213
}
12321214

1233-
WeakMap* WeakMap::Cast(v8::Value* value) {
1234-
return static_cast<WeakMap*>(value);
1215+
EphemeronTable* EphemeronTable::Cast(v8::Value* value) {
1216+
return static_cast<EphemeronTable*>(value);
12351217
}
12361218

12371219
Local<Value> AccessorPair::getter() {

deps/v8/src/debug/debug-interface.h

+7-9
Original file line numberDiff line numberDiff line change
@@ -570,19 +570,17 @@ class V8_NODISCARD DisableBreakScope {
570570
std::unique_ptr<i::DisableBreak> scope_;
571571
};
572572

573-
class WeakMap : public v8::Object {
573+
class EphemeronTable : public v8::Object {
574574
public:
575-
WeakMap() = delete;
575+
EphemeronTable() = delete;
576576
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT v8::MaybeLocal<v8::Value> Get(
577-
v8::Local<v8::Context> context, v8::Local<v8::Value> key);
578-
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT v8::Maybe<bool> Delete(
579-
v8::Local<v8::Context> context, v8::Local<v8::Value> key);
580-
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT v8::MaybeLocal<WeakMap> Set(
581-
v8::Local<v8::Context> context, v8::Local<v8::Value> key,
577+
v8::Isolate* isolate, v8::Local<v8::Value> key);
578+
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT v8::Local<EphemeronTable> Set(
579+
v8::Isolate* isolate, v8::Local<v8::Value> key,
582580
v8::Local<v8::Value> value);
583581

584-
V8_EXPORT_PRIVATE static Local<WeakMap> New(v8::Isolate* isolate);
585-
V8_INLINE static WeakMap* Cast(Value* obj);
582+
V8_EXPORT_PRIVATE static Local<EphemeronTable> New(v8::Isolate* isolate);
583+
V8_INLINE static EphemeronTable* Cast(Value* obj);
586584
};
587585

588586
/**

deps/v8/src/inspector/inspected-context.cc

+9-6
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,23 @@ void InspectedContext::discardInjectedScript(int sessionId) {
126126
bool InspectedContext::addInternalObject(v8::Local<v8::Object> object,
127127
V8InternalValueType type) {
128128
if (m_internalObjects.IsEmpty()) {
129-
m_internalObjects.Reset(isolate(), v8::debug::WeakMap::New(isolate()));
129+
m_internalObjects.Reset(isolate(),
130+
v8::debug::EphemeronTable::New(isolate()));
130131
}
131-
return !m_internalObjects.Get(isolate())
132-
->Set(m_context.Get(isolate()), object,
133-
v8::Integer::New(isolate(), static_cast<int>(type)))
134-
.IsEmpty();
132+
v8::Local<v8::debug::EphemeronTable> new_map =
133+
m_internalObjects.Get(isolate())->Set(
134+
isolate(), object,
135+
v8::Integer::New(isolate(), static_cast<int>(type)));
136+
m_internalObjects.Reset(isolate(), new_map);
137+
return true;
135138
}
136139

137140
V8InternalValueType InspectedContext::getInternalType(
138141
v8::Local<v8::Object> object) {
139142
if (m_internalObjects.IsEmpty()) return V8InternalValueType::kNone;
140143
v8::Local<v8::Value> typeValue;
141144
if (!m_internalObjects.Get(isolate())
142-
->Get(m_context.Get(isolate()), object)
145+
->Get(isolate(), object)
143146
.ToLocal(&typeValue) ||
144147
!typeValue->IsUint32()) {
145148
return V8InternalValueType::kNone;

deps/v8/src/inspector/inspected-context.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class InspectedContext {
7777
std::unordered_set<int> m_reportedSessionIds;
7878
std::unordered_map<int, std::unique_ptr<InjectedScript>> m_injectedScripts;
7979
WeakCallbackData* m_weakCallbackData;
80-
v8::Global<v8::debug::WeakMap> m_internalObjects;
80+
v8::Global<v8::debug::EphemeronTable> m_internalObjects;
8181
};
8282

8383
} // namespace v8_inspector

deps/v8/src/inspector/v8-inspector-impl.cc

+8-10
Original file line numberDiff line numberDiff line change
@@ -486,19 +486,17 @@ bool V8InspectorImpl::associateExceptionData(v8::Local<v8::Context>,
486486
v8::Context::Scope contextScope(context);
487487
v8::HandleScope handles(m_isolate);
488488
if (m_exceptionMetaData.IsEmpty())
489-
m_exceptionMetaData.Reset(m_isolate, v8::debug::WeakMap::New(m_isolate));
489+
m_exceptionMetaData.Reset(m_isolate,
490+
v8::debug::EphemeronTable::New(m_isolate));
490491

491-
v8::Local<v8::debug::WeakMap> map = m_exceptionMetaData.Get(m_isolate);
492-
v8::MaybeLocal<v8::Value> entry = map->Get(context, exception);
492+
v8::Local<v8::debug::EphemeronTable> map = m_exceptionMetaData.Get(m_isolate);
493+
v8::MaybeLocal<v8::Value> entry = map->Get(m_isolate, exception);
493494
v8::Local<v8::Object> object;
494495
if (entry.IsEmpty() || !entry.ToLocalChecked()->IsObject()) {
495496
object =
496497
v8::Object::New(m_isolate, v8::Null(m_isolate), nullptr, nullptr, 0);
497-
v8::MaybeLocal<v8::debug::WeakMap> new_map =
498-
map->Set(context, exception, object);
499-
if (!new_map.IsEmpty()) {
500-
m_exceptionMetaData.Reset(m_isolate, new_map.ToLocalChecked());
501-
}
498+
m_exceptionMetaData.Reset(m_isolate,
499+
map->Set(m_isolate, exception, object));
502500
} else {
503501
object = entry.ToLocalChecked().As<v8::Object>();
504502
}
@@ -518,8 +516,8 @@ v8::MaybeLocal<v8::Object> V8InspectorImpl::getAssociatedExceptionData(
518516
!exceptionMetaDataContext().ToLocal(&context)) {
519517
return v8::MaybeLocal<v8::Object>();
520518
}
521-
v8::Local<v8::debug::WeakMap> map = m_exceptionMetaData.Get(m_isolate);
522-
auto entry = map->Get(context, exception);
519+
v8::Local<v8::debug::EphemeronTable> map = m_exceptionMetaData.Get(m_isolate);
520+
auto entry = map->Get(m_isolate, exception);
523521
v8::Local<v8::Value> object;
524522
if (!entry.ToLocal(&object) || !object->IsObject())
525523
return v8::MaybeLocal<v8::Object>();

deps/v8/src/inspector/v8-inspector-impl.h

+6-7
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class V8StackTraceImpl;
5656

5757
class V8InspectorImpl : public V8Inspector {
5858
public:
59-
V8InspectorImpl(v8::Isolate*, V8InspectorClient*);
59+
V8_EXPORT_PRIVATE V8InspectorImpl(v8::Isolate*, V8InspectorClient*);
6060
~V8InspectorImpl() override;
6161
V8InspectorImpl(const V8InspectorImpl&) = delete;
6262
V8InspectorImpl& operator=(const V8InspectorImpl&) = delete;
@@ -110,10 +110,9 @@ class V8InspectorImpl : public V8Inspector {
110110
void externalAsyncTaskStarted(const V8StackTraceId& parent) override;
111111
void externalAsyncTaskFinished(const V8StackTraceId& parent) override;
112112

113-
bool associateExceptionData(v8::Local<v8::Context>,
114-
v8::Local<v8::Value> exception,
115-
v8::Local<v8::Name> key,
116-
v8::Local<v8::Value> value) override;
113+
V8_EXPORT_PRIVATE bool associateExceptionData(
114+
v8::Local<v8::Context>, v8::Local<v8::Value> exception,
115+
v8::Local<v8::Name> key, v8::Local<v8::Value> value) override;
117116

118117
unsigned nextExceptionId() { return ++m_lastExceptionId; }
119118
void enableStackCapturingIfNeeded();
@@ -134,7 +133,7 @@ class V8InspectorImpl : public V8Inspector {
134133
int contextGroupId,
135134
const std::function<void(V8InspectorSessionImpl*)>& callback);
136135
int64_t generateUniqueId();
137-
v8::MaybeLocal<v8::Object> getAssociatedExceptionData(
136+
V8_EXPORT_PRIVATE v8::MaybeLocal<v8::Object> getAssociatedExceptionData(
138137
v8::Local<v8::Value> exception);
139138

140139
class EvaluateScope {
@@ -160,7 +159,7 @@ class V8InspectorImpl : public V8Inspector {
160159
std::unique_ptr<V8Debugger> m_debugger;
161160
v8::Global<v8::Context> m_regexContext;
162161
v8::Global<v8::Context> m_exceptionMetaDataContext;
163-
v8::Global<v8::debug::WeakMap> m_exceptionMetaData;
162+
v8::Global<v8::debug::EphemeronTable> m_exceptionMetaData;
164163
int m_capturingStackTracesCount;
165164
unsigned m_lastExceptionId;
166165
int m_lastContextId;

0 commit comments

Comments
 (0)