| OLD | NEW |
| 1 // Copyright 2006-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2010 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 11 matching lines...) Expand all Loading... |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include <stdlib.h> | 28 #include <stdlib.h> |
| 29 | 29 |
| 30 #include "v8.h" | 30 #include "v8.h" |
| 31 | 31 |
| 32 #include "ast.h" |
| 32 #include "bootstrapper.h" | 33 #include "bootstrapper.h" |
| 34 #include "codegen.h" |
| 33 #include "compilation-cache.h" | 35 #include "compilation-cache.h" |
| 34 #include "debug.h" | 36 #include "debug.h" |
| 35 #include "heap-profiler.h" | 37 #include "heap-profiler.h" |
| 36 #include "isolate.h" | 38 #include "isolate.h" |
| 37 #include "log.h" | 39 #include "log.h" |
| 38 #include "serialize.h" | 40 #include "serialize.h" |
| 39 #include "scanner.h" | 41 #include "scanner.h" |
| 40 #include "scopeinfo.h" | 42 #include "scopeinfo.h" |
| 41 #include "simulator.h" | 43 #include "simulator.h" |
| 42 #include "stub-cache.h" | 44 #include "stub-cache.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 descriptor_lookup_cache_(NULL), | 244 descriptor_lookup_cache_(NULL), |
| 243 handle_scope_implementer_(NULL), | 245 handle_scope_implementer_(NULL), |
| 244 scanner_character_classes_(NULL), | 246 scanner_character_classes_(NULL), |
| 245 in_use_list_(0), | 247 in_use_list_(0), |
| 246 free_list_(0), | 248 free_list_(0), |
| 247 preallocated_storage_preallocated_(false), | 249 preallocated_storage_preallocated_(false), |
| 248 write_input_buffer_(NULL), | 250 write_input_buffer_(NULL), |
| 249 global_handles_(NULL), | 251 global_handles_(NULL), |
| 250 context_switcher_(NULL), | 252 context_switcher_(NULL), |
| 251 thread_manager_(NULL), | 253 thread_manager_(NULL), |
| 254 ast_sentinels_(NULL), |
| 252 string_tracker_(NULL) { | 255 string_tracker_(NULL) { |
| 253 memset(isolate_addresses_, 0, | 256 memset(isolate_addresses_, 0, |
| 254 sizeof(isolate_addresses_[0]) * (k_isolate_address_count + 1)); | 257 sizeof(isolate_addresses_[0]) * (k_isolate_address_count + 1)); |
| 255 | 258 |
| 256 heap_.isolate_ = this; | 259 heap_.isolate_ = this; |
| 257 stack_guard_.isolate_ = this; | 260 stack_guard_.isolate_ = this; |
| 258 | 261 |
| 259 #ifdef DEBUG | 262 #ifdef DEBUG |
| 260 // heap_histograms_ initializes itself. | 263 // heap_histograms_ initializes itself. |
| 261 memset(&js_spill_information_, 0, sizeof(js_spill_information_)); | 264 memset(&js_spill_information_, 0, sizeof(js_spill_information_)); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 288 } | 291 } |
| 289 | 292 |
| 290 | 293 |
| 291 Isolate::~Isolate() { | 294 Isolate::~Isolate() { |
| 292 if (state_ == INITIALIZED) { | 295 if (state_ == INITIALIZED) { |
| 293 OProfileAgent::TearDown(); | 296 OProfileAgent::TearDown(); |
| 294 if (FLAG_preemption) { | 297 if (FLAG_preemption) { |
| 295 v8::Locker locker; | 298 v8::Locker locker; |
| 296 v8::Locker::StopPreemption(); | 299 v8::Locker::StopPreemption(); |
| 297 } | 300 } |
| 298 Builtins::TearDown(); | 301 builtins_.TearDown(); |
| 299 bootstrapper_->TearDown(); | 302 bootstrapper_->TearDown(); |
| 300 | 303 |
| 301 // Remove the external reference to the preallocated stack memory. | 304 // Remove the external reference to the preallocated stack memory. |
| 302 delete preallocated_message_space_; | 305 delete preallocated_message_space_; |
| 303 preallocated_message_space_ = NULL; | 306 preallocated_message_space_ = NULL; |
| 304 PreallocatedMemoryThreadStop(); | 307 PreallocatedMemoryThreadStop(); |
| 305 | 308 |
| 306 HeapProfiler::TearDown(); | 309 HeapProfiler::TearDown(); |
| 307 CpuProfiler::TearDown(); | 310 CpuProfiler::TearDown(); |
| 308 heap_.TearDown(); | 311 heap_.TearDown(); |
| 309 logger_->TearDown(); | 312 logger_->TearDown(); |
| 310 } | 313 } |
| 311 delete scanner_character_classes_; | 314 delete scanner_character_classes_; |
| 312 scanner_character_classes_ = NULL; | 315 scanner_character_classes_ = NULL; |
| 313 | 316 |
| 317 delete ast_sentinels_; |
| 318 ast_sentinels_ = NULL; |
| 314 delete descriptor_lookup_cache_; | 319 delete descriptor_lookup_cache_; |
| 315 descriptor_lookup_cache_ = NULL; | 320 descriptor_lookup_cache_ = NULL; |
| 316 delete context_slot_cache_; | 321 delete context_slot_cache_; |
| 317 context_slot_cache_ = NULL; | 322 context_slot_cache_ = NULL; |
| 318 delete keyed_lookup_cache_; | 323 delete keyed_lookup_cache_; |
| 319 keyed_lookup_cache_ = NULL; | 324 keyed_lookup_cache_ = NULL; |
| 320 | 325 |
| 321 delete transcendental_cache_; | 326 delete transcendental_cache_; |
| 322 transcendental_cache_ = NULL; | 327 transcendental_cache_ = NULL; |
| 323 delete stub_cache_; | 328 delete stub_cache_; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 keyed_lookup_cache_ = new KeyedLookupCache(); | 402 keyed_lookup_cache_ = new KeyedLookupCache(); |
| 398 context_slot_cache_ = new ContextSlotCache(); | 403 context_slot_cache_ = new ContextSlotCache(); |
| 399 descriptor_lookup_cache_ = new DescriptorLookupCache(); | 404 descriptor_lookup_cache_ = new DescriptorLookupCache(); |
| 400 scanner_character_classes_ = new ScannerCharacterClasses(); | 405 scanner_character_classes_ = new ScannerCharacterClasses(); |
| 401 write_input_buffer_ = new StringInputBuffer(); | 406 write_input_buffer_ = new StringInputBuffer(); |
| 402 global_handles_ = new GlobalHandles(); | 407 global_handles_ = new GlobalHandles(); |
| 403 bootstrapper_ = new Bootstrapper(); | 408 bootstrapper_ = new Bootstrapper(); |
| 404 cpu_features_ = new CpuFeatures(); | 409 cpu_features_ = new CpuFeatures(); |
| 405 handle_scope_implementer_ = new HandleScopeImplementer(); | 410 handle_scope_implementer_ = new HandleScopeImplementer(); |
| 406 stub_cache_ = new StubCache(); | 411 stub_cache_ = new StubCache(); |
| 412 ast_sentinels_ = new AstSentinels(); |
| 407 | 413 |
| 408 #ifdef ENABLE_DEBUGGER_SUPPORT | 414 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 409 debugger_ = new Debugger(); | 415 debugger_ = new Debugger(); |
| 410 debugger_->isolate_ = this; | 416 debugger_->isolate_ = this; |
| 411 #endif | 417 #endif |
| 412 | 418 |
| 413 state_ = PREINITIALIZED; | 419 state_ = PREINITIALIZED; |
| 414 return true; | 420 return true; |
| 415 } | 421 } |
| 416 | 422 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 } | 465 } |
| 460 | 466 |
| 461 // Setup the object heap | 467 // Setup the object heap |
| 462 ASSERT(!heap_.HasBeenSetup()); | 468 ASSERT(!heap_.HasBeenSetup()); |
| 463 if (!heap_.Setup(create_heap_objects)) { | 469 if (!heap_.Setup(create_heap_objects)) { |
| 464 V8::SetFatalError(); | 470 V8::SetFatalError(); |
| 465 return false; | 471 return false; |
| 466 } | 472 } |
| 467 | 473 |
| 468 bootstrapper_->Initialize(create_heap_objects); | 474 bootstrapper_->Initialize(create_heap_objects); |
| 469 Builtins::Setup(create_heap_objects); | 475 builtins_.Setup(create_heap_objects); |
| 470 | 476 |
| 471 InitializeThreadLocal(); | 477 InitializeThreadLocal(); |
| 472 | 478 |
| 473 // Only preallocate on the first initialization. | 479 // Only preallocate on the first initialization. |
| 474 if (FLAG_preallocate_message_memory && preallocated_message_space_ == NULL) { | 480 if (FLAG_preallocate_message_memory && preallocated_message_space_ == NULL) { |
| 475 // Start the thread which will set aside some memory. | 481 // Start the thread which will set aside some memory. |
| 476 PreallocatedMemoryThreadStart(); | 482 PreallocatedMemoryThreadStart(); |
| 477 preallocated_message_space_ = | 483 preallocated_message_space_ = |
| 478 new NoAllocationStringAllocator( | 484 new NoAllocationStringAllocator( |
| 479 preallocated_memory_thread_->data(), | 485 preallocated_memory_thread_->data(), |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 LOG(LogCodeObjects()); | 521 LOG(LogCodeObjects()); |
| 516 LOG(LogCompiledFunctions()); | 522 LOG(LogCompiledFunctions()); |
| 517 } | 523 } |
| 518 | 524 |
| 519 state_ = INITIALIZED; | 525 state_ = INITIALIZED; |
| 520 return true; | 526 return true; |
| 521 } | 527 } |
| 522 | 528 |
| 523 | 529 |
| 524 } } // namespace v8::internal | 530 } } // namespace v8::internal |
| OLD | NEW |