OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ISOLATE_H_ | 5 #ifndef V8_ISOLATE_H_ |
6 #define V8_ISOLATE_H_ | 6 #define V8_ISOLATE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include "include/v8-debug.h" | 9 #include "include/v8-debug.h" |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 | 1107 |
1108 void EnqueueMicrotask(Handle<Object> microtask); | 1108 void EnqueueMicrotask(Handle<Object> microtask); |
1109 void RunMicrotasks(); | 1109 void RunMicrotasks(); |
1110 | 1110 |
1111 void SetUseCounterCallback(v8::Isolate::UseCounterCallback callback); | 1111 void SetUseCounterCallback(v8::Isolate::UseCounterCallback callback); |
1112 void CountUsage(v8::Isolate::UseCounterFeature feature); | 1112 void CountUsage(v8::Isolate::UseCounterFeature feature); |
1113 | 1113 |
1114 BasicBlockProfiler* GetOrCreateBasicBlockProfiler(); | 1114 BasicBlockProfiler* GetOrCreateBasicBlockProfiler(); |
1115 BasicBlockProfiler* basic_block_profiler() { return basic_block_profiler_; } | 1115 BasicBlockProfiler* basic_block_profiler() { return basic_block_profiler_; } |
1116 | 1116 |
1117 static Isolate* NewForTesting() { return new Isolate(false); } | |
1118 | |
1119 std::string GetTurboCfgFileName(); | 1117 std::string GetTurboCfgFileName(); |
1120 | 1118 |
1121 #if TRACE_MAPS | 1119 #if TRACE_MAPS |
1122 int GetNextUniqueSharedFunctionInfoId() { return next_unique_sfi_id_++; } | 1120 int GetNextUniqueSharedFunctionInfoId() { return next_unique_sfi_id_++; } |
1123 #endif | 1121 #endif |
1124 | 1122 |
1125 void set_store_buffer_hash_set_1_address( | 1123 void set_store_buffer_hash_set_1_address( |
1126 uintptr_t* store_buffer_hash_set_1_address) { | 1124 uintptr_t* store_buffer_hash_set_1_address) { |
1127 store_buffer_hash_set_1_address_ = store_buffer_hash_set_1_address; | 1125 store_buffer_hash_set_1_address_ = store_buffer_hash_set_1_address; |
1128 } | 1126 } |
1129 | 1127 |
1130 uintptr_t* store_buffer_hash_set_1_address() { | 1128 uintptr_t* store_buffer_hash_set_1_address() { |
1131 return store_buffer_hash_set_1_address_; | 1129 return store_buffer_hash_set_1_address_; |
1132 } | 1130 } |
1133 | 1131 |
1134 void set_store_buffer_hash_set_2_address( | 1132 void set_store_buffer_hash_set_2_address( |
1135 uintptr_t* store_buffer_hash_set_2_address) { | 1133 uintptr_t* store_buffer_hash_set_2_address) { |
1136 store_buffer_hash_set_2_address_ = store_buffer_hash_set_2_address; | 1134 store_buffer_hash_set_2_address_ = store_buffer_hash_set_2_address; |
1137 } | 1135 } |
1138 | 1136 |
1139 uintptr_t* store_buffer_hash_set_2_address() { | 1137 uintptr_t* store_buffer_hash_set_2_address() { |
1140 return store_buffer_hash_set_2_address_; | 1138 return store_buffer_hash_set_2_address_; |
1141 } | 1139 } |
1142 | 1140 |
1143 void AddDetachedContext(Handle<Context> context); | 1141 void AddDetachedContext(Handle<Context> context); |
1144 void CheckDetachedContextsAfterGC(); | 1142 void CheckDetachedContextsAfterGC(); |
1145 | 1143 |
1146 List<Object*>* partial_snapshot_cache() { return &partial_snapshot_cache_; } | 1144 List<Object*>* partial_snapshot_cache() { return &partial_snapshot_cache_; } |
1147 | 1145 |
| 1146 void set_array_buffer_allocator(v8::ArrayBuffer::Allocator* allocator) { |
| 1147 array_buffer_allocator_ = allocator; |
| 1148 } |
| 1149 v8::ArrayBuffer::Allocator* array_buffer_allocator() const { |
| 1150 return array_buffer_allocator_; |
| 1151 } |
| 1152 |
1148 protected: | 1153 protected: |
1149 explicit Isolate(bool enable_serializer); | 1154 explicit Isolate(bool enable_serializer); |
1150 | 1155 |
1151 private: | 1156 private: |
1152 friend struct GlobalState; | 1157 friend struct GlobalState; |
1153 friend struct InitializeGlobalState; | 1158 friend struct InitializeGlobalState; |
1154 | 1159 |
1155 // These fields are accessed through the API, offsets must be kept in sync | 1160 // These fields are accessed through the API, offsets must be kept in sync |
1156 // with v8::internal::Internals (in include/v8.h) constants. This is also | 1161 // with v8::internal::Internals (in include/v8.h) constants. This is also |
1157 // verified in Isolate::Init() using runtime checks. | 1162 // verified in Isolate::Init() using runtime checks. |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 #endif | 1367 #endif |
1363 | 1368 |
1364 // List of callbacks when a Call completes. | 1369 // List of callbacks when a Call completes. |
1365 List<CallCompletedCallback> call_completed_callbacks_; | 1370 List<CallCompletedCallback> call_completed_callbacks_; |
1366 | 1371 |
1367 v8::Isolate::UseCounterCallback use_counter_callback_; | 1372 v8::Isolate::UseCounterCallback use_counter_callback_; |
1368 BasicBlockProfiler* basic_block_profiler_; | 1373 BasicBlockProfiler* basic_block_profiler_; |
1369 | 1374 |
1370 List<Object*> partial_snapshot_cache_; | 1375 List<Object*> partial_snapshot_cache_; |
1371 | 1376 |
| 1377 v8::ArrayBuffer::Allocator* array_buffer_allocator_; |
| 1378 |
1372 friend class ExecutionAccess; | 1379 friend class ExecutionAccess; |
1373 friend class HandleScopeImplementer; | 1380 friend class HandleScopeImplementer; |
1374 friend class OptimizingCompileDispatcher; | 1381 friend class OptimizingCompileDispatcher; |
1375 friend class SweeperThread; | 1382 friend class SweeperThread; |
1376 friend class ThreadManager; | 1383 friend class ThreadManager; |
1377 friend class Simulator; | 1384 friend class Simulator; |
1378 friend class StackGuard; | 1385 friend class StackGuard; |
1379 friend class ThreadId; | 1386 friend class ThreadId; |
1380 friend class TestMemoryAllocatorScope; | 1387 friend class TestMemoryAllocatorScope; |
1381 friend class TestCodeRangeScope; | 1388 friend class TestCodeRangeScope; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 } | 1597 } |
1591 | 1598 |
1592 EmbeddedVector<char, 128> filename_; | 1599 EmbeddedVector<char, 128> filename_; |
1593 FILE* file_; | 1600 FILE* file_; |
1594 int scope_depth_; | 1601 int scope_depth_; |
1595 }; | 1602 }; |
1596 | 1603 |
1597 } } // namespace v8::internal | 1604 } } // namespace v8::internal |
1598 | 1605 |
1599 #endif // V8_ISOLATE_H_ | 1606 #endif // V8_ISOLATE_H_ |
OLD | NEW |