| 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 1981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1992 } | 1992 } |
| 1993 | 1993 |
| 1994 if (create_heap_objects) { | 1994 if (create_heap_objects) { |
| 1995 // Terminate the cache array with the sentinel so we can iterate. | 1995 // Terminate the cache array with the sentinel so we can iterate. |
| 1996 PushToPartialSnapshotCache(heap_.undefined_value()); | 1996 PushToPartialSnapshotCache(heap_.undefined_value()); |
| 1997 } | 1997 } |
| 1998 | 1998 |
| 1999 InitializeThreadLocal(); | 1999 InitializeThreadLocal(); |
| 2000 | 2000 |
| 2001 bootstrapper_->Initialize(create_heap_objects); | 2001 bootstrapper_->Initialize(create_heap_objects); |
| 2002 builtins_.SetUp(create_heap_objects); | 2002 |
| 2003 if (des == NULL && !Serializer::enabled()) { |
| 2004 builtins_.SetUp(Builtins::ALL); |
| 2005 } else if (des == NULL) { |
| 2006 builtins_.SetUp(Builtins::FOR_SNAPSHOT); |
| 2007 } else { |
| 2008 builtins_.SetUp(Builtins::BEFORE_DESERIALIZATION); |
| 2009 } |
| 2003 | 2010 |
| 2004 // Only preallocate on the first initialization. | 2011 // Only preallocate on the first initialization. |
| 2005 if (FLAG_preallocate_message_memory && preallocated_message_space_ == NULL) { | 2012 if (FLAG_preallocate_message_memory && preallocated_message_space_ == NULL) { |
| 2006 // Start the thread which will set aside some memory. | 2013 // Start the thread which will set aside some memory. |
| 2007 PreallocatedMemoryThreadStart(); | 2014 PreallocatedMemoryThreadStart(); |
| 2008 preallocated_message_space_ = | 2015 preallocated_message_space_ = |
| 2009 new NoAllocationStringAllocator( | 2016 new NoAllocationStringAllocator( |
| 2010 preallocated_memory_thread_->data(), | 2017 preallocated_memory_thread_->data(), |
| 2011 preallocated_memory_thread_->length()); | 2018 preallocated_memory_thread_->length()); |
| 2012 PreallocatedStorageInit(preallocated_memory_thread_->length() / 4); | 2019 PreallocatedStorageInit(preallocated_memory_thread_->length() / 4); |
| 2013 } | 2020 } |
| 2014 | 2021 |
| 2015 if (FLAG_preemption) { | 2022 if (FLAG_preemption) { |
| 2016 v8::Locker locker; | 2023 v8::Locker locker; |
| 2017 v8::Locker::StartPreemption(100); | 2024 v8::Locker::StartPreemption(100); |
| 2018 } | 2025 } |
| 2019 | 2026 |
| 2020 #ifdef ENABLE_DEBUGGER_SUPPORT | 2027 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 2021 debug_->SetUp(create_heap_objects); | 2028 debug_->SetUp(create_heap_objects); |
| 2022 #endif | 2029 #endif |
| 2023 | 2030 |
| 2024 // If we are deserializing, read the state into the now-empty heap. | 2031 // If we are deserializing, read the state into the now-empty heap. |
| 2025 if (!create_heap_objects) { | 2032 if (des) { |
| 2026 des->Deserialize(); | 2033 des->Deserialize(); |
| 2034 |
| 2035 // Set up builtins that were not included in snapshot. |
| 2036 builtins_.SetUp(Builtins::AFTER_DESERIALIZATION); |
| 2027 } | 2037 } |
| 2038 |
| 2028 stub_cache_->Initialize(); | 2039 stub_cache_->Initialize(); |
| 2029 | 2040 |
| 2030 // Finish initialization of ThreadLocal after deserialization is done. | 2041 // Finish initialization of ThreadLocal after deserialization is done. |
| 2031 clear_pending_exception(); | 2042 clear_pending_exception(); |
| 2032 clear_pending_message(); | 2043 clear_pending_message(); |
| 2033 clear_scheduled_exception(); | 2044 clear_scheduled_exception(); |
| 2034 | 2045 |
| 2035 // Deserializing may put strange things in the root array's copy of the | 2046 // Deserializing may put strange things in the root array's copy of the |
| 2036 // stack guard. | 2047 // stack guard. |
| 2037 heap_.SetStackLimits(); | 2048 heap_.SetStackLimits(); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2177 | 2188 |
| 2178 #ifdef DEBUG | 2189 #ifdef DEBUG |
| 2179 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2190 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 2180 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2191 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 2181 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2192 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 2182 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2193 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 2183 #undef ISOLATE_FIELD_OFFSET | 2194 #undef ISOLATE_FIELD_OFFSET |
| 2184 #endif | 2195 #endif |
| 2185 | 2196 |
| 2186 } } // namespace v8::internal | 2197 } } // namespace v8::internal |
| OLD | NEW |