V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
setup-isolate.h
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_SETUP_ISOLATE_H_
6 #define V8_SETUP_ISOLATE_H_
7 
8 namespace v8 {
9 namespace internal {
10 
11 class Builtins;
12 class Code;
13 class Heap;
14 class Isolate;
15 
16 namespace interpreter {
17 class Interpreter;
18 } // namespace interpreter
19 
20 // This class is an abstraction layer around initialization of components
21 // that are either deserialized from the snapshot or generated from scratch.
22 // Currently this includes builtins and interpreter bytecode handlers.
23 // There are two implementations to choose from at link time:
24 // - setup-isolate-deserialize.cc: always loads things from snapshot.
25 // - setup-isolate-full.cc: loads from snapshot or bootstraps from scratch,
26 // controlled by the |create_heap_objects| flag.
27 // For testing, the implementation in setup-isolate-for-tests.cc can be chosen
28 // to force the behavior of setup-isolate-full.cc at runtime.
29 //
30 // The actual implementations of generation of builtins and handlers is in
31 // setup-builtins-internal.cc and setup-interpreter-internal.cc, and is
32 // linked in by the latter two Delegate implementations.
34  public:
35  explicit SetupIsolateDelegate(bool create_heap_objects)
36  : create_heap_objects_(create_heap_objects) {}
37  virtual ~SetupIsolateDelegate() = default;
38 
39  virtual void SetupBuiltins(Isolate* isolate);
40 
41  virtual bool SetupHeap(Heap* heap);
42 
43  protected:
44  static void SetupBuiltinsInternal(Isolate* isolate);
45  static void AddBuiltin(Builtins* builtins, int index, Code code);
46  static void PopulateWithPlaceholders(Isolate* isolate);
47  static void ReplacePlaceholders(Isolate* isolate);
48 
49  static bool SetupHeapInternal(Heap* heap);
50 
51  const bool create_heap_objects_;
52 };
53 
54 } // namespace internal
55 } // namespace v8
56 
57 #endif // V8_SETUP_ISOLATE_H_
Definition: libplatform.h:13