| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 Address get_address_from_id(AddressId id); | 542 Address get_address_from_id(AddressId id); |
| 543 | 543 |
| 544 // Access to top context (where the current function object was created). | 544 // Access to top context (where the current function object was created). |
| 545 Context* context() { return thread_local_top_.context_; } | 545 Context* context() { return thread_local_top_.context_; } |
| 546 void set_context(Context* context) { | 546 void set_context(Context* context) { |
| 547 ASSERT(context == NULL || context->IsContext()); | 547 ASSERT(context == NULL || context->IsContext()); |
| 548 thread_local_top_.context_ = context; | 548 thread_local_top_.context_ = context; |
| 549 } | 549 } |
| 550 Context** context_address() { return &thread_local_top_.context_; } | 550 Context** context_address() { return &thread_local_top_.context_; } |
| 551 | 551 |
| 552 SaveContext* save_context() {return thread_local_top_.save_context_; } | 552 SaveContext* save_context() { return thread_local_top_.save_context_; } |
| 553 void set_save_context(SaveContext* save) { | 553 void set_save_context(SaveContext* save) { |
| 554 thread_local_top_.save_context_ = save; | 554 thread_local_top_.save_context_ = save; |
| 555 } | 555 } |
| 556 | 556 |
| 557 // Access to current thread id. | 557 // Access to current thread id. |
| 558 ThreadId thread_id() { return thread_local_top_.thread_id_; } | 558 ThreadId thread_id() { return thread_local_top_.thread_id_; } |
| 559 void set_thread_id(ThreadId id) { thread_local_top_.thread_id_ = id; } | 559 void set_thread_id(ThreadId id) { thread_local_top_.thread_id_ = id; } |
| 560 | 560 |
| 561 // Interface to pending exception. | 561 // Interface to pending exception. |
| 562 MaybeObject* pending_exception() { | 562 MaybeObject* pending_exception() { |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 thread_local_top_.top_lookup_result_ = top; | 1046 thread_local_top_.top_lookup_result_ = top; |
| 1047 } | 1047 } |
| 1048 | 1048 |
| 1049 bool context_exit_happened() { | 1049 bool context_exit_happened() { |
| 1050 return context_exit_happened_; | 1050 return context_exit_happened_; |
| 1051 } | 1051 } |
| 1052 void set_context_exit_happened(bool context_exit_happened) { | 1052 void set_context_exit_happened(bool context_exit_happened) { |
| 1053 context_exit_happened_ = context_exit_happened; | 1053 context_exit_happened_ = context_exit_happened; |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 bool initialized_from_snapshot() { return initialized_from_snapshot_; } |
| 1057 |
| 1056 double time_millis_since_init() { | 1058 double time_millis_since_init() { |
| 1057 return OS::TimeCurrentMillis() - time_millis_at_init_; | 1059 return OS::TimeCurrentMillis() - time_millis_at_init_; |
| 1058 } | 1060 } |
| 1059 | 1061 |
| 1060 DateCache* date_cache() { | 1062 DateCache* date_cache() { |
| 1061 return date_cache_; | 1063 return date_cache_; |
| 1062 } | 1064 } |
| 1063 | 1065 |
| 1064 void set_date_cache(DateCache* date_cache) { | 1066 void set_date_cache(DateCache* date_cache) { |
| 1065 if (date_cache != date_cache_) { | 1067 if (date_cache != date_cache_) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 CallbackTable* callback_table() { | 1105 CallbackTable* callback_table() { |
| 1104 return callback_table_; | 1106 return callback_table_; |
| 1105 } | 1107 } |
| 1106 void set_callback_table(CallbackTable* callback_table) { | 1108 void set_callback_table(CallbackTable* callback_table) { |
| 1107 callback_table_ = callback_table; | 1109 callback_table_ = callback_table; |
| 1108 } | 1110 } |
| 1109 | 1111 |
| 1110 HStatistics* GetHStatistics(); | 1112 HStatistics* GetHStatistics(); |
| 1111 HTracer* GetHTracer(); | 1113 HTracer* GetHTracer(); |
| 1112 | 1114 |
| 1115 bool HasFunctionEntryHook() { |
| 1116 return function_entry_hook_ != NULL && |
| 1117 function_entry_hook_ != NullFunctionEntryHook; |
| 1118 } |
| 1119 FunctionEntryHook GetFunctionEntryHook(); |
| 1120 void SetFunctionEntryHook(FunctionEntryHook function_entry_hook); |
| 1121 FunctionEntryHook* function_entry_hook_location() { |
| 1122 return &function_entry_hook_; |
| 1123 } |
| 1124 |
| 1113 private: | 1125 private: |
| 1114 Isolate(); | 1126 Isolate(); |
| 1115 | 1127 |
| 1116 int id() const { return static_cast<int>(id_); } | 1128 int id() const { return static_cast<int>(id_); } |
| 1117 | 1129 |
| 1118 friend struct GlobalState; | 1130 friend struct GlobalState; |
| 1119 friend struct InitializeGlobalState; | 1131 friend struct InitializeGlobalState; |
| 1120 | 1132 |
| 1121 enum State { | 1133 enum State { |
| 1122 UNINITIALIZED, // Some components may not have been allocated. | 1134 UNINITIALIZED, // Some components may not have been allocated. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 static ThreadDataTable* thread_data_table_; | 1195 static ThreadDataTable* thread_data_table_; |
| 1184 | 1196 |
| 1185 // A global counter for all generated Isolates, might overflow. | 1197 // A global counter for all generated Isolates, might overflow. |
| 1186 static Atomic32 isolate_counter_; | 1198 static Atomic32 isolate_counter_; |
| 1187 | 1199 |
| 1188 void Deinit(); | 1200 void Deinit(); |
| 1189 | 1201 |
| 1190 static void SetIsolateThreadLocals(Isolate* isolate, | 1202 static void SetIsolateThreadLocals(Isolate* isolate, |
| 1191 PerIsolateThreadData* data); | 1203 PerIsolateThreadData* data); |
| 1192 | 1204 |
| 1205 // This function is used as a NULL sentry for the function entry point |
| 1206 // callback. This allows shutting callbacks off per-isolate, even after |
| 1207 // callbacks have been emitted into stubs and functions. |
| 1208 static void NullFunctionEntryHook(uintptr_t function, |
| 1209 uintptr_t return_addr_location); |
| 1210 |
| 1193 // Allocate and insert PerIsolateThreadData into the ThreadDataTable | 1211 // Allocate and insert PerIsolateThreadData into the ThreadDataTable |
| 1194 // (regardless of whether such data already exists). | 1212 // (regardless of whether such data already exists). |
| 1195 PerIsolateThreadData* AllocatePerIsolateThreadData(ThreadId thread_id); | 1213 PerIsolateThreadData* AllocatePerIsolateThreadData(ThreadId thread_id); |
| 1196 | 1214 |
| 1197 // Find the PerThread for this particular (isolate, thread) combination. | 1215 // Find the PerThread for this particular (isolate, thread) combination. |
| 1198 // If one does not yet exist, allocate a new one. | 1216 // If one does not yet exist, allocate a new one. |
| 1199 PerIsolateThreadData* FindOrAllocatePerThreadDataForThisThread(); | 1217 PerIsolateThreadData* FindOrAllocatePerThreadDataForThisThread(); |
| 1200 | 1218 |
| 1201 // Initializes the current thread to run this Isolate. | 1219 // Initializes the current thread to run this Isolate. |
| 1202 // Not thread-safe. Multiple threads should not Enter/Exit the same isolate | 1220 // Not thread-safe. Multiple threads should not Enter/Exit the same isolate |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 regexp_macro_assembler_canonicalize_; | 1303 regexp_macro_assembler_canonicalize_; |
| 1286 RegExpStack* regexp_stack_; | 1304 RegExpStack* regexp_stack_; |
| 1287 DateCache* date_cache_; | 1305 DateCache* date_cache_; |
| 1288 unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_; | 1306 unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_; |
| 1289 CodeStubInterfaceDescriptor* code_stub_interface_descriptors_; | 1307 CodeStubInterfaceDescriptor* code_stub_interface_descriptors_; |
| 1290 | 1308 |
| 1291 // The garbage collector should be a little more aggressive when it knows | 1309 // The garbage collector should be a little more aggressive when it knows |
| 1292 // that a context was recently exited. | 1310 // that a context was recently exited. |
| 1293 bool context_exit_happened_; | 1311 bool context_exit_happened_; |
| 1294 | 1312 |
| 1313 // True if this isolate was initialized from a snapshot. |
| 1314 bool initialized_from_snapshot_; |
| 1315 |
| 1295 // Time stamp at initialization. | 1316 // Time stamp at initialization. |
| 1296 double time_millis_at_init_; | 1317 double time_millis_at_init_; |
| 1297 | 1318 |
| 1298 #if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \ | 1319 #if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \ |
| 1299 defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__) | 1320 defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__) |
| 1300 bool simulator_initialized_; | 1321 bool simulator_initialized_; |
| 1301 HashMap* simulator_i_cache_; | 1322 HashMap* simulator_i_cache_; |
| 1302 Redirection* simulator_redirection_; | 1323 Redirection* simulator_redirection_; |
| 1303 #endif | 1324 #endif |
| 1304 | 1325 |
| 1305 #ifdef DEBUG | 1326 #ifdef DEBUG |
| 1306 // A static array of histogram info for each type. | 1327 // A static array of histogram info for each type. |
| 1307 HistogramInfo heap_histograms_[LAST_TYPE + 1]; | 1328 HistogramInfo heap_histograms_[LAST_TYPE + 1]; |
| 1308 JSObject::SpillInformation js_spill_information_; | 1329 JSObject::SpillInformation js_spill_information_; |
| 1309 int code_kind_statistics_[Code::NUMBER_OF_KINDS]; | 1330 int code_kind_statistics_[Code::NUMBER_OF_KINDS]; |
| 1310 #endif | 1331 #endif |
| 1311 | 1332 |
| 1312 #ifdef ENABLE_DEBUGGER_SUPPORT | 1333 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1313 Debugger* debugger_; | 1334 Debugger* debugger_; |
| 1314 Debug* debug_; | 1335 Debug* debug_; |
| 1315 #endif | 1336 #endif |
| 1316 CpuProfiler* cpu_profiler_; | 1337 CpuProfiler* cpu_profiler_; |
| 1317 HeapProfiler* heap_profiler_; | 1338 HeapProfiler* heap_profiler_; |
| 1339 FunctionEntryHook function_entry_hook_; |
| 1318 | 1340 |
| 1319 #define GLOBAL_BACKING_STORE(type, name, initialvalue) \ | 1341 #define GLOBAL_BACKING_STORE(type, name, initialvalue) \ |
| 1320 type name##_; | 1342 type name##_; |
| 1321 ISOLATE_INIT_LIST(GLOBAL_BACKING_STORE) | 1343 ISOLATE_INIT_LIST(GLOBAL_BACKING_STORE) |
| 1322 #undef GLOBAL_BACKING_STORE | 1344 #undef GLOBAL_BACKING_STORE |
| 1323 | 1345 |
| 1324 #define GLOBAL_ARRAY_BACKING_STORE(type, name, length) \ | 1346 #define GLOBAL_ARRAY_BACKING_STORE(type, name, length) \ |
| 1325 type name##_[length]; | 1347 type name##_[length]; |
| 1326 ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_BACKING_STORE) | 1348 ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_BACKING_STORE) |
| 1327 #undef GLOBAL_ARRAY_BACKING_STORE | 1349 #undef GLOBAL_ARRAY_BACKING_STORE |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 | 1513 |
| 1492 // Mark the native context with out of memory. | 1514 // Mark the native context with out of memory. |
| 1493 inline void Context::mark_out_of_memory() { | 1515 inline void Context::mark_out_of_memory() { |
| 1494 native_context()->set_out_of_memory(HEAP->true_value()); | 1516 native_context()->set_out_of_memory(HEAP->true_value()); |
| 1495 } | 1517 } |
| 1496 | 1518 |
| 1497 | 1519 |
| 1498 } } // namespace v8::internal | 1520 } } // namespace v8::internal |
| 1499 | 1521 |
| 1500 #endif // V8_ISOLATE_H_ | 1522 #endif // V8_ISOLATE_H_ |
| OLD | NEW |