OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef V8_BOOTSTRAPPER_H_ | 5 #ifndef V8_BOOTSTRAPPER_H_ |
6 #define V8_BOOTSTRAPPER_H_ | 6 #define V8_BOOTSTRAPPER_H_ |
7 | 7 |
8 #include "src/factory.h" | 8 #include "src/factory.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 cache_->set(length + 1, *shared); | 54 cache_->set(length + 1, *shared); |
55 Script::cast(shared->script())->set_type(type_); | 55 Script::cast(shared->script())->set_type(type_); |
56 } | 56 } |
57 | 57 |
58 private: | 58 private: |
59 Script::Type type_; | 59 Script::Type type_; |
60 FixedArray* cache_; | 60 FixedArray* cache_; |
61 DISALLOW_COPY_AND_ASSIGN(SourceCodeCache); | 61 DISALLOW_COPY_AND_ASSIGN(SourceCodeCache); |
62 }; | 62 }; |
63 | 63 |
64 enum ContextType { FULL_CONTEXT, THIN_CONTEXT, DEBUG_CONTEXT }; | 64 enum GlobalContextType { FULL_CONTEXT, THIN_CONTEXT, DEBUG_CONTEXT }; |
65 | 65 |
66 // The Boostrapper is the public interface for creating a JavaScript global | 66 // The Boostrapper is the public interface for creating a JavaScript global |
67 // context. | 67 // context. |
68 class Bootstrapper final { | 68 class Bootstrapper final { |
69 public: | 69 public: |
70 static void InitializeOncePerProcess(); | 70 static void InitializeOncePerProcess(); |
71 static void TearDownExtensions(); | 71 static void TearDownExtensions(); |
72 | 72 |
73 // Requires: Heap::SetUp has been called. | 73 // Requires: Heap::SetUp has been called. |
74 void Initialize(bool create_heap_objects); | 74 void Initialize(bool create_heap_objects); |
75 void TearDown(); | 75 void TearDown(); |
76 | 76 |
77 // Creates a JavaScript Global Context with initial object graph. | 77 // Creates a JavaScript Global Context with initial object graph. |
78 // The returned value is a global handle casted to V8Environment*. | 78 // The returned value is a global handle casted to V8Environment*. |
79 Handle<Context> CreateEnvironment( | 79 Handle<Context> CreateEnvironment( |
80 MaybeHandle<JSGlobalProxy> maybe_global_proxy, | 80 MaybeHandle<JSGlobalProxy> maybe_global_proxy, |
81 v8::Local<v8::ObjectTemplate> global_object_template, | 81 v8::Local<v8::ObjectTemplate> global_object_template, |
82 v8::ExtensionConfiguration* extensions, | 82 v8::ExtensionConfiguration* extensions, |
83 ContextType context_type = FULL_CONTEXT); | 83 GlobalContextType context_type = FULL_CONTEXT); |
84 | 84 |
85 // Detach the environment from its outer global object. | 85 // Detach the environment from its outer global object. |
86 void DetachGlobal(Handle<Context> env); | 86 void DetachGlobal(Handle<Context> env); |
87 | 87 |
88 // Traverses the pointers for memory management. | 88 // Traverses the pointers for memory management. |
89 void Iterate(ObjectVisitor* v); | 89 void Iterate(ObjectVisitor* v); |
90 | 90 |
91 // Accessor for the native scripts source code. | 91 // Accessor for the native scripts source code. |
92 template <class Source> | 92 template <class Source> |
93 Handle<String> SourceLookup(int index); | 93 Handle<String> SourceLookup(int index); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 private: | 170 private: |
171 const char* data_; | 171 const char* data_; |
172 size_t length_; | 172 size_t length_; |
173 }; | 173 }; |
174 | 174 |
175 } // namespace internal | 175 } // namespace internal |
176 } // namespace v8 | 176 } // namespace v8 |
177 | 177 |
178 #endif // V8_BOOTSTRAPPER_H_ | 178 #endif // V8_BOOTSTRAPPER_H_ |
OLD | NEW |