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 5773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5848 // call Heap::TearDown() to release allocated memory. | 5847 // call Heap::TearDown() to release allocated memory. |
5849 // | 5848 // |
5850 // If the heap is not yet configured (e.g. through the API), configure it. | 5849 // If the heap is not yet configured (e.g. through the API), configure it. |
5851 // Configuration is based on the flags new-space-size (really the semispace | 5850 // Configuration is based on the flags new-space-size (really the semispace |
5852 // size) and old-space-size if set or the initial values of semispace_size_ | 5851 // size) and old-space-size if set or the initial values of semispace_size_ |
5853 // and old_generation_size_ otherwise. | 5852 // and old_generation_size_ otherwise. |
5854 if (!configured_) { | 5853 if (!configured_) { |
5855 if (!ConfigureHeapDefault()) return false; | 5854 if (!ConfigureHeapDefault()) return false; |
5856 } | 5855 } |
5857 | 5856 |
5858 gc_initializer_mutex->Lock(); | 5857 gc_initializer_mutex.Pointer()->Lock(); |
5859 static bool initialized_gc = false; | 5858 static bool initialized_gc = false; |
5860 if (!initialized_gc) { | 5859 if (!initialized_gc) { |
5861 initialized_gc = true; | 5860 initialized_gc = true; |
5862 InitializeScavengingVisitorsTables(); | 5861 InitializeScavengingVisitorsTables(); |
5863 NewSpaceScavenger::Initialize(); | 5862 NewSpaceScavenger::Initialize(); |
5864 MarkCompactCollector::Initialize(); | 5863 MarkCompactCollector::Initialize(); |
5865 } | 5864 } |
5866 gc_initializer_mutex->Unlock(); | 5865 gc_initializer_mutex.Pointer()->Unlock(); |
5867 | 5866 |
5868 MarkMapPointersAsEncoded(false); | 5867 MarkMapPointersAsEncoded(false); |
5869 | 5868 |
5870 // Set up memory allocator. | 5869 // Set up memory allocator. |
5871 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) | 5870 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) |
5872 return false; | 5871 return false; |
5873 | 5872 |
5874 // Set up new space. | 5873 // Set up new space. |
5875 if (!new_space_.SetUp(reserved_semispace_size_, max_semispace_size_)) { | 5874 if (!new_space_.SetUp(reserved_semispace_size_, max_semispace_size_)) { |
5876 return false; | 5875 return false; |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6952 isolate_->heap()->store_buffer()->Compact(); | 6951 isolate_->heap()->store_buffer()->Compact(); |
6953 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6952 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6954 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6953 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6955 next = chunk->next_chunk(); | 6954 next = chunk->next_chunk(); |
6956 isolate_->memory_allocator()->Free(chunk); | 6955 isolate_->memory_allocator()->Free(chunk); |
6957 } | 6956 } |
6958 chunks_queued_for_free_ = NULL; | 6957 chunks_queued_for_free_ = NULL; |
6959 } | 6958 } |
6960 | 6959 |
6961 } } // namespace v8::internal | 6960 } } // namespace v8::internal |
OLD | NEW |