Commit eadd2c5a authored by Marja Hölttä's avatar Marja Hölttä Committed by V8 LUCI CQ

Revert "[rab/gsab] Fix ObjectSerializer"

This reverts commit ff84cd04.

Reason for revert: This CL had a commit from another branch
which was supposed to land as a part of that CL
( https://chromium-review.googlesource.com/c/v8/v8/+/3672415/1 ),
not this one.

Going to reland a cleaned up version.

Original change's description:
> [rab/gsab] Fix ObjectSerializer
>
> Without this fix, the byte length for GSABs is probably serialized
> wrong. A failing test is omitted since it would be pretty involved
> (currently this code path is only hit with --stress-snapshot).
>
> Bug: v8:11111
> Change-Id: If7df98263cec9f82766c2fa6ba095b98b53a6fde
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3657431
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Commit-Queue: Marja Hölttä <marja@chromium.org>
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Reviewed-by: Shu-yu Guo <syg@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#80780}

Bug: v8:11111
Change-Id: I5fc3384484f6a8d2d6e40a404da0bf04167abc1d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3678838
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80845}
parent c14b3e4d
......@@ -1482,6 +1482,8 @@ bool Shell::ExecuteWebSnapshot(Isolate* isolate, const char* file_name) {
PerIsolateData* data = PerIsolateData::Get(isolate);
Local<Context> realm = data->realms_[data->realm_current_].Get(isolate);
Context::Scope context_scope(realm);
TryCatch try_catch(isolate);
bool success = false;
std::string absolute_path = NormalizePath(file_name, GetWorkingDirectory());
......@@ -1489,29 +1491,20 @@ bool Shell::ExecuteWebSnapshot(Isolate* isolate, const char* file_name) {
std::unique_ptr<uint8_t[]> snapshot_data(
reinterpret_cast<uint8_t*>(ReadChars(absolute_path.c_str(), &length)));
if (length == 0) {
TryCatch try_catch(isolate);
isolate->ThrowError("Could not read the web snapshot file");
CHECK(try_catch.HasCaught());
ReportException(isolate, &try_catch);
return false;
} else {
for (int r = 0; r < DeserializationRunCount(); ++r) {
bool skip_exports = r > 0;
i::WebSnapshotDeserializer deserializer(isolate, snapshot_data.get(),
static_cast<size_t>(length));
if (!deserializer.Deserialize({}, skip_exports)) {
// d8 is calling into the internal APIs which won't do
// ReportPendingMessages in all error paths (it's supposed to be done at
// the API boundary). Call it here.
auto i_isolate = reinterpret_cast<i::Isolate*>(isolate);
if (i_isolate->has_pending_exception()) {
i_isolate->ReportPendingMessages();
}
return false;
}
success = deserializer.Deserialize({}, skip_exports);
}
}
return true;
if (!success) {
CHECK(try_catch.HasCaught());
ReportException(isolate, &try_catch);
}
return success;
}
// Treat every line as a JSON value and parse it.
......
......@@ -513,14 +513,13 @@ void Serializer::ObjectSerializer::SerializeJSTypedArray() {
if (typed_array.is_on_heap()) {
typed_array.RemoveExternalPointerCompensationForSerialization(isolate());
} else {
if (!typed_array.IsDetachedOrOutOfBounds()) {
if (!typed_array.WasDetached()) {
// Explicitly serialize the backing store now.
JSArrayBuffer buffer = JSArrayBuffer::cast(typed_array.buffer());
// We cannot store byte_length or max_byte_length larger than int32
// range in the snapshot.
size_t byte_length_size = buffer.GetByteLength();
CHECK_LE(byte_length_size, size_t{std::numeric_limits<int32_t>::max()});
int32_t byte_length = static_cast<int32_t>(byte_length_size);
CHECK_LE(buffer.byte_length(), std::numeric_limits<int32_t>::max());
int32_t byte_length = static_cast<int32_t>(buffer.byte_length());
Maybe<int32_t> max_byte_length = Nothing<int32_t>();
if (buffer.is_resizable()) {
CHECK_LE(buffer.max_byte_length(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment