Harden isolate initialization

In the case of a corrupted snapshot we fall back to initializing the isolate
from scratch. Howver, we don't ship the full SetupIsolateDelegate. This causes
spurious failures during later initialization.

This CL mostly turns the DCHECKs in SetupIsolateDelegate into hard CHECKs making
it easier to spot these kind of failures.


Bug: chromium:767846
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: Ibe8a5beece27433439b1b09412f6110be703ff86
Reviewed-on: https://chromium-review.googlesource.com/779189
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49533}
This commit is contained in:
Camillo Bruni 2017-11-20 14:29:20 +01:00 committed by Commit Bot
parent ffd36179b9
commit 82ca51467f
3 changed files with 9 additions and 6 deletions

View File

@ -8609,6 +8609,9 @@ Isolate* IsolateNewImpl(internal::Isolate* isolate,
// TODO(jochen): Once we got rid of Isolate::Current(), we can remove this.
Isolate::Scope isolate_scope(v8_isolate);
if (params.entry_hook || !i::Snapshot::Initialize(isolate)) {
// If snapshot data was provided and we failed to deserialize it must
// have been corrupted.
CHECK_NULL(isolate->snapshot_blob());
base::ElapsedTimer timer;
if (i::FLAG_profile_deserialization) timer.Start();
isolate->Init(nullptr);

View File

@ -13,7 +13,7 @@ namespace v8 {
namespace internal {
void SetupIsolateDelegate::SetupBuiltins(Isolate* isolate) {
DCHECK(!create_heap_objects_);
CHECK(!create_heap_objects_);
// No actual work to be done; builtins will be deserialized from the snapshot.
}
@ -27,11 +27,11 @@ void SetupIsolateDelegate::SetupInterpreter(
<< std::endl;
}
#endif
DCHECK(interpreter->IsDispatchTableInitialized());
CHECK(interpreter->IsDispatchTableInitialized());
}
bool SetupIsolateDelegate::SetupHeap(Heap* heap) {
DCHECK(!create_heap_objects_);
CHECK(!create_heap_objects_);
// No actual work to be done; heap will be deserialized from the snapshot.
return true;
}

View File

@ -17,7 +17,7 @@ void SetupIsolateDelegate::SetupBuiltins(Isolate* isolate) {
if (create_heap_objects_) {
SetupBuiltinsInternal(isolate);
} else {
DCHECK(isolate->snapshot_available());
CHECK(isolate->snapshot_available());
}
}
@ -26,7 +26,7 @@ void SetupIsolateDelegate::SetupInterpreter(
if (create_heap_objects_) {
interpreter::SetupInterpreter::InstallBytecodeHandlers(interpreter);
} else {
DCHECK(interpreter->IsDispatchTableInitialized());
CHECK(interpreter->IsDispatchTableInitialized());
}
}
@ -34,7 +34,7 @@ bool SetupIsolateDelegate::SetupHeap(Heap* heap) {
if (create_heap_objects_) {
return SetupHeapInternal(heap);
} else {
DCHECK(heap->isolate()->snapshot_available());
CHECK(heap->isolate()->snapshot_available());
return true;
}
}