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 5755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5830 // call Heap::TearDown() to release allocated memory. | 5829 // call Heap::TearDown() to release allocated memory. |
5831 // | 5830 // |
5832 // If the heap is not yet configured (e.g. through the API), configure it. | 5831 // If the heap is not yet configured (e.g. through the API), configure it. |
5833 // Configuration is based on the flags new-space-size (really the semispace | 5832 // Configuration is based on the flags new-space-size (really the semispace |
5834 // size) and old-space-size if set or the initial values of semispace_size_ | 5833 // size) and old-space-size if set or the initial values of semispace_size_ |
5835 // and old_generation_size_ otherwise. | 5834 // and old_generation_size_ otherwise. |
5836 if (!configured_) { | 5835 if (!configured_) { |
5837 if (!ConfigureHeapDefault()) return false; | 5836 if (!ConfigureHeapDefault()) return false; |
5838 } | 5837 } |
5839 | 5838 |
5840 gc_initializer_mutex->Lock(); | 5839 gc_initializer_mutex.Pointer()->Lock(); |
5841 static bool initialized_gc = false; | 5840 static bool initialized_gc = false; |
5842 if (!initialized_gc) { | 5841 if (!initialized_gc) { |
5843 initialized_gc = true; | 5842 initialized_gc = true; |
5844 InitializeScavengingVisitorsTables(); | 5843 InitializeScavengingVisitorsTables(); |
5845 NewSpaceScavenger::Initialize(); | 5844 NewSpaceScavenger::Initialize(); |
5846 MarkCompactCollector::Initialize(); | 5845 MarkCompactCollector::Initialize(); |
5847 } | 5846 } |
5848 gc_initializer_mutex->Unlock(); | 5847 gc_initializer_mutex.Pointer()->Unlock(); |
5849 | 5848 |
5850 MarkMapPointersAsEncoded(false); | 5849 MarkMapPointersAsEncoded(false); |
5851 | 5850 |
5852 // Set up memory allocator. | 5851 // Set up memory allocator. |
5853 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) | 5852 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) |
5854 return false; | 5853 return false; |
5855 | 5854 |
5856 // Set up new space. | 5855 // Set up new space. |
5857 if (!new_space_.SetUp(reserved_semispace_size_, max_semispace_size_)) { | 5856 if (!new_space_.SetUp(reserved_semispace_size_, max_semispace_size_)) { |
5858 return false; | 5857 return false; |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6930 isolate_->heap()->store_buffer()->Compact(); | 6929 isolate_->heap()->store_buffer()->Compact(); |
6931 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6930 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6932 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6931 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6933 next = chunk->next_chunk(); | 6932 next = chunk->next_chunk(); |
6934 isolate_->memory_allocator()->Free(chunk); | 6933 isolate_->memory_allocator()->Free(chunk); |
6935 } | 6934 } |
6936 chunks_queued_for_free_ = NULL; | 6935 chunks_queued_for_free_ = NULL; |
6937 } | 6936 } |
6938 | 6937 |
6939 } } // namespace v8::internal | 6938 } } // namespace v8::internal |
OLD | NEW |