OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 namespace v8 { | 5 namespace v8 { |
6 namespace internal { | 6 namespace internal { |
7 | 7 |
8 class Builtins; | 8 class Builtins; |
9 class Code; | 9 class Code; |
10 class Isolate; | 10 class Isolate; |
11 | 11 |
12 namespace interpreter { | 12 namespace interpreter { |
13 class Interpreter; | 13 class Interpreter; |
14 } // namespace interpreter | 14 } // namespace interpreter |
15 | 15 |
16 // This class is an abstraction layer around initialization of components | 16 // This class is an abstraction layer around initialization of components |
17 // that are either deserialized from the snapshot or generated from scratch. | 17 // that are either deserialized from the snapshot or generated from scratch. |
18 // Currently this includes builtins and interpreter bytecode handlers. | 18 // Currently this includes builtins and interpreter bytecode handlers. |
19 // There are three implementations to choose from (at link time): | 19 // There are two implementations to choose from at link time: |
20 // - setup-isolate-deserialize.cc: always loads things from snapshot. | 20 // - setup-isolate-deserialize.cc: always loads things from snapshot. |
21 // - setup-isolate-full.cc: always generates things. | 21 // - setup-isolate-full.cc: loads from snapshot or bootstraps from scratch, |
22 // - setup-isolate-for-tests.cc: does the one or the other, controlled by | 22 // controlled by the |create_heap_objects| flag. |
23 // the |create_heap_objects| flag. | 23 // For testing, the implementation in setup-isolate-for-tests.cc can be chosen |
| 24 // to force the behavior of setup-isolate-full.cc at runtime. |
24 // | 25 // |
25 // The actual implementations of generation of builtins and handlers is in | 26 // The actual implementations of generation of builtins and handlers is in |
26 // setup-builtins-internal.cc and setup-interpreter-internal.cc, and is | 27 // setup-builtins-internal.cc and setup-interpreter-internal.cc, and is |
27 // linked in by the latter two Delegate implementations. | 28 // linked in by the latter two Delegate implementations. |
28 class SetupIsolateDelegate { | 29 class SetupIsolateDelegate { |
29 public: | 30 public: |
30 SetupIsolateDelegate() {} | 31 SetupIsolateDelegate() {} |
31 virtual ~SetupIsolateDelegate() {} | 32 virtual ~SetupIsolateDelegate() {} |
32 | 33 |
33 virtual void SetupBuiltins(Isolate* isolate, bool create_heap_objects); | 34 virtual void SetupBuiltins(Isolate* isolate, bool create_heap_objects); |
34 | 35 |
35 virtual void SetupInterpreter(interpreter::Interpreter* interpreter, | 36 virtual void SetupInterpreter(interpreter::Interpreter* interpreter, |
36 bool create_heap_objects); | 37 bool create_heap_objects); |
37 | 38 |
38 protected: | 39 protected: |
39 static void SetupBuiltinsInternal(Isolate* isolate); | 40 static void SetupBuiltinsInternal(Isolate* isolate); |
40 static void AddBuiltin(Builtins* builtins, int index, Code* code); | 41 static void AddBuiltin(Builtins* builtins, int index, Code* code); |
41 }; | 42 }; |
42 | 43 |
43 } // namespace internal | 44 } // namespace internal |
44 } // namespace v8 | 45 } // namespace v8 |
OLD | NEW |