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

Side by Side Diff: src/spaces.cc

Issue 228923002: Allow the embedder to pass the virtual memory limit to v8 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 8 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
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 : isolate_(isolate), 128 : isolate_(isolate),
129 code_range_(NULL), 129 code_range_(NULL),
130 free_list_(0), 130 free_list_(0),
131 allocation_list_(0), 131 allocation_list_(0),
132 current_allocation_block_index_(0) { 132 current_allocation_block_index_(0) {
133 } 133 }
134 134
135 135
136 bool CodeRange::SetUp(const size_t requested) { 136 bool CodeRange::SetUp(const size_t requested) {
137 ASSERT(code_range_ == NULL); 137 ASSERT(code_range_ == NULL);
138 size_t actual_requested = requested;
Michael Starzinger 2014/04/09 12:03:04 nit: Instead of having two variables "actual_reque
jochen (gone - plz use gerrit) 2014/04/09 12:44:56 Done.
138 139
139 code_range_ = new VirtualMemory(requested); 140 if (actual_requested == 0) {
141 if (kIs64BitArch) {
142 actual_requested = 512 * MB;
143 } else {
144 return true;
145 }
146 }
147
148 code_range_ = new VirtualMemory(actual_requested);
140 CHECK(code_range_ != NULL); 149 CHECK(code_range_ != NULL);
141 if (!code_range_->IsReserved()) { 150 if (!code_range_->IsReserved()) {
142 delete code_range_; 151 delete code_range_;
143 code_range_ = NULL; 152 code_range_ = NULL;
144 return false; 153 return false;
145 } 154 }
146 155
147 // We are sure that we have mapped a block of requested addresses. 156 // We are sure that we have mapped a block of requested addresses.
148 ASSERT(code_range_->size() == requested); 157 ASSERT(code_range_->size() == actual_requested);
149 LOG(isolate_, NewEvent("CodeRange", code_range_->address(), requested)); 158 LOG(isolate_,
159 NewEvent("CodeRange", code_range_->address(), actual_requested));
150 Address base = reinterpret_cast<Address>(code_range_->address()); 160 Address base = reinterpret_cast<Address>(code_range_->address());
151 Address aligned_base = 161 Address aligned_base =
152 RoundUp(reinterpret_cast<Address>(code_range_->address()), 162 RoundUp(reinterpret_cast<Address>(code_range_->address()),
153 MemoryChunk::kAlignment); 163 MemoryChunk::kAlignment);
154 size_t size = code_range_->size() - (aligned_base - base); 164 size_t size = code_range_->size() - (aligned_base - base);
155 allocation_list_.Add(FreeBlock(aligned_base, size)); 165 allocation_list_.Add(FreeBlock(aligned_base, size));
156 current_allocation_block_index_ = 0; 166 current_allocation_block_index_ = 0;
157 return true; 167 return true;
158 } 168 }
159 169
(...skipping 3042 matching lines...) Expand 10 before | Expand all | Expand 10 after
3202 object->ShortPrint(); 3212 object->ShortPrint();
3203 PrintF("\n"); 3213 PrintF("\n");
3204 } 3214 }
3205 printf(" --------------------------------------\n"); 3215 printf(" --------------------------------------\n");
3206 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3216 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3207 } 3217 }
3208 3218
3209 #endif // DEBUG 3219 #endif // DEBUG
3210 3220
3211 } } // namespace v8::internal 3221 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698