| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "arm/regexp-macro-assembler-arm.h" | 53 #include "arm/regexp-macro-assembler-arm.h" |
| 54 #endif | 54 #endif |
| 55 #if V8_TARGET_ARCH_MIPS && !V8_INTERPRETED_REGEXP | 55 #if V8_TARGET_ARCH_MIPS && !V8_INTERPRETED_REGEXP |
| 56 #include "regexp-macro-assembler.h" | 56 #include "regexp-macro-assembler.h" |
| 57 #include "mips/regexp-macro-assembler-mips.h" | 57 #include "mips/regexp-macro-assembler-mips.h" |
| 58 #endif | 58 #endif |
| 59 | 59 |
| 60 namespace v8 { | 60 namespace v8 { |
| 61 namespace internal { | 61 namespace internal { |
| 62 | 62 |
| 63 | 63 static LazyMutex gc_initializer_mutex = LAZY_MUTEX_INITIALIZER; |
| 64 static Mutex* gc_initializer_mutex = OS::CreateMutex(); | |
| 65 | 64 |
| 66 | 65 |
| 67 Heap::Heap() | 66 Heap::Heap() |
| 68 : isolate_(NULL), | 67 : isolate_(NULL), |
| 69 // semispace_size_ should be a power of 2 and old_generation_size_ should be | 68 // semispace_size_ should be a power of 2 and old_generation_size_ should be |
| 70 // a multiple of Page::kPageSize. | 69 // a multiple of Page::kPageSize. |
| 71 #if defined(ANDROID) | 70 #if defined(ANDROID) |
| 72 #define LUMP_OF_MEMORY (128 * KB) | 71 #define LUMP_OF_MEMORY (128 * KB) |
| 73 code_range_size_(0), | 72 code_range_size_(0), |
| 74 #elif defined(V8_TARGET_ARCH_X64) | 73 #elif defined(V8_TARGET_ARCH_X64) |
| (...skipping 5765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5840 // call Heap::TearDown() to release allocated memory. | 5839 // call Heap::TearDown() to release allocated memory. |
| 5841 // | 5840 // |
| 5842 // If the heap is not yet configured (e.g. through the API), configure it. | 5841 // If the heap is not yet configured (e.g. through the API), configure it. |
| 5843 // Configuration is based on the flags new-space-size (really the semispace | 5842 // Configuration is based on the flags new-space-size (really the semispace |
| 5844 // size) and old-space-size if set or the initial values of semispace_size_ | 5843 // size) and old-space-size if set or the initial values of semispace_size_ |
| 5845 // and old_generation_size_ otherwise. | 5844 // and old_generation_size_ otherwise. |
| 5846 if (!configured_) { | 5845 if (!configured_) { |
| 5847 if (!ConfigureHeapDefault()) return false; | 5846 if (!ConfigureHeapDefault()) return false; |
| 5848 } | 5847 } |
| 5849 | 5848 |
| 5850 gc_initializer_mutex->Lock(); | 5849 gc_initializer_mutex.Pointer()->Lock(); |
| 5851 static bool initialized_gc = false; | 5850 static bool initialized_gc = false; |
| 5852 if (!initialized_gc) { | 5851 if (!initialized_gc) { |
| 5853 initialized_gc = true; | 5852 initialized_gc = true; |
| 5854 InitializeScavengingVisitorsTables(); | 5853 InitializeScavengingVisitorsTables(); |
| 5855 NewSpaceScavenger::Initialize(); | 5854 NewSpaceScavenger::Initialize(); |
| 5856 MarkCompactCollector::Initialize(); | 5855 MarkCompactCollector::Initialize(); |
| 5857 } | 5856 } |
| 5858 gc_initializer_mutex->Unlock(); | 5857 gc_initializer_mutex.Pointer()->Unlock(); |
| 5859 | 5858 |
| 5860 MarkMapPointersAsEncoded(false); | 5859 MarkMapPointersAsEncoded(false); |
| 5861 | 5860 |
| 5862 // Set up memory allocator. | 5861 // Set up memory allocator. |
| 5863 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) | 5862 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) |
| 5864 return false; | 5863 return false; |
| 5865 | 5864 |
| 5866 // Set up new space. | 5865 // Set up new space. |
| 5867 if (!new_space_.SetUp(reserved_semispace_size_, max_semispace_size_)) { | 5866 if (!new_space_.SetUp(reserved_semispace_size_, max_semispace_size_)) { |
| 5868 return false; | 5867 return false; |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6940 isolate_->heap()->store_buffer()->Compact(); | 6939 isolate_->heap()->store_buffer()->Compact(); |
| 6941 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6940 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
| 6942 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6941 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
| 6943 next = chunk->next_chunk(); | 6942 next = chunk->next_chunk(); |
| 6944 isolate_->memory_allocator()->Free(chunk); | 6943 isolate_->memory_allocator()->Free(chunk); |
| 6945 } | 6944 } |
| 6946 chunks_queued_for_free_ = NULL; | 6945 chunks_queued_for_free_ = NULL; |
| 6947 } | 6946 } |
| 6948 | 6947 |
| 6949 } } // namespace v8::internal | 6948 } } // namespace v8::internal |
| OLD | NEW |