Commit d2acccc1 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

Remove v8_context_snapshot.bin determinism hack.

Reverts parts of
https://chromium-review.googlesource.com/c/chromium/src/+/1293791 that should
no longer be needed after https://chromium-review.googlesource.com/c/1304441

Bug: 870584
Change-Id: I76fa59eb5c88c34cd222f2a40c983a4f4e615b27
Reviewed-on: https://chromium-review.googlesource.com/c/1328823Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606859}
parent 7669a668
......@@ -91,9 +91,6 @@ enum class InternalFieldType : uint8_t {
kHTMLDocumentObject,
};
constexpr uintptr_t SerializedHTMLDocumentHack =
(uintptr_t)((unsigned)InternalFieldType::kHTMLDocumentType << 3u);
const WrapperTypeInfo* FieldTypeToWrapperTypeInfo(InternalFieldType type) {
switch (type) {
case InternalFieldType::kNone:
......@@ -326,15 +323,13 @@ v8::StartupData V8ContextSnapshot::SerializeInternalField(
InternalFieldType field_type = InternalFieldType::kNone;
const WrapperTypeInfo* wrapper_type = ToWrapperTypeInfo(object);
if (kV8DOMWrapperObjectIndex == index) {
if ((uintptr_t)wrapper_type == SerializedHTMLDocumentHack ||
blink::V8HTMLDocument::wrapperTypeInfo.Equals(wrapper_type)) {
if (blink::V8HTMLDocument::wrapperTypeInfo.Equals(wrapper_type)) {
field_type = InternalFieldType::kHTMLDocumentObject;
}
DCHECK_LE(kV8DefaultWrapperInternalFieldCount,
object->InternalFieldCount());
} else if (kV8DOMWrapperTypeIndex == index) {
if ((uintptr_t)wrapper_type == SerializedHTMLDocumentHack ||
blink::V8HTMLDocument::wrapperTypeInfo.Equals(wrapper_type)) {
if (blink::V8HTMLDocument::wrapperTypeInfo.Equals(wrapper_type)) {
field_type = InternalFieldType::kHTMLDocumentType;
} else if (blink::V8Document::wrapperTypeInfo.Equals(wrapper_type)) {
field_type = InternalFieldType::kDocumentType;
......@@ -496,12 +491,8 @@ void V8ContextSnapshot::TakeSnapshotForWorld(v8::SnapshotCreator* creator,
v8::Local<v8::Object> document_wrapper = CreatePlainWrapper(
isolate, world, context, &V8HTMLDocument::wrapperTypeInfo);
int indices[] = {kV8DOMWrapperObjectIndex, kV8DOMWrapperTypeIndex};
// TODO(https://crbug.com/870584): Once v8 no longer writes pointers
// that have explicit serialization code into the snapshot, put
// const_cast<WrapperTypeInfo*>(&V8HTMLDocument::wrapperTypeInfo)
// here and remove the SerializedHTMLDocumentHack instances in
// SerializeEmbedderFields().
void* values[] = {nullptr, (void*)SerializedHTMLDocumentHack};
void* values[] = {nullptr, const_cast<WrapperTypeInfo*>(
&V8HTMLDocument::wrapperTypeInfo)};
document_wrapper->SetAlignedPointerInInternalFields(base::size(indices),
indices, values);
......
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