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 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 global_handles_(NULL), | 1746 global_handles_(NULL), |
1747 context_switcher_(NULL), | 1747 context_switcher_(NULL), |
1748 thread_manager_(NULL), | 1748 thread_manager_(NULL), |
1749 fp_stubs_generated_(false), | 1749 fp_stubs_generated_(false), |
1750 has_installed_extensions_(false), | 1750 has_installed_extensions_(false), |
1751 string_tracker_(NULL), | 1751 string_tracker_(NULL), |
1752 regexp_stack_(NULL), | 1752 regexp_stack_(NULL), |
1753 date_cache_(NULL), | 1753 date_cache_(NULL), |
1754 code_stub_interface_descriptors_(NULL), | 1754 code_stub_interface_descriptors_(NULL), |
1755 context_exit_happened_(false), | 1755 context_exit_happened_(false), |
| 1756 initialized_from_snapshot_(false), |
1756 cpu_profiler_(NULL), | 1757 cpu_profiler_(NULL), |
1757 heap_profiler_(NULL), | 1758 heap_profiler_(NULL), |
| 1759 function_entry_hook_(NULL), |
1758 deferred_handles_head_(NULL), | 1760 deferred_handles_head_(NULL), |
1759 optimizing_compiler_thread_(this), | 1761 optimizing_compiler_thread_(this), |
1760 marking_thread_(NULL), | 1762 marking_thread_(NULL), |
1761 sweeper_thread_(NULL), | 1763 sweeper_thread_(NULL), |
1762 callback_table_(NULL) { | 1764 callback_table_(NULL) { |
1763 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1); | 1765 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1); |
1764 TRACE_ISOLATE(constructor); | 1766 TRACE_ISOLATE(constructor); |
1765 | 1767 |
1766 memset(isolate_addresses_, 0, | 1768 memset(isolate_addresses_, 0, |
1767 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); | 1769 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 Release_Store(&debugger_initialized_, true); | 2072 Release_Store(&debugger_initialized_, true); |
2071 #endif | 2073 #endif |
2072 } | 2074 } |
2073 | 2075 |
2074 | 2076 |
2075 bool Isolate::Init(Deserializer* des) { | 2077 bool Isolate::Init(Deserializer* des) { |
2076 ASSERT(state_ != INITIALIZED); | 2078 ASSERT(state_ != INITIALIZED); |
2077 ASSERT(Isolate::Current() == this); | 2079 ASSERT(Isolate::Current() == this); |
2078 TRACE_ISOLATE(init); | 2080 TRACE_ISOLATE(init); |
2079 | 2081 |
| 2082 if (function_entry_hook() != NULL) { |
| 2083 // When function entry hooking is in effect, we have to create the code |
| 2084 // stubs from scratch to get entry hooks, rather than loading the previously |
| 2085 // generated stubs from disk. |
| 2086 // If this assert fires, the initialization path has regressed. |
| 2087 ASSERT(des == NULL); |
| 2088 } |
| 2089 |
2080 // The initialization process does not handle memory exhaustion. | 2090 // The initialization process does not handle memory exhaustion. |
2081 DisallowAllocationFailure disallow_allocation_failure; | 2091 DisallowAllocationFailure disallow_allocation_failure; |
2082 | 2092 |
2083 InitializeLoggingAndCounters(); | 2093 InitializeLoggingAndCounters(); |
2084 | 2094 |
2085 InitializeDebugger(); | 2095 InitializeDebugger(); |
2086 | 2096 |
2087 memory_allocator_ = new MemoryAllocator(this); | 2097 memory_allocator_ = new MemoryAllocator(this); |
2088 code_range_ = new CodeRange(this); | 2098 code_range_ = new CodeRange(this); |
2089 | 2099 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2261 } | 2271 } |
2262 } | 2272 } |
2263 | 2273 |
2264 if (FLAG_sweeper_threads > 0) { | 2274 if (FLAG_sweeper_threads > 0) { |
2265 sweeper_thread_ = new SweeperThread*[FLAG_sweeper_threads]; | 2275 sweeper_thread_ = new SweeperThread*[FLAG_sweeper_threads]; |
2266 for (int i = 0; i < FLAG_sweeper_threads; i++) { | 2276 for (int i = 0; i < FLAG_sweeper_threads; i++) { |
2267 sweeper_thread_[i] = new SweeperThread(this); | 2277 sweeper_thread_[i] = new SweeperThread(this); |
2268 sweeper_thread_[i]->Start(); | 2278 sweeper_thread_[i]->Start(); |
2269 } | 2279 } |
2270 } | 2280 } |
| 2281 |
| 2282 initialized_from_snapshot_ = (des != NULL); |
| 2283 |
2271 return true; | 2284 return true; |
2272 } | 2285 } |
2273 | 2286 |
2274 | 2287 |
2275 // Initialized lazily to allow early | 2288 // Initialized lazily to allow early |
2276 // v8::V8::SetAddHistogramSampleFunction calls. | 2289 // v8::V8::SetAddHistogramSampleFunction calls. |
2277 StatsTable* Isolate::stats_table() { | 2290 StatsTable* Isolate::stats_table() { |
2278 if (stats_table_ == NULL) { | 2291 if (stats_table_ == NULL) { |
2279 stats_table_ = new StatsTable; | 2292 stats_table_ = new StatsTable; |
2280 } | 2293 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2439 | 2452 |
2440 #ifdef DEBUG | 2453 #ifdef DEBUG |
2441 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2454 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2442 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2455 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2443 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2456 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
2444 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2457 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
2445 #undef ISOLATE_FIELD_OFFSET | 2458 #undef ISOLATE_FIELD_OFFSET |
2446 #endif | 2459 #endif |
2447 | 2460 |
2448 } } // namespace v8::internal | 2461 } } // namespace v8::internal |
OLD | NEW |