Commit c4cfeada authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[explicit isolates] Eliminate most GetIsolates in snapshot/

Use a passed in Isolate/Heap directly rather than using GetIsolate() on
HeapObjects which may not in future be tied to an isolate.

Bug: v8:7786
Change-Id: I89d8706544aa135049434cf20c4e1308474c678b
Reviewed-on: https://chromium-review.googlesource.com/1089334Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53569}
parent 395a55b3
......@@ -268,7 +268,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
if (sanity_check_result != SerializedCodeData::CHECK_SUCCESS) {
if (FLAG_profile_deserialization) PrintF("[Cached code failed check]\n");
DCHECK(cached_data->rejected());
source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(
isolate->counters()->code_cache_reject_reason()->AddSample(
sanity_check_result);
return MaybeHandle<SharedFunctionInfo>();
}
......
......@@ -161,11 +161,11 @@ HeapObject* Deserializer<AllocatorT>::PostProcessNewObject(HeapObject* obj,
if (canonical != nullptr) return canonical;
new_internalized_strings_.push_back(handle(string));
new_internalized_strings_.push_back(handle(string, isolate_));
return string;
}
} else if (obj->IsScript()) {
new_scripts_.push_back(handle(Script::cast(obj)));
new_scripts_.push_back(handle(Script::cast(obj), isolate_));
} else {
DCHECK(CanBeDeferred(obj));
}
......
......@@ -79,7 +79,7 @@ MaybeHandle<HeapObject> ObjectDeserializer::Deserialize(Isolate* isolate) {
VisitRootPointer(Root::kPartialSnapshotCache, nullptr, &root);
DeserializeDeferredObjects();
FlushICacheForNewCodeObjectsAndRecordEmbeddedObjects();
result = Handle<HeapObject>(HeapObject::cast(root));
result = handle(HeapObject::cast(root), isolate);
Rehash();
allocator()->RegisterDeserializedObjectsForBlackAllocation();
}
......
......@@ -576,12 +576,12 @@ void Serializer<
// TODO(all): replace this with proper iteration of weak slots in serializer.
class UnlinkWeakNextScope {
public:
explicit UnlinkWeakNextScope(HeapObject* object) : object_(nullptr) {
explicit UnlinkWeakNextScope(Heap* heap, HeapObject* object)
: object_(nullptr) {
if (object->IsAllocationSite()) {
object_ = object;
next_ = AllocationSite::cast(object)->weak_next();
AllocationSite::cast(object)->set_weak_next(
object->GetHeap()->undefined_value());
AllocationSite::cast(object)->set_weak_next(heap->undefined_value());
}
}
......@@ -695,7 +695,7 @@ void Serializer<AllocatorT>::ObjectSerializer::SerializeDeferred() {
template <class AllocatorT>
void Serializer<AllocatorT>::ObjectSerializer::SerializeContent(Map* map,
int size) {
UnlinkWeakNextScope unlink_weak_next(object_);
UnlinkWeakNextScope unlink_weak_next(serializer_->isolate()->heap(), object_);
if (object_->IsCode()) {
// For code objects, output raw bytes first.
OutputCode(size);
......
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