Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(613)

Side by Side Diff: src/heap.cc

Issue 7389008: Make Win64 compile. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ic.cc » ('j') | src/incremental-marking.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4974 matching lines...) Expand 10 before | Expand all | Expand 10 after
4985 4985
4986 // Initialize heap spaces and initial maps and objects. Whenever something 4986 // Initialize heap spaces and initial maps and objects. Whenever something
4987 // goes wrong, just return false. The caller should check the results and 4987 // goes wrong, just return false. The caller should check the results and
4988 // call Heap::TearDown() to release allocated memory. 4988 // call Heap::TearDown() to release allocated memory.
4989 // 4989 //
4990 // If the heap is not yet configured (eg, through the API), configure it. 4990 // If the heap is not yet configured (eg, through the API), configure it.
4991 // Configuration is based on the flags new-space-size (really the semispace 4991 // Configuration is based on the flags new-space-size (really the semispace
4992 // size) and old-space-size if set or the initial values of semispace_size_ 4992 // size) and old-space-size if set or the initial values of semispace_size_
4993 // and old_generation_size_ otherwise. 4993 // and old_generation_size_ otherwise.
4994 if (!configured_) { 4994 if (!configured_) {
4995 if (!ConfigureHeapDefault()) return false; 4995 if (!ConfigureHeapDefault()) {
Erik Corry 2011/07/15 21:37:33 This looks like an unnecessary change.
Lasse Reichstein 2011/08/01 12:40:33 Added to allow a breakpoint at the return. It's a
4996 return false;
4997 }
4996 } 4998 }
4997 4999
4998 gc_initializer_mutex->Lock(); 5000 gc_initializer_mutex->Lock();
4999 static bool initialized_gc = false; 5001 static bool initialized_gc = false;
5000 if (!initialized_gc) { 5002 if (!initialized_gc) {
5001 initialized_gc = true; 5003 initialized_gc = true;
5002 InitializeScavengingVisitorsTables(); 5004 InitializeScavengingVisitorsTables();
5003 NewSpaceScavenger::Initialize(); 5005 NewSpaceScavenger::Initialize();
5004 MarkCompactCollector::Initialize(); 5006 MarkCompactCollector::Initialize();
5005 } 5007 }
5006 gc_initializer_mutex->Unlock(); 5008 gc_initializer_mutex->Unlock();
5007 5009
5008 MarkMapPointersAsEncoded(false); 5010 MarkMapPointersAsEncoded(false);
5009 5011
5010 // Setup memory allocator. 5012 // Setup memory allocator.
5011 if (!isolate_->memory_allocator()->Setup(MaxReserved(), MaxExecutableSize())) 5013 if (!isolate_->memory_allocator()->
5012 return false; 5014 Setup(MaxReserved(), MaxExecutableSize())) {
5015 return false;
5016 }
5013 5017
5014 // Setup new space. 5018 // Setup new space.
5015 if (!new_space_.Setup(reserved_semispace_size_)) { 5019 if (!new_space_.Setup(reserved_semispace_size_)) {
5016 return false; 5020 return false;
5017 } 5021 }
5018 5022
5019 // Initialize old pointer space. 5023 // Initialize old pointer space.
5020 old_pointer_space_ = 5024 old_pointer_space_ =
5021 new OldSpace(this, 5025 new OldSpace(this,
5022 max_old_generation_size_, 5026 max_old_generation_size_,
5023 OLD_POINTER_SPACE, 5027 OLD_POINTER_SPACE,
5024 NOT_EXECUTABLE); 5028 NOT_EXECUTABLE);
5025 if (old_pointer_space_ == NULL) return false; 5029 if (old_pointer_space_ == NULL || !old_pointer_space_->Setup()) {
5026 if (!old_pointer_space_->Setup()) return false; 5030 return false;
5031 }
5027 5032
5028 // Initialize old data space. 5033 // Initialize old data space.
5029 old_data_space_ = 5034 old_data_space_ =
5030 new OldSpace(this, 5035 new OldSpace(this,
5031 max_old_generation_size_, 5036 max_old_generation_size_,
5032 OLD_DATA_SPACE, 5037 OLD_DATA_SPACE,
5033 NOT_EXECUTABLE); 5038 NOT_EXECUTABLE);
5034 if (old_data_space_ == NULL) return false; 5039 if (old_data_space_ == NULL || !old_data_space_->Setup()) {
5035 if (!old_data_space_->Setup()) return false; 5040 return false;
5041 }
5036 5042
5037 // Initialize the code space, set its maximum capacity to the old 5043 // Initialize the code space, set its maximum capacity to the old
5038 // generation size. It needs executable memory. 5044 // generation size. It needs executable memory.
5039 // On 64-bit platform(s), we put all code objects in a 2 GB range of 5045 // On 64-bit platform(s), we put all code objects in a 2 GB range of
5040 // virtual address space, so that they can call each other with near calls. 5046 // virtual address space, so that they can call each other with near calls.
5041 if (code_range_size_ > 0) { 5047 if (code_range_size_ > 0) {
5042 if (!isolate_->code_range()->Setup(code_range_size_)) { 5048 if (!isolate_->code_range()->Setup(code_range_size_)) {
5043 return false; 5049 return false;
5044 } 5050 }
5045 } 5051 }
5046 5052
5047 code_space_ = 5053 code_space_ =
5048 new OldSpace(this, max_old_generation_size_, CODE_SPACE, EXECUTABLE); 5054 new OldSpace(this, max_old_generation_size_, CODE_SPACE, EXECUTABLE);
5049 if (code_space_ == NULL) return false; 5055 if (code_space_ == NULL || !code_space_->Setup()) {
Erik Corry 2011/07/15 21:37:33 These all fit on one line.
5050 if (!code_space_->Setup()) return false; 5056 return false;
5057 }
5051 5058
5052 // Initialize map space. 5059 // Initialize map space.
5053 map_space_ = new MapSpace(this, 5060 map_space_ = new MapSpace(this,
5054 max_old_generation_size_, 5061 max_old_generation_size_,
5055 FLAG_max_map_space_pages, 5062 FLAG_max_map_space_pages,
5056 MAP_SPACE); 5063 MAP_SPACE);
5057 if (map_space_ == NULL) return false; 5064 if (map_space_ == NULL || !map_space_->Setup()) {
5058 if (!map_space_->Setup()) return false; 5065 return false;
5066 }
5059 5067
5060 // Initialize global property cell space. 5068 // Initialize global property cell space.
5061 cell_space_ = new CellSpace(this, max_old_generation_size_, CELL_SPACE); 5069 cell_space_ = new CellSpace(this, max_old_generation_size_, CELL_SPACE);
5062 if (cell_space_ == NULL) return false; 5070 if (cell_space_ == NULL || !cell_space_->Setup()) {
5063 if (!cell_space_->Setup()) return false; 5071 return false;
5072 }
5064 5073
5065 // The large object code space may contain code or data. We set the memory 5074 // The large object code space may contain code or data. We set the memory
5066 // to be non-executable here for safety, but this means we need to enable it 5075 // to be non-executable here for safety, but this means we need to enable it
5067 // explicitly when allocating large code objects. 5076 // explicitly when allocating large code objects.
5068 lo_space_ = new LargeObjectSpace(this, LO_SPACE); 5077 lo_space_ = new LargeObjectSpace(this, LO_SPACE);
5069 if (lo_space_ == NULL) return false; 5078 if (lo_space_ == NULL || !lo_space_->Setup()) {
5070 if (!lo_space_->Setup()) return false; 5079 return false;
5080 }
5071 if (create_heap_objects) { 5081 if (create_heap_objects) {
5072 // Create initial maps. 5082 // Create initial maps.
5073 if (!CreateInitialMaps()) return false; 5083 if (!CreateInitialMaps()) {
5074 if (!CreateApiObjects()) return false; 5084 return false;
5085 }
5086 if (!CreateApiObjects()) {
5087 return false;
5088 }
5075 5089
5076 // Create initial objects 5090 // Create initial objects
5077 if (!CreateInitialObjects()) return false; 5091 if (!CreateInitialObjects()) {
5092 return false;
5093 }
5078 5094
5079 global_contexts_list_ = undefined_value(); 5095 global_contexts_list_ = undefined_value();
5080 } 5096 }
5081 5097
5082 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity())); 5098 LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity()));
5083 LOG(isolate_, IntPtrTEvent("heap-available", Available())); 5099 LOG(isolate_, IntPtrTEvent("heap-available", Available()));
5084 5100
5085 store_buffer()->Setup(); 5101 store_buffer()->Setup();
5086 5102
5087 return true; 5103 return true;
5088 } 5104 }
5089 5105
5090 5106
5091 void Heap::SetStackLimits() { 5107 void Heap::SetStackLimits() {
5092 ASSERT(isolate_ != NULL); 5108 ASSERT(isolate_ != NULL);
5093 ASSERT(isolate_ == isolate()); 5109 CHECK_EQ(isolate_, isolate());
Lasse Reichstein 2011/08/01 12:40:33 This should probably have been ASSERT_EQ.
5094 // On 64 bit machines, pointers are generally out of range of Smis. We write 5110 // On 64 bit machines, pointers are generally out of range of Smis. We write
5095 // something that looks like an out of range Smi to the GC. 5111 // something that looks like an out of range Smi to the GC.
5096 5112
5097 // Set up the special root array entries containing the stack limits. 5113 // Set up the special root array entries containing the stack limits.
5098 // These are actually addresses, but the tag makes the GC ignore it. 5114 // These are actually addresses, but the tag makes the GC ignore it.
5099 roots_[kStackLimitRootIndex] = 5115 roots_[kStackLimitRootIndex] =
5100 reinterpret_cast<Object*>( 5116 reinterpret_cast<Object*>(
5101 (isolate_->stack_guard()->jslimit() & ~kSmiTagMask) | kSmiTag); 5117 (isolate_->stack_guard()->jslimit() & ~kSmiTagMask) | kSmiTag);
5102 roots_[kRealStackLimitRootIndex] = 5118 roots_[kRealStackLimitRootIndex] =
5103 reinterpret_cast<Object*>( 5119 reinterpret_cast<Object*>(
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
6003 } 6019 }
6004 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); 6020 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED);
6005 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { 6021 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) {
6006 next = chunk->next_chunk(); 6022 next = chunk->next_chunk();
6007 isolate_->memory_allocator()->Free(chunk); 6023 isolate_->memory_allocator()->Free(chunk);
6008 } 6024 }
6009 chunks_queued_for_free_ = NULL; 6025 chunks_queued_for_free_ = NULL;
6010 } 6026 }
6011 6027
6012 } } // namespace v8::internal 6028 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/ic.cc » ('j') | src/incremental-marking.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698