| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 stop_page_ = space->last_page_; | 141 stop_page_ = space->last_page_; |
| 142 break; | 142 break; |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 | 146 |
| 147 // ----------------------------------------------------------------------------- | 147 // ----------------------------------------------------------------------------- |
| 148 // CodeRange | 148 // CodeRange |
| 149 | 149 |
| 150 | 150 |
| 151 CodeRange::CodeRange() | 151 CodeRange::CodeRange(Isolate* isolate) |
| 152 : code_range_(NULL), | 152 : isolate_(isolate), |
| 153 code_range_(NULL), |
| 153 free_list_(0), | 154 free_list_(0), |
| 154 allocation_list_(0), | 155 allocation_list_(0), |
| 155 current_allocation_block_index_(0), | 156 current_allocation_block_index_(0) { |
| 156 isolate_(NULL) { | |
| 157 } | 157 } |
| 158 | 158 |
| 159 | 159 |
| 160 bool CodeRange::Setup(const size_t requested) { | 160 bool CodeRange::Setup(const size_t requested) { |
| 161 ASSERT(code_range_ == NULL); | 161 ASSERT(code_range_ == NULL); |
| 162 | 162 |
| 163 code_range_ = new VirtualMemory(requested); | 163 code_range_ = new VirtualMemory(requested); |
| 164 CHECK(code_range_ != NULL); | 164 CHECK(code_range_ != NULL); |
| 165 if (!code_range_->IsReserved()) { | 165 if (!code_range_->IsReserved()) { |
| 166 delete code_range_; | 166 delete code_range_; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 272 |
| 273 // ----------------------------------------------------------------------------- | 273 // ----------------------------------------------------------------------------- |
| 274 // MemoryAllocator | 274 // MemoryAllocator |
| 275 // | 275 // |
| 276 | 276 |
| 277 // 270 is an estimate based on the static default heap size of a pair of 256K | 277 // 270 is an estimate based on the static default heap size of a pair of 256K |
| 278 // semispaces and a 64M old generation. | 278 // semispaces and a 64M old generation. |
| 279 const int kEstimatedNumberOfChunks = 270; | 279 const int kEstimatedNumberOfChunks = 270; |
| 280 | 280 |
| 281 | 281 |
| 282 MemoryAllocator::MemoryAllocator() | 282 MemoryAllocator::MemoryAllocator(Isolate* isolate) |
| 283 : capacity_(0), | 283 : isolate_(isolate), |
| 284 capacity_(0), |
| 284 capacity_executable_(0), | 285 capacity_executable_(0), |
| 285 size_(0), | 286 size_(0), |
| 286 size_executable_(0), | 287 size_executable_(0), |
| 287 initial_chunk_(NULL), | 288 initial_chunk_(NULL), |
| 288 chunks_(kEstimatedNumberOfChunks), | 289 chunks_(kEstimatedNumberOfChunks), |
| 289 free_chunk_ids_(kEstimatedNumberOfChunks), | 290 free_chunk_ids_(kEstimatedNumberOfChunks), |
| 290 max_nof_chunks_(0), | 291 max_nof_chunks_(0), |
| 291 top_(0), | 292 top_(0) { |
| 292 isolate_(NULL) { | |
| 293 } | 293 } |
| 294 | 294 |
| 295 | 295 |
| 296 void MemoryAllocator::Push(int free_chunk_id) { | 296 void MemoryAllocator::Push(int free_chunk_id) { |
| 297 ASSERT(max_nof_chunks_ > 0); | 297 ASSERT(max_nof_chunks_ > 0); |
| 298 ASSERT(top_ < max_nof_chunks_); | 298 ASSERT(top_ < max_nof_chunks_); |
| 299 free_chunk_ids_[top_++] = free_chunk_id; | 299 free_chunk_ids_[top_++] = free_chunk_id; |
| 300 } | 300 } |
| 301 | 301 |
| 302 | 302 |
| (...skipping 2786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3089 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) { | 3089 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) { |
| 3090 if (obj->IsCode()) { | 3090 if (obj->IsCode()) { |
| 3091 Code* code = Code::cast(obj); | 3091 Code* code = Code::cast(obj); |
| 3092 isolate->code_kind_statistics()[code->kind()] += code->Size(); | 3092 isolate->code_kind_statistics()[code->kind()] += code->Size(); |
| 3093 } | 3093 } |
| 3094 } | 3094 } |
| 3095 } | 3095 } |
| 3096 #endif // DEBUG | 3096 #endif // DEBUG |
| 3097 | 3097 |
| 3098 } } // namespace v8::internal | 3098 } } // namespace v8::internal |
| OLD | NEW |