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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 CodeRange::CodeRange(Isolate* isolate) | 127 CodeRange::CodeRange(Isolate* isolate) |
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(size_t requested) { |
137 ASSERT(code_range_ == NULL); | 137 ASSERT(code_range_ == NULL); |
138 | 138 |
| 139 if (requested == 0) { |
| 140 // On 64-bit platform(s), we put all code objects in a 512 MB range of |
| 141 // virtual address space, so that they can call each other with near calls. |
| 142 if (kIs64BitArch) { |
| 143 requested = 512 * MB; |
| 144 } else { |
| 145 return true; |
| 146 } |
| 147 } |
| 148 |
139 code_range_ = new VirtualMemory(requested); | 149 code_range_ = new VirtualMemory(requested); |
140 CHECK(code_range_ != NULL); | 150 CHECK(code_range_ != NULL); |
141 if (!code_range_->IsReserved()) { | 151 if (!code_range_->IsReserved()) { |
142 delete code_range_; | 152 delete code_range_; |
143 code_range_ = NULL; | 153 code_range_ = NULL; |
144 return false; | 154 return false; |
145 } | 155 } |
146 | 156 |
147 // We are sure that we have mapped a block of requested addresses. | 157 // We are sure that we have mapped a block of requested addresses. |
148 ASSERT(code_range_->size() == requested); | 158 ASSERT(code_range_->size() == requested); |
149 LOG(isolate_, NewEvent("CodeRange", code_range_->address(), requested)); | 159 LOG(isolate_, |
| 160 NewEvent("CodeRange", code_range_->address(), requested)); |
150 Address base = reinterpret_cast<Address>(code_range_->address()); | 161 Address base = reinterpret_cast<Address>(code_range_->address()); |
151 Address aligned_base = | 162 Address aligned_base = |
152 RoundUp(reinterpret_cast<Address>(code_range_->address()), | 163 RoundUp(reinterpret_cast<Address>(code_range_->address()), |
153 MemoryChunk::kAlignment); | 164 MemoryChunk::kAlignment); |
154 size_t size = code_range_->size() - (aligned_base - base); | 165 size_t size = code_range_->size() - (aligned_base - base); |
155 allocation_list_.Add(FreeBlock(aligned_base, size)); | 166 allocation_list_.Add(FreeBlock(aligned_base, size)); |
156 current_allocation_block_index_ = 0; | 167 current_allocation_block_index_ = 0; |
157 return true; | 168 return true; |
158 } | 169 } |
159 | 170 |
(...skipping 3042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3202 object->ShortPrint(); | 3213 object->ShortPrint(); |
3203 PrintF("\n"); | 3214 PrintF("\n"); |
3204 } | 3215 } |
3205 printf(" --------------------------------------\n"); | 3216 printf(" --------------------------------------\n"); |
3206 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3217 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3207 } | 3218 } |
3208 | 3219 |
3209 #endif // DEBUG | 3220 #endif // DEBUG |
3210 | 3221 |
3211 } } // namespace v8::internal | 3222 } } // namespace v8::internal |
OLD | NEW |