| 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 void HeapObjectIterator::Verify() { | 126 void HeapObjectIterator::Verify() { |
| 127 // TODO(gc): We should do something here. | 127 // TODO(gc): We should do something here. |
| 128 } | 128 } |
| 129 #endif | 129 #endif |
| 130 | 130 |
| 131 | 131 |
| 132 // ----------------------------------------------------------------------------- | 132 // ----------------------------------------------------------------------------- |
| 133 // CodeRange | 133 // CodeRange |
| 134 | 134 |
| 135 | 135 |
| 136 CodeRange::CodeRange() | 136 CodeRange::CodeRange(Isolate* isolate) |
| 137 : code_range_(NULL), | 137 : isolate_(isolate), |
| 138 code_range_(NULL), |
| 138 free_list_(0), | 139 free_list_(0), |
| 139 allocation_list_(0), | 140 allocation_list_(0), |
| 140 current_allocation_block_index_(0), | 141 current_allocation_block_index_(0) { |
| 141 isolate_(NULL) { | |
| 142 } | 142 } |
| 143 | 143 |
| 144 | 144 |
| 145 bool CodeRange::Setup(const size_t requested) { | 145 bool CodeRange::Setup(const size_t requested) { |
| 146 ASSERT(code_range_ == NULL); | 146 ASSERT(code_range_ == NULL); |
| 147 | 147 |
| 148 code_range_ = new VirtualMemory(requested); | 148 code_range_ = new VirtualMemory(requested); |
| 149 CHECK(code_range_ != NULL); | 149 CHECK(code_range_ != NULL); |
| 150 if (!code_range_->IsReserved()) { | 150 if (!code_range_->IsReserved()) { |
| 151 delete code_range_; | 151 delete code_range_; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 code_range_ = NULL; | 262 code_range_ = NULL; |
| 263 free_list_.Free(); | 263 free_list_.Free(); |
| 264 allocation_list_.Free(); | 264 allocation_list_.Free(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 | 267 |
| 268 // ----------------------------------------------------------------------------- | 268 // ----------------------------------------------------------------------------- |
| 269 // MemoryAllocator | 269 // MemoryAllocator |
| 270 // | 270 // |
| 271 | 271 |
| 272 MemoryAllocator::MemoryAllocator(Isolate* isolate) |
| 273 : isolate_(isolate), |
| 274 capacity_(0), |
| 275 capacity_executable_(0), |
| 276 size_(0), |
| 277 size_executable_(0) { |
| 278 } |
| 279 |
| 280 |
| 272 bool MemoryAllocator::Setup(intptr_t capacity, intptr_t capacity_executable) { | 281 bool MemoryAllocator::Setup(intptr_t capacity, intptr_t capacity_executable) { |
| 273 capacity_ = RoundUp(capacity, Page::kPageSize); | 282 capacity_ = RoundUp(capacity, Page::kPageSize); |
| 274 capacity_executable_ = RoundUp(capacity_executable, Page::kPageSize); | 283 capacity_executable_ = RoundUp(capacity_executable, Page::kPageSize); |
| 275 ASSERT_GE(capacity_, capacity_executable_); | 284 ASSERT_GE(capacity_, capacity_executable_); |
| 276 | 285 |
| 277 size_ = 0; | 286 size_ = 0; |
| 278 size_executable_ = 0; | 287 size_executable_ = 0; |
| 279 | 288 |
| 280 return true; | 289 return true; |
| 281 } | 290 } |
| (...skipping 2217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2499 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { | 2508 for (HeapObject* obj = obj_it.Next(); obj != NULL; obj = obj_it.Next()) { |
| 2500 if (obj->IsCode()) { | 2509 if (obj->IsCode()) { |
| 2501 Code* code = Code::cast(obj); | 2510 Code* code = Code::cast(obj); |
| 2502 isolate->code_kind_statistics()[code->kind()] += code->Size(); | 2511 isolate->code_kind_statistics()[code->kind()] += code->Size(); |
| 2503 } | 2512 } |
| 2504 } | 2513 } |
| 2505 } | 2514 } |
| 2506 #endif // DEBUG | 2515 #endif // DEBUG |
| 2507 | 2516 |
| 2508 } } // namespace v8::internal | 2517 } } // namespace v8::internal |
| OLD | NEW |