| 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 static LazyMutex gc_initializer_mutex = LAZY_MUTEX_INITIALIZER; |    63  | 
 |    64 static Mutex* gc_initializer_mutex = OS::CreateMutex(); | 
|    64  |    65  | 
|    65  |    66  | 
|    66 Heap::Heap() |    67 Heap::Heap() | 
|    67     : isolate_(NULL), |    68     : isolate_(NULL), | 
|    68 // semispace_size_ should be a power of 2 and old_generation_size_ should be |    69 // semispace_size_ should be a power of 2 and old_generation_size_ should be | 
|    69 // a multiple of Page::kPageSize. |    70 // a multiple of Page::kPageSize. | 
|    70 #if defined(ANDROID) |    71 #if defined(ANDROID) | 
|    71 #define LUMP_OF_MEMORY (128 * KB) |    72 #define LUMP_OF_MEMORY (128 * KB) | 
|    72       code_range_size_(0), |    73       code_range_size_(0), | 
|    73 #elif defined(V8_TARGET_ARCH_X64) |    74 #elif defined(V8_TARGET_ARCH_X64) | 
| (...skipping 5784 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5858   // call Heap::TearDown() to release allocated memory. |  5859   // call Heap::TearDown() to release allocated memory. | 
|  5859   // |  5860   // | 
|  5860   // If the heap is not yet configured (e.g. through the API), configure it. |  5861   // If the heap is not yet configured (e.g. through the API), configure it. | 
|  5861   // Configuration is based on the flags new-space-size (really the semispace |  5862   // Configuration is based on the flags new-space-size (really the semispace | 
|  5862   // size) and old-space-size if set or the initial values of semispace_size_ |  5863   // size) and old-space-size if set or the initial values of semispace_size_ | 
|  5863   // and old_generation_size_ otherwise. |  5864   // and old_generation_size_ otherwise. | 
|  5864   if (!configured_) { |  5865   if (!configured_) { | 
|  5865     if (!ConfigureHeapDefault()) return false; |  5866     if (!ConfigureHeapDefault()) return false; | 
|  5866   } |  5867   } | 
|  5867  |  5868  | 
|  5868   gc_initializer_mutex.Pointer()->Lock(); |  5869   gc_initializer_mutex->Lock(); | 
|  5869   static bool initialized_gc = false; |  5870   static bool initialized_gc = false; | 
|  5870   if (!initialized_gc) { |  5871   if (!initialized_gc) { | 
|  5871       initialized_gc = true; |  5872       initialized_gc = true; | 
|  5872       InitializeScavengingVisitorsTables(); |  5873       InitializeScavengingVisitorsTables(); | 
|  5873       NewSpaceScavenger::Initialize(); |  5874       NewSpaceScavenger::Initialize(); | 
|  5874       MarkCompactCollector::Initialize(); |  5875       MarkCompactCollector::Initialize(); | 
|  5875   } |  5876   } | 
|  5876   gc_initializer_mutex.Pointer()->Unlock(); |  5877   gc_initializer_mutex->Unlock(); | 
|  5877  |  5878  | 
|  5878   MarkMapPointersAsEncoded(false); |  5879   MarkMapPointersAsEncoded(false); | 
|  5879  |  5880  | 
|  5880   // Set up memory allocator. |  5881   // Set up memory allocator. | 
|  5881   if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) |  5882   if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) | 
|  5882       return false; |  5883       return false; | 
|  5883  |  5884  | 
|  5884   // Set up new space. |  5885   // Set up new space. | 
|  5885   if (!new_space_.SetUp(reserved_semispace_size_, max_semispace_size_)) { |  5886   if (!new_space_.SetUp(reserved_semispace_size_, max_semispace_size_)) { | 
|  5886     return false; |  5887     return false; | 
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  6977   } else { |  6978   } else { | 
|  6978     p ^= 0x1d1ed & (Page::kPageSize - 1);  // I died. |  6979     p ^= 0x1d1ed & (Page::kPageSize - 1);  // I died. | 
|  6979   } |  6980   } | 
|  6980   remembered_unmapped_pages_[remembered_unmapped_pages_index_] = |  6981   remembered_unmapped_pages_[remembered_unmapped_pages_index_] = | 
|  6981       reinterpret_cast<Address>(p); |  6982       reinterpret_cast<Address>(p); | 
|  6982   remembered_unmapped_pages_index_++; |  6983   remembered_unmapped_pages_index_++; | 
|  6983   remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; |  6984   remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; | 
|  6984 } |  6985 } | 
|  6985  |  6986  | 
|  6986 } }  // namespace v8::internal |  6987 } }  // namespace v8::internal | 
| OLD | NEW |