Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: src/snapshot/serialize.cc

Issue 1312763002: Deserializer: flush code cache while code pointers are still valid. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/snapshot/serialize.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/serialize.cc
diff --git a/src/snapshot/serialize.cc b/src/snapshot/serialize.cc
index fceec47fae6daab3b74a9896905c0f3d552c1cb5..5d3f624da8b7d9e56690588aa592f12dd367012a 100644
--- a/src/snapshot/serialize.cc
+++ b/src/snapshot/serialize.cc
@@ -500,16 +500,19 @@ void Deserializer::DecodeReservation(
}
-void Deserializer::FlushICacheForNewCodeObjects() {
- if (!deserializing_user_code_) {
- // The entire isolate is newly deserialized. Simply flush all code pages.
- PageIterator it(isolate_->heap()->code_space());
- while (it.has_next()) {
- Page* p = it.next();
- CpuFeatures::FlushICache(p->area_start(),
- p->area_end() - p->area_start());
- }
+void Deserializer::FlushICacheForNewIsolate() {
+ DCHECK(!deserializing_user_code_);
+ // The entire isolate is newly deserialized. Simply flush all code pages.
+ PageIterator it(isolate_->heap()->code_space());
+ while (it.has_next()) {
+ Page* p = it.next();
+ CpuFeatures::FlushICache(p->area_start(), p->area_end() - p->area_start());
}
+}
+
+
+void Deserializer::FlushICacheForNewCodeObjects() {
+ DCHECK(deserializing_user_code_);
for (Code* code : new_code_objects_) {
CpuFeatures::FlushICache(code->instruction_start(),
code->instruction_size());
@@ -557,6 +560,7 @@ void Deserializer::Deserialize(Isolate* isolate) {
isolate_->heap()->RepairFreeListsAfterDeserialization();
isolate_->heap()->IterateWeakRoots(this, VISIT_ALL);
DeserializeDeferredObjects();
+ FlushICacheForNewIsolate();
}
isolate_->heap()->set_native_contexts_list(
@@ -574,8 +578,6 @@ void Deserializer::Deserialize(Isolate* isolate) {
ExtraNatives::UpdateSourceCache(isolate_->heap());
CodeStubNatives::UpdateSourceCache(isolate_->heap());
- FlushICacheForNewCodeObjects();
-
// Issue code events for newly deserialized code objects.
LOG_CODE_EVENT(isolate_, LogCodeObjects());
LOG_CODE_EVENT(isolate_, LogCompiledFunctions());
@@ -631,6 +633,7 @@ MaybeHandle<SharedFunctionInfo> Deserializer::DeserializeCode(
Object* root;
VisitPointer(&root);
DeserializeDeferredObjects();
+ FlushICacheForNewCodeObjects();
result = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(root));
}
CommitPostProcessedObjects(isolate);
@@ -2626,7 +2629,6 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
if (FLAG_profile_deserialization) PrintF("[Deserializing failed]\n");
return MaybeHandle<SharedFunctionInfo>();
}
- deserializer.FlushICacheForNewCodeObjects();
if (FLAG_profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
« no previous file with comments | « src/snapshot/serialize.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698