Revert of [snapshot] full setup delegate should also be able to deserialize. (patchset #2 id:20001 of https://codereview.chromium.org/2840493002/ )

Reason for revert:
prime suspect for https://bugs.chromium.org/p/chromium/issues/detail?id=714976

Original issue's description:
> [snapshot] full setup delegate should also be able to deserialize.
>
> Also move the responsibility of marking builtins as initialized
> to the deserializer.
>
> R=jkummerow@chromium.org
>
> Review-Url: https://codereview.chromium.org/2840493002
> Cr-Commit-Position: refs/heads/master@{#44802}
> Committed: a2b3a2fbc5

TBR=jkummerow@chromium.org,yangguo@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.

BUG=chromium:714976

Review-Url: https://codereview.chromium.org/2841993002
Cr-Commit-Position: refs/heads/master@{#44870}
This commit is contained in:
hablich 2017-04-25 12:54:00 -07:00 committed by Commit bot
parent 46d0e4818a
commit 6d9ca97cd2
6 changed files with 25 additions and 19 deletions

View File

@ -90,12 +90,6 @@ class Builtins {
bool is_initialized() const { return initialized_; }
// Used by SetupIsolateDelegate and Deserializer.
void MarkInitialized() {
DCHECK(!initialized_);
initialized_ = true;
}
MUST_USE_RESULT static MaybeHandle<Object> InvokeApiFunction(
Isolate* isolate, bool is_construct, Handle<HeapObject> function,
Handle<Object> receiver, int argc, Handle<Object> args[],
@ -111,6 +105,11 @@ class Builtins {
private:
Builtins();
// Used by SetupIsolateDelegate.
void MarkInitialized() {
DCHECK(!initialized_);
initialized_ = true;
}
static void Generate_CallFunction(MacroAssembler* masm,
ConvertReceiverMode mode,

View File

@ -16,6 +16,7 @@ void SetupIsolateDelegate::SetupBuiltins(Isolate* isolate,
bool create_heap_objects) {
DCHECK(!create_heap_objects);
// No actual work to be done; builtins will be deserialized from the snapshot.
isolate->builtins()->MarkInitialized();
}
void SetupIsolateDelegate::SetupInterpreter(

View File

@ -5,7 +5,6 @@
#include "src/setup-isolate.h"
#include "src/base/logging.h"
#include "src/interpreter/interpreter.h"
#include "src/interpreter/setup-interpreter.h"
#include "src/isolate.h"
@ -14,20 +13,30 @@ namespace internal {
void SetupIsolateDelegate::SetupBuiltins(Isolate* isolate,
bool create_heap_objects) {
#ifdef V8_GYP_BUILD
// Compatibility hack to keep the deprecated GYP build working.
if (create_heap_objects) {
SetupBuiltinsInternal(isolate);
} else {
DCHECK(isolate->snapshot_available());
isolate->builtins()->MarkInitialized();
}
return;
#endif
DCHECK(create_heap_objects);
SetupBuiltinsInternal(isolate);
}
void SetupIsolateDelegate::SetupInterpreter(
interpreter::Interpreter* interpreter, bool create_heap_objects) {
#ifdef V8_GYP_BUILD
// Compatibility hack to keep the deprecated GYP build working.
if (create_heap_objects) {
interpreter::SetupInterpreter::InstallBytecodeHandlers(interpreter);
} else {
DCHECK(interpreter->IsDispatchTableInitialized());
}
return;
#endif
DCHECK(create_heap_objects);
interpreter::SetupInterpreter::InstallBytecodeHandlers(interpreter);
}
} // namespace internal

View File

@ -16,12 +16,11 @@ class Interpreter;
// This class is an abstraction layer around initialization of components
// that are either deserialized from the snapshot or generated from scratch.
// Currently this includes builtins and interpreter bytecode handlers.
// There are two implementations to choose from at link time:
// There are three implementations to choose from (at link time):
// - setup-isolate-deserialize.cc: always loads things from snapshot.
// - setup-isolate-full.cc: loads from snapshot or bootstraps from scratch,
// controlled by the |create_heap_objects| flag.
// For testing, the implementation in setup-isolate-for-tests.cc can be chosen
// to force the behavior of setup-isolate-full.cc at runtime.
// - setup-isolate-full.cc: always generates things.
// - setup-isolate-for-tests.cc: does the one or the other, controlled by
// the |create_heap_objects| flag.
//
// The actual implementations of generation of builtins and handlers is in
// setup-builtins-internal.cc and setup-interpreter-internal.cc, and is

View File

@ -92,8 +92,6 @@ void Deserializer::Deserialize(Isolate* isolate) {
DCHECK(isolate_->handle_scope_implementer()->blocks()->is_empty());
// Partial snapshot cache is not yet populated.
DCHECK(isolate_->partial_snapshot_cache()->is_empty());
// Builtins are not yet created.
DCHECK(!isolate_->builtins()->is_initialized());
{
DisallowHeapAllocation no_gc;
@ -123,8 +121,6 @@ void Deserializer::Deserialize(Isolate* isolate) {
LOG_CODE_EVENT(isolate_, LogCodeObjects());
LOG_CODE_EVENT(isolate_, LogBytecodeHandlers());
LOG_CODE_EVENT(isolate_, LogCompiledFunctions());
isolate_->builtins()->MarkInitialized();
}
MaybeHandle<Object> Deserializer::DeserializePartial(

View File

@ -62,6 +62,8 @@ class Snapshot : public AllStatic {
size_t context_index,
v8::DeserializeEmbedderFieldsCallback embedder_fields_deserializer);
static bool HaveASnapshotToStartFrom(Isolate* isolate);
static bool HasContextSnapshot(Isolate* isolate, size_t index);
static bool EmbedsScript(Isolate* isolate);