diff options
author | Michaël Zasso <targos@protonmail.com> | 2021-03-12 08:24:20 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-03-15 15:54:50 +0100 |
commit | 732ad99e47bae5deffa3a22d2ebe5500284106f0 (patch) | |
tree | 759a6b072accf188f03c74a84e8256fe92f1925c /deps/v8/src/inspector/value-mirror.cc | |
parent | 802b3e7cf9a5074a72bec75cf1c46758b81e04b1 (diff) | |
download | node-new-732ad99e47bae5deffa3a22d2ebe5500284106f0.tar.gz |
deps: update V8 to 9.0.257.11
PR-URL: https://github.com/nodejs/node/pull/37587
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/src/inspector/value-mirror.cc')
-rw-r--r-- | deps/v8/src/inspector/value-mirror.cc | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/deps/v8/src/inspector/value-mirror.cc b/deps/v8/src/inspector/value-mirror.cc index 0b76d9ee22..62744a8a9c 100644 --- a/deps/v8/src/inspector/value-mirror.cc +++ b/deps/v8/src/inspector/value-mirror.cc @@ -43,26 +43,6 @@ V8InternalValueType v8InternalValueTypeFrom(v8::Local<v8::Context> context, return inspectedContext->getInternalType(value.As<v8::Object>()); } -template <typename ResultType> -ResultType unpackWasmValue(v8::Local<v8::Context> context, - v8::Local<v8::Array> array) { - ResultType result; - constexpr int kSize = sizeof(result); - uint8_t buffer[kSize]; - for (int i = 0; i < kSize; i++) { - v8::Local<v8::Int32> i32 = - array->Get(context, i).ToLocalChecked().As<v8::Int32>(); - buffer[i] = static_cast<uint8_t>(i32->Value()); - } - memcpy(&result, buffer, kSize); - return result; -} - -// Partial list of Wasm's ValueType, copied here to avoid including internal -// header. Using an unscoped enumeration here to allow implicit conversions from -// int. Keep in sync with ValueType::Kind in wasm/value-type.h. -enum WasmValueType { kStmt, kI32, kI64, kF32, kF64, kS128, kExternRef }; - Response toProtocolValue(v8::Local<v8::Context> context, v8::Local<v8::Value> value, int maxDepth, std::unique_ptr<protocol::Value>* result) { @@ -813,6 +793,8 @@ bool getPropertiesForPreview(v8::Local<v8::Context> context, if (object->IsArray() || isArrayLike(context, object, &length) || object->IsStringObject()) { blocklist.push_back("length"); + } else if (v8::debug::WasmValueObject::IsWasmValueObject(object)) { + blocklist.push_back("type"); } else { auto clientSubtype = clientFor(context)->valueSubtype(object); if (clientSubtype && toString16(clientSubtype->string()) == "array") { @@ -1227,14 +1209,24 @@ bool ValueMirror::getProperties(v8::Local<v8::Context> context, bool formatAccessorsAsProperties = clientFor(context)->formatAccessorsAsProperties(object); - for (auto iterator = v8::debug::PropertyIterator::Create(object); - !iterator->Done(); iterator->Advance()) { + auto iterator = v8::debug::PropertyIterator::Create(context, object); + if (!iterator) { + CHECK(tryCatch.HasCaught()); + return false; + } + while (!iterator->Done()) { bool isOwn = iterator->is_own(); if (!isOwn && ownProperties) break; v8::Local<v8::Name> v8Name = iterator->name(); v8::Maybe<bool> result = set->Has(context, v8Name); if (result.IsNothing()) return false; - if (result.FromJust()) continue; + if (result.FromJust()) { + if (!iterator->Advance().FromMaybe(false)) { + CHECK(tryCatch.HasCaught()); + return false; + } + continue; + } if (!set->Add(context, v8Name).ToLocal(&set)) return false; String16 name; @@ -1330,6 +1322,11 @@ bool ValueMirror::getProperties(v8::Local<v8::Context> context, std::move(symbolMirror), std::move(exceptionMirror)}; if (!accumulator->Add(std::move(mirror))) return true; + + if (!iterator->Advance().FromMaybe(false)) { + CHECK(tryCatch.HasCaught()); + return false; + } } if (!shouldSkipProto && ownProperties && !object->IsProxy() && !accessorPropertiesOnly) { @@ -1696,6 +1693,13 @@ std::unique_ptr<ValueMirror> ValueMirror::create(v8::Local<v8::Context> context, descriptionForCollection( isolate, memory, memory->Buffer()->ByteLength() / kWasmPageSize)); } + if (v8::debug::WasmValueObject::IsWasmValueObject(value)) { + v8::Local<v8::debug::WasmValueObject> object = + value.As<v8::debug::WasmValueObject>(); + return std::make_unique<ObjectMirror>( + value, RemoteObject::SubtypeEnum::Wasmvalue, + descriptionForObject(isolate, object)); + } V8InternalValueType internalType = v8InternalValueTypeFrom(context, value.As<v8::Object>()); if (value->IsArray() && internalType == V8InternalValueType::kScopeList) { |