| OLD | NEW | 
|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 118     ASSERT(cur_addr_ <= cur_end_); | 118     ASSERT(cur_addr_ <= cur_end_); | 
| 119     if (!obj->IsFiller()) { | 119     if (!obj->IsFiller()) { | 
| 120       ASSERT_OBJECT_SIZE(obj_size); | 120       ASSERT_OBJECT_SIZE(obj_size); | 
| 121       return obj; | 121       return obj; | 
| 122     } | 122     } | 
| 123   } | 123   } | 
| 124   return NULL; | 124   return NULL; | 
| 125 } | 125 } | 
| 126 | 126 | 
| 127 | 127 | 
| 128 // ----------------------------------------------------------------------------- |  | 
| 129 // MemoryAllocator |  | 
| 130 |  | 
| 131 #ifdef ENABLE_HEAP_PROTECTION |  | 
| 132 |  | 
| 133 void MemoryAllocator::Protect(Address start, size_t size) { |  | 
| 134   OS::Protect(start, size); |  | 
| 135 } |  | 
| 136 |  | 
| 137 |  | 
| 138 void MemoryAllocator::Unprotect(Address start, |  | 
| 139                                 size_t size, |  | 
| 140                                 Executability executable) { |  | 
| 141   OS::Unprotect(start, size, executable); |  | 
| 142 } |  | 
| 143 |  | 
| 144 |  | 
| 145 void MemoryAllocator::ProtectChunkFromPage(Page* page) { |  | 
| 146   int id = GetChunkId(page); |  | 
| 147   OS::Protect(chunks_[id].address(), chunks_[id].size()); |  | 
| 148 } |  | 
| 149 |  | 
| 150 |  | 
| 151 void MemoryAllocator::UnprotectChunkFromPage(Page* page) { |  | 
| 152   int id = GetChunkId(page); |  | 
| 153   OS::Unprotect(chunks_[id].address(), chunks_[id].size(), |  | 
| 154                 chunks_[id].owner()->executable() == EXECUTABLE); |  | 
| 155 } |  | 
| 156 |  | 
| 157 #endif |  | 
| 158 |  | 
| 159 |  | 
| 160 // -------------------------------------------------------------------------- | 128 // -------------------------------------------------------------------------- | 
| 161 // PagedSpace | 129 // PagedSpace | 
| 162 Page* Page::Initialize(Heap* heap, | 130 Page* Page::Initialize(Heap* heap, | 
| 163                        MemoryChunk* chunk, | 131                        MemoryChunk* chunk, | 
| 164                        Executability executable, | 132                        VirtualMemory::Executability executability, | 
| 165                        PagedSpace* owner) { | 133                        PagedSpace* owner) { | 
| 166   Page* page = reinterpret_cast<Page*>(chunk); | 134   Page* page = reinterpret_cast<Page*>(chunk); | 
| 167   ASSERT(page->area_size() <= kNonCodeObjectAreaSize); | 135   ASSERT(page->area_size() <= kNonCodeObjectAreaSize); | 
| 168   ASSERT(chunk->owner() == owner); | 136   ASSERT(chunk->owner() == owner); | 
| 169   owner->IncreaseCapacity(page->area_size()); | 137   owner->IncreaseCapacity(page->area_size()); | 
| 170   owner->Free(page->area_start(), page->area_size()); | 138   owner->Free(page->area_start(), page->area_size()); | 
| 171 | 139 | 
| 172   heap->incremental_marking()->SetOldSpacePageFlags(chunk); | 140   heap->incremental_marking()->SetOldSpacePageFlags(chunk); | 
| 173 | 141 | 
| 174   return page; | 142   return page; | 
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 355   Map* map = object->map(); | 323   Map* map = object->map(); | 
| 356   Heap* heap = object->GetHeap(); | 324   Heap* heap = object->GetHeap(); | 
| 357   return map == heap->raw_unchecked_free_space_map() | 325   return map == heap->raw_unchecked_free_space_map() | 
| 358       || map == heap->raw_unchecked_one_pointer_filler_map() | 326       || map == heap->raw_unchecked_one_pointer_filler_map() | 
| 359       || map == heap->raw_unchecked_two_pointer_filler_map(); | 327       || map == heap->raw_unchecked_two_pointer_filler_map(); | 
| 360 } | 328 } | 
| 361 | 329 | 
| 362 } }  // namespace v8::internal | 330 } }  // namespace v8::internal | 
| 363 | 331 | 
| 364 #endif  // V8_SPACES_INL_H_ | 332 #endif  // V8_SPACES_INL_H_ | 
| OLD | NEW | 
|---|