deps: cherry-pick ff0a9793334 from upstream V8 · nodejs/node@e56716e · GitHub
Skip to content

Commit e56716e

Browse files
addaleaxMylesBorins
authored andcommitted
deps: cherry-pick ff0a9793334 from upstream V8
Original commit message: [api] Expose PreviewEntries as public API Turn `debug::EntriesPreview` into a public API. This is a straightforward approach to addressing #20409 (not relying on functionality behind `--allow-natives-syntax`) in Node.js. Refs: v8/v8@ff0a979 PR-URL: #20719 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 4b64c84 commit e56716e

4 files changed

Lines changed: 23 additions & 15 deletions

File tree

deps/v8/include/v8.h

Lines changed: 11 additions & 0 deletions

deps/v8/src/api.cc

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9526,21 +9526,20 @@ int debug::EstimatedValueSize(Isolate* v8_isolate, v8::Local<v8::Value> value) {
95269526
return i::Handle<i::HeapObject>::cast(object)->Size();
95279527
}
95289528

9529-
v8::MaybeLocal<v8::Array> debug::EntriesPreview(Isolate* v8_isolate,
9530-
v8::Local<v8::Value> value,
9531-
bool* is_key_value) {
9532-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
9533-
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
9534-
if (value->IsMap()) {
9529+
v8::MaybeLocal<v8::Array> v8::Object::PreviewEntries(bool* is_key_value) {
9530+
if (IsMap()) {
95359531
*is_key_value = true;
9536-
return value.As<Map>()->AsArray();
9532+
return Map::Cast(this)->AsArray();
95379533
}
9538-
if (value->IsSet()) {
9534+
if (IsSet()) {
95399535
*is_key_value = false;
9540-
return value.As<Set>()->AsArray();
9536+
return Set::Cast(this)->AsArray();
95419537
}
95429538

9543-
i::Handle<i::Object> object = Utils::OpenHandle(*value);
9539+
i::Handle<i::JSReceiver> object = Utils::OpenHandle(this);
9540+
i::Isolate* isolate = object->GetIsolate();
9541+
Isolate* v8_isolate = reinterpret_cast<Isolate*>(isolate);
9542+
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
95449543
if (object->IsJSWeakCollection()) {
95459544
*is_key_value = object->IsJSWeakMap();
95469545
return Utils::ToLocal(i::JSWeakCollection::GetEntries(

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,6 @@ void ResetBlackboxedStateCache(Isolate* isolate,
204204

205205
int EstimatedValueSize(Isolate* isolate, v8::Local<v8::Value> value);
206206

207-
v8::MaybeLocal<v8::Array> EntriesPreview(Isolate* isolate,
208-
v8::Local<v8::Value> value,
209-
bool* is_key_value);
210-
211207
enum Builtin {
212208
kObjectKeys,
213209
kObjectGetPrototypeOf,

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

Lines changed: 3 additions & 1 deletion

0 commit comments

Comments
 (0)