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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 169 } |
170 | 170 |
171 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); | 171 memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); |
172 global_contexts_list_ = NULL; | 172 global_contexts_list_ = NULL; |
173 mark_compact_collector_.heap_ = this; | 173 mark_compact_collector_.heap_ = this; |
174 external_string_table_.heap_ = this; | 174 external_string_table_.heap_ = this; |
175 } | 175 } |
176 | 176 |
177 | 177 |
178 intptr_t Heap::Capacity() { | 178 intptr_t Heap::Capacity() { |
179 if (!HasBeenSetup()) return 0; | 179 if (!HasBeenSetUp()) return 0; |
180 | 180 |
181 return new_space_.Capacity() + | 181 return new_space_.Capacity() + |
182 old_pointer_space_->Capacity() + | 182 old_pointer_space_->Capacity() + |
183 old_data_space_->Capacity() + | 183 old_data_space_->Capacity() + |
184 code_space_->Capacity() + | 184 code_space_->Capacity() + |
185 map_space_->Capacity() + | 185 map_space_->Capacity() + |
186 cell_space_->Capacity(); | 186 cell_space_->Capacity(); |
187 } | 187 } |
188 | 188 |
189 | 189 |
190 intptr_t Heap::CommittedMemory() { | 190 intptr_t Heap::CommittedMemory() { |
191 if (!HasBeenSetup()) return 0; | 191 if (!HasBeenSetUp()) return 0; |
192 | 192 |
193 return new_space_.CommittedMemory() + | 193 return new_space_.CommittedMemory() + |
194 old_pointer_space_->CommittedMemory() + | 194 old_pointer_space_->CommittedMemory() + |
195 old_data_space_->CommittedMemory() + | 195 old_data_space_->CommittedMemory() + |
196 code_space_->CommittedMemory() + | 196 code_space_->CommittedMemory() + |
197 map_space_->CommittedMemory() + | 197 map_space_->CommittedMemory() + |
198 cell_space_->CommittedMemory() + | 198 cell_space_->CommittedMemory() + |
199 lo_space_->Size(); | 199 lo_space_->Size(); |
200 } | 200 } |
201 | 201 |
202 intptr_t Heap::CommittedMemoryExecutable() { | 202 intptr_t Heap::CommittedMemoryExecutable() { |
203 if (!HasBeenSetup()) return 0; | 203 if (!HasBeenSetUp()) return 0; |
204 | 204 |
205 return isolate()->memory_allocator()->SizeExecutable(); | 205 return isolate()->memory_allocator()->SizeExecutable(); |
206 } | 206 } |
207 | 207 |
208 | 208 |
209 intptr_t Heap::Available() { | 209 intptr_t Heap::Available() { |
210 if (!HasBeenSetup()) return 0; | 210 if (!HasBeenSetUp()) return 0; |
211 | 211 |
212 return new_space_.Available() + | 212 return new_space_.Available() + |
213 old_pointer_space_->Available() + | 213 old_pointer_space_->Available() + |
214 old_data_space_->Available() + | 214 old_data_space_->Available() + |
215 code_space_->Available() + | 215 code_space_->Available() + |
216 map_space_->Available() + | 216 map_space_->Available() + |
217 cell_space_->Available(); | 217 cell_space_->Available(); |
218 } | 218 } |
219 | 219 |
220 | 220 |
221 bool Heap::HasBeenSetup() { | 221 bool Heap::HasBeenSetUp() { |
222 return old_pointer_space_ != NULL && | 222 return old_pointer_space_ != NULL && |
223 old_data_space_ != NULL && | 223 old_data_space_ != NULL && |
224 code_space_ != NULL && | 224 code_space_ != NULL && |
225 map_space_ != NULL && | 225 map_space_ != NULL && |
226 cell_space_ != NULL && | 226 cell_space_ != NULL && |
227 lo_space_ != NULL; | 227 lo_space_ != NULL; |
228 } | 228 } |
229 | 229 |
230 | 230 |
231 int Heap::GcSafeSizeOfOldObject(HeapObject* object) { | 231 int Heap::GcSafeSizeOfOldObject(HeapObject* object) { |
(...skipping 3555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3787 } | 3787 } |
3788 JSObject* global = JSObject::cast(obj); | 3788 JSObject* global = JSObject::cast(obj); |
3789 InitializeJSObjectFromMap(global, dictionary, map); | 3789 InitializeJSObjectFromMap(global, dictionary, map); |
3790 | 3790 |
3791 // Create a new map for the global object. | 3791 // Create a new map for the global object. |
3792 { MaybeObject* maybe_obj = map->CopyDropDescriptors(); | 3792 { MaybeObject* maybe_obj = map->CopyDropDescriptors(); |
3793 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 3793 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
3794 } | 3794 } |
3795 Map* new_map = Map::cast(obj); | 3795 Map* new_map = Map::cast(obj); |
3796 | 3796 |
3797 // Setup the global object as a normalized object. | 3797 // Set up the global object as a normalized object. |
3798 global->set_map(new_map); | 3798 global->set_map(new_map); |
3799 global->map()->clear_instance_descriptors(); | 3799 global->map()->clear_instance_descriptors(); |
3800 global->set_properties(dictionary); | 3800 global->set_properties(dictionary); |
3801 | 3801 |
3802 // Make sure result is a global object with properties in dictionary. | 3802 // Make sure result is a global object with properties in dictionary. |
3803 ASSERT(global->IsGlobalObject()); | 3803 ASSERT(global->IsGlobalObject()); |
3804 ASSERT(!global->HasFastProperties()); | 3804 ASSERT(!global->HasFastProperties()); |
3805 return global; | 3805 return global; |
3806 } | 3806 } |
3807 | 3807 |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4720 ASSERT((contexts_disposed_ == 0) || !incremental_marking()->IsStopped()); | 4720 ASSERT((contexts_disposed_ == 0) || !incremental_marking()->IsStopped()); |
4721 if (uncommit) UncommitFromSpace(); | 4721 if (uncommit) UncommitFromSpace(); |
4722 | 4722 |
4723 return finished; | 4723 return finished; |
4724 } | 4724 } |
4725 | 4725 |
4726 | 4726 |
4727 #ifdef DEBUG | 4727 #ifdef DEBUG |
4728 | 4728 |
4729 void Heap::Print() { | 4729 void Heap::Print() { |
4730 if (!HasBeenSetup()) return; | 4730 if (!HasBeenSetUp()) return; |
4731 isolate()->PrintStack(); | 4731 isolate()->PrintStack(); |
4732 AllSpaces spaces; | 4732 AllSpaces spaces; |
4733 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) | 4733 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) |
4734 space->Print(); | 4734 space->Print(); |
4735 } | 4735 } |
4736 | 4736 |
4737 | 4737 |
4738 void Heap::ReportCodeStatistics(const char* title) { | 4738 void Heap::ReportCodeStatistics(const char* title) { |
4739 PrintF(">>>>>> Code Stats (%s) >>>>>>\n", title); | 4739 PrintF(">>>>>> Code Stats (%s) >>>>>>\n", title); |
4740 PagedSpace::ResetCodeStatistics(); | 4740 PagedSpace::ResetCodeStatistics(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4785 | 4785 |
4786 #endif // DEBUG | 4786 #endif // DEBUG |
4787 | 4787 |
4788 bool Heap::Contains(HeapObject* value) { | 4788 bool Heap::Contains(HeapObject* value) { |
4789 return Contains(value->address()); | 4789 return Contains(value->address()); |
4790 } | 4790 } |
4791 | 4791 |
4792 | 4792 |
4793 bool Heap::Contains(Address addr) { | 4793 bool Heap::Contains(Address addr) { |
4794 if (OS::IsOutsideAllocatedSpace(addr)) return false; | 4794 if (OS::IsOutsideAllocatedSpace(addr)) return false; |
4795 return HasBeenSetup() && | 4795 return HasBeenSetUp() && |
4796 (new_space_.ToSpaceContains(addr) || | 4796 (new_space_.ToSpaceContains(addr) || |
4797 old_pointer_space_->Contains(addr) || | 4797 old_pointer_space_->Contains(addr) || |
4798 old_data_space_->Contains(addr) || | 4798 old_data_space_->Contains(addr) || |
4799 code_space_->Contains(addr) || | 4799 code_space_->Contains(addr) || |
4800 map_space_->Contains(addr) || | 4800 map_space_->Contains(addr) || |
4801 cell_space_->Contains(addr) || | 4801 cell_space_->Contains(addr) || |
4802 lo_space_->SlowContains(addr)); | 4802 lo_space_->SlowContains(addr)); |
4803 } | 4803 } |
4804 | 4804 |
4805 | 4805 |
4806 bool Heap::InSpace(HeapObject* value, AllocationSpace space) { | 4806 bool Heap::InSpace(HeapObject* value, AllocationSpace space) { |
4807 return InSpace(value->address(), space); | 4807 return InSpace(value->address(), space); |
4808 } | 4808 } |
4809 | 4809 |
4810 | 4810 |
4811 bool Heap::InSpace(Address addr, AllocationSpace space) { | 4811 bool Heap::InSpace(Address addr, AllocationSpace space) { |
4812 if (OS::IsOutsideAllocatedSpace(addr)) return false; | 4812 if (OS::IsOutsideAllocatedSpace(addr)) return false; |
4813 if (!HasBeenSetup()) return false; | 4813 if (!HasBeenSetUp()) return false; |
4814 | 4814 |
4815 switch (space) { | 4815 switch (space) { |
4816 case NEW_SPACE: | 4816 case NEW_SPACE: |
4817 return new_space_.ToSpaceContains(addr); | 4817 return new_space_.ToSpaceContains(addr); |
4818 case OLD_POINTER_SPACE: | 4818 case OLD_POINTER_SPACE: |
4819 return old_pointer_space_->Contains(addr); | 4819 return old_pointer_space_->Contains(addr); |
4820 case OLD_DATA_SPACE: | 4820 case OLD_DATA_SPACE: |
4821 return old_data_space_->Contains(addr); | 4821 return old_data_space_->Contains(addr); |
4822 case CODE_SPACE: | 4822 case CODE_SPACE: |
4823 return code_space_->Contains(addr); | 4823 return code_space_->Contains(addr); |
4824 case MAP_SPACE: | 4824 case MAP_SPACE: |
4825 return map_space_->Contains(addr); | 4825 return map_space_->Contains(addr); |
4826 case CELL_SPACE: | 4826 case CELL_SPACE: |
4827 return cell_space_->Contains(addr); | 4827 return cell_space_->Contains(addr); |
4828 case LO_SPACE: | 4828 case LO_SPACE: |
4829 return lo_space_->SlowContains(addr); | 4829 return lo_space_->SlowContains(addr); |
4830 } | 4830 } |
4831 | 4831 |
4832 return false; | 4832 return false; |
4833 } | 4833 } |
4834 | 4834 |
4835 | 4835 |
4836 #ifdef DEBUG | 4836 #ifdef DEBUG |
4837 void Heap::Verify() { | 4837 void Heap::Verify() { |
4838 ASSERT(HasBeenSetup()); | 4838 ASSERT(HasBeenSetUp()); |
4839 | 4839 |
4840 store_buffer()->Verify(); | 4840 store_buffer()->Verify(); |
4841 | 4841 |
4842 VerifyPointersVisitor visitor; | 4842 VerifyPointersVisitor visitor; |
4843 IterateRoots(&visitor, VISIT_ONLY_STRONG); | 4843 IterateRoots(&visitor, VISIT_ONLY_STRONG); |
4844 | 4844 |
4845 new_space_.Verify(); | 4845 new_space_.Verify(); |
4846 | 4846 |
4847 old_pointer_space_->Verify(&visitor); | 4847 old_pointer_space_->Verify(&visitor); |
4848 map_space_->Verify(&visitor); | 4848 map_space_->Verify(&visitor); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5255 // checking of the sync flag in the snapshot would fail. | 5255 // checking of the sync flag in the snapshot would fail. |
5256 } | 5256 } |
5257 | 5257 |
5258 | 5258 |
5259 // TODO(1236194): Since the heap size is configurable on the command line | 5259 // TODO(1236194): Since the heap size is configurable on the command line |
5260 // and through the API, we should gracefully handle the case that the heap | 5260 // and through the API, we should gracefully handle the case that the heap |
5261 // size is not big enough to fit all the initial objects. | 5261 // size is not big enough to fit all the initial objects. |
5262 bool Heap::ConfigureHeap(int max_semispace_size, | 5262 bool Heap::ConfigureHeap(int max_semispace_size, |
5263 intptr_t max_old_gen_size, | 5263 intptr_t max_old_gen_size, |
5264 intptr_t max_executable_size) { | 5264 intptr_t max_executable_size) { |
5265 if (HasBeenSetup()) return false; | 5265 if (HasBeenSetUp()) return false; |
5266 | 5266 |
5267 if (max_semispace_size > 0) { | 5267 if (max_semispace_size > 0) { |
5268 if (max_semispace_size < Page::kPageSize) { | 5268 if (max_semispace_size < Page::kPageSize) { |
5269 max_semispace_size = Page::kPageSize; | 5269 max_semispace_size = Page::kPageSize; |
5270 if (FLAG_trace_gc) { | 5270 if (FLAG_trace_gc) { |
5271 PrintF("Max semispace size cannot be less than %dkbytes\n", | 5271 PrintF("Max semispace size cannot be less than %dkbytes\n", |
5272 Page::kPageSize >> 10); | 5272 Page::kPageSize >> 10); |
5273 } | 5273 } |
5274 } | 5274 } |
5275 max_semispace_size_ = max_semispace_size; | 5275 max_semispace_size_ = max_semispace_size; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5544 Object* search_target_; | 5544 Object* search_target_; |
5545 bool found_target_; | 5545 bool found_target_; |
5546 List<Object*> object_stack_; | 5546 List<Object*> object_stack_; |
5547 Heap* heap_; | 5547 Heap* heap_; |
5548 | 5548 |
5549 friend class Heap; | 5549 friend class Heap; |
5550 }; | 5550 }; |
5551 | 5551 |
5552 #endif | 5552 #endif |
5553 | 5553 |
5554 bool Heap::Setup(bool create_heap_objects) { | 5554 bool Heap::SetUp(bool create_heap_objects) { |
5555 #ifdef DEBUG | 5555 #ifdef DEBUG |
5556 allocation_timeout_ = FLAG_gc_interval; | 5556 allocation_timeout_ = FLAG_gc_interval; |
5557 debug_utils_ = new HeapDebugUtils(this); | 5557 debug_utils_ = new HeapDebugUtils(this); |
5558 #endif | 5558 #endif |
5559 | 5559 |
5560 // Initialize heap spaces and initial maps and objects. Whenever something | 5560 // Initialize heap spaces and initial maps and objects. Whenever something |
5561 // goes wrong, just return false. The caller should check the results and | 5561 // goes wrong, just return false. The caller should check the results and |
5562 // call Heap::TearDown() to release allocated memory. | 5562 // call Heap::TearDown() to release allocated memory. |
5563 // | 5563 // |
5564 // If the heap is not yet configured (eg, through the API), configure it. | 5564 // If the heap is not yet configured (eg, through the API), configure it. |
5565 // Configuration is based on the flags new-space-size (really the semispace | 5565 // Configuration is based on the flags new-space-size (really the semispace |
5566 // size) and old-space-size if set or the initial values of semispace_size_ | 5566 // size) and old-space-size if set or the initial values of semispace_size_ |
5567 // and old_generation_size_ otherwise. | 5567 // and old_generation_size_ otherwise. |
5568 if (!configured_) { | 5568 if (!configured_) { |
5569 if (!ConfigureHeapDefault()) return false; | 5569 if (!ConfigureHeapDefault()) return false; |
5570 } | 5570 } |
5571 | 5571 |
5572 gc_initializer_mutex->Lock(); | 5572 gc_initializer_mutex->Lock(); |
5573 static bool initialized_gc = false; | 5573 static bool initialized_gc = false; |
5574 if (!initialized_gc) { | 5574 if (!initialized_gc) { |
5575 initialized_gc = true; | 5575 initialized_gc = true; |
5576 InitializeScavengingVisitorsTables(); | 5576 InitializeScavengingVisitorsTables(); |
5577 NewSpaceScavenger::Initialize(); | 5577 NewSpaceScavenger::Initialize(); |
5578 MarkCompactCollector::Initialize(); | 5578 MarkCompactCollector::Initialize(); |
5579 } | 5579 } |
5580 gc_initializer_mutex->Unlock(); | 5580 gc_initializer_mutex->Unlock(); |
5581 | 5581 |
5582 MarkMapPointersAsEncoded(false); | 5582 MarkMapPointersAsEncoded(false); |
5583 | 5583 |
5584 // Setup memory allocator. | 5584 // Set up memory allocator. |
5585 if (!isolate_->memory_allocator()->Setup(MaxReserved(), MaxExecutableSize())) | 5585 if (!isolate_->memory_allocator()->SetUp(MaxReserved(), MaxExecutableSize())) |
5586 return false; | 5586 return false; |
5587 | 5587 |
5588 // Setup new space. | 5588 // Set up new space. |
5589 if (!new_space_.Setup(reserved_semispace_size_, max_semispace_size_)) { | 5589 if (!new_space_.SetUp(reserved_semispace_size_, max_semispace_size_)) { |
5590 return false; | 5590 return false; |
5591 } | 5591 } |
5592 | 5592 |
5593 // Initialize old pointer space. | 5593 // Initialize old pointer space. |
5594 old_pointer_space_ = | 5594 old_pointer_space_ = |
5595 new OldSpace(this, | 5595 new OldSpace(this, |
5596 max_old_generation_size_, | 5596 max_old_generation_size_, |
5597 OLD_POINTER_SPACE, | 5597 OLD_POINTER_SPACE, |
5598 NOT_EXECUTABLE); | 5598 NOT_EXECUTABLE); |
5599 if (old_pointer_space_ == NULL) return false; | 5599 if (old_pointer_space_ == NULL) return false; |
5600 if (!old_pointer_space_->Setup()) return false; | 5600 if (!old_pointer_space_->SetUp()) return false; |
5601 | 5601 |
5602 // Initialize old data space. | 5602 // Initialize old data space. |
5603 old_data_space_ = | 5603 old_data_space_ = |
5604 new OldSpace(this, | 5604 new OldSpace(this, |
5605 max_old_generation_size_, | 5605 max_old_generation_size_, |
5606 OLD_DATA_SPACE, | 5606 OLD_DATA_SPACE, |
5607 NOT_EXECUTABLE); | 5607 NOT_EXECUTABLE); |
5608 if (old_data_space_ == NULL) return false; | 5608 if (old_data_space_ == NULL) return false; |
5609 if (!old_data_space_->Setup()) return false; | 5609 if (!old_data_space_->SetUp()) return false; |
5610 | 5610 |
5611 // Initialize the code space, set its maximum capacity to the old | 5611 // Initialize the code space, set its maximum capacity to the old |
5612 // generation size. It needs executable memory. | 5612 // generation size. It needs executable memory. |
5613 // On 64-bit platform(s), we put all code objects in a 2 GB range of | 5613 // On 64-bit platform(s), we put all code objects in a 2 GB range of |
5614 // virtual address space, so that they can call each other with near calls. | 5614 // virtual address space, so that they can call each other with near calls. |
5615 if (code_range_size_ > 0) { | 5615 if (code_range_size_ > 0) { |
5616 if (!isolate_->code_range()->Setup(code_range_size_)) { | 5616 if (!isolate_->code_range()->SetUp(code_range_size_)) { |
5617 return false; | 5617 return false; |
5618 } | 5618 } |
5619 } | 5619 } |
5620 | 5620 |
5621 code_space_ = | 5621 code_space_ = |
5622 new OldSpace(this, max_old_generation_size_, CODE_SPACE, EXECUTABLE); | 5622 new OldSpace(this, max_old_generation_size_, CODE_SPACE, EXECUTABLE); |
5623 if (code_space_ == NULL) return false; | 5623 if (code_space_ == NULL) return false; |
5624 if (!code_space_->Setup()) return false; | 5624 if (!code_space_->SetUp()) return false; |
5625 | 5625 |
5626 // Initialize map space. | 5626 // Initialize map space. |
5627 map_space_ = new MapSpace(this, | 5627 map_space_ = new MapSpace(this, |
5628 max_old_generation_size_, | 5628 max_old_generation_size_, |
5629 FLAG_max_map_space_pages, | 5629 FLAG_max_map_space_pages, |
5630 MAP_SPACE); | 5630 MAP_SPACE); |
5631 if (map_space_ == NULL) return false; | 5631 if (map_space_ == NULL) return false; |
5632 if (!map_space_->Setup()) return false; | 5632 if (!map_space_->SetUp()) return false; |
5633 | 5633 |
5634 // Initialize global property cell space. | 5634 // Initialize global property cell space. |
5635 cell_space_ = new CellSpace(this, max_old_generation_size_, CELL_SPACE); | 5635 cell_space_ = new CellSpace(this, max_old_generation_size_, CELL_SPACE); |
5636 if (cell_space_ == NULL) return false; | 5636 if (cell_space_ == NULL) return false; |
5637 if (!cell_space_->Setup()) return false; | 5637 if (!cell_space_->SetUp()) return false; |
5638 | 5638 |
5639 // The large object code space may contain code or data. We set the memory | 5639 // The large object code space may contain code or data. We set the memory |
5640 // to be non-executable here for safety, but this means we need to enable it | 5640 // to be non-executable here for safety, but this means we need to enable it |
5641 // explicitly when allocating large code objects. | 5641 // explicitly when allocating large code objects. |
5642 lo_space_ = new LargeObjectSpace(this, max_old_generation_size_, LO_SPACE); | 5642 lo_space_ = new LargeObjectSpace(this, max_old_generation_size_, LO_SPACE); |
5643 if (lo_space_ == NULL) return false; | 5643 if (lo_space_ == NULL) return false; |
5644 if (!lo_space_->Setup()) return false; | 5644 if (!lo_space_->SetUp()) return false; |
5645 | 5645 |
5646 // Setup the seed that is used to randomize the string hash function. | 5646 // Set up the seed that is used to randomize the string hash function. |
5647 ASSERT(hash_seed() == 0); | 5647 ASSERT(hash_seed() == 0); |
5648 if (FLAG_randomize_hashes) { | 5648 if (FLAG_randomize_hashes) { |
5649 if (FLAG_hash_seed == 0) { | 5649 if (FLAG_hash_seed == 0) { |
5650 set_hash_seed( | 5650 set_hash_seed( |
5651 Smi::FromInt(V8::RandomPrivate(isolate()) & 0x3fffffff)); | 5651 Smi::FromInt(V8::RandomPrivate(isolate()) & 0x3fffffff)); |
5652 } else { | 5652 } else { |
5653 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); | 5653 set_hash_seed(Smi::FromInt(FLAG_hash_seed)); |
5654 } | 5654 } |
5655 } | 5655 } |
5656 | 5656 |
5657 if (create_heap_objects) { | 5657 if (create_heap_objects) { |
5658 // Create initial maps. | 5658 // Create initial maps. |
5659 if (!CreateInitialMaps()) return false; | 5659 if (!CreateInitialMaps()) return false; |
5660 if (!CreateApiObjects()) return false; | 5660 if (!CreateApiObjects()) return false; |
5661 | 5661 |
5662 // Create initial objects | 5662 // Create initial objects |
5663 if (!CreateInitialObjects()) return false; | 5663 if (!CreateInitialObjects()) return false; |
5664 | 5664 |
5665 global_contexts_list_ = undefined_value(); | 5665 global_contexts_list_ = undefined_value(); |
5666 } | 5666 } |
5667 | 5667 |
5668 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); | 5668 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); |
5669 LOG(isolate_, IntPtrTEvent("heap-available", Available())); | 5669 LOG(isolate_, IntPtrTEvent("heap-available", Available())); |
5670 | 5670 |
5671 store_buffer()->Setup(); | 5671 store_buffer()->SetUp(); |
5672 | 5672 |
5673 return true; | 5673 return true; |
5674 } | 5674 } |
5675 | 5675 |
5676 | 5676 |
5677 void Heap::SetStackLimits() { | 5677 void Heap::SetStackLimits() { |
5678 ASSERT(isolate_ != NULL); | 5678 ASSERT(isolate_ != NULL); |
5679 ASSERT(isolate_ == isolate()); | 5679 ASSERT(isolate_ == isolate()); |
5680 // On 64 bit machines, pointers are generally out of range of Smis. We write | 5680 // On 64 bit machines, pointers are generally out of range of Smis. We write |
5681 // something that looks like an out of range Smi to the GC. | 5681 // something that looks like an out of range Smi to the GC. |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6619 isolate_->heap()->store_buffer()->Compact(); | 6619 isolate_->heap()->store_buffer()->Compact(); |
6620 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6620 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
6621 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6621 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
6622 next = chunk->next_chunk(); | 6622 next = chunk->next_chunk(); |
6623 isolate_->memory_allocator()->Free(chunk); | 6623 isolate_->memory_allocator()->Free(chunk); |
6624 } | 6624 } |
6625 chunks_queued_for_free_ = NULL; | 6625 chunks_queued_for_free_ = NULL; |
6626 } | 6626 } |
6627 | 6627 |
6628 } } // namespace v8::internal | 6628 } } // namespace v8::internal |
OLD | NEW |