OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 #ifdef DEBUG | 383 #ifdef DEBUG |
384 ZapBlock(reinterpret_cast<Address>(mem), length); | 384 ZapBlock(reinterpret_cast<Address>(mem), length); |
385 #endif | 385 #endif |
386 if (CodeRange::contains(static_cast<Address>(mem))) { | 386 if (CodeRange::contains(static_cast<Address>(mem))) { |
387 CodeRange::FreeRawMemory(mem, length); | 387 CodeRange::FreeRawMemory(mem, length); |
388 } else { | 388 } else { |
389 OS::Free(mem, length); | 389 OS::Free(mem, length); |
390 } | 390 } |
391 Counters::memory_allocated.Decrement(static_cast<int>(length)); | 391 Counters::memory_allocated.Decrement(static_cast<int>(length)); |
392 size_ -= static_cast<int>(length); | 392 size_ -= static_cast<int>(length); |
393 if (executable == EXECUTABLE) size_executable_ -= length; | 393 if (executable == EXECUTABLE) size_executable_ -= static_cast<int>(length); |
394 ASSERT(size_ >= 0); | 394 ASSERT(size_ >= 0); |
395 } | 395 } |
396 | 396 |
397 | 397 |
398 void* MemoryAllocator::ReserveInitialChunk(const size_t requested) { | 398 void* MemoryAllocator::ReserveInitialChunk(const size_t requested) { |
399 ASSERT(initial_chunk_ == NULL); | 399 ASSERT(initial_chunk_ == NULL); |
400 | 400 |
401 initial_chunk_ = new VirtualMemory(requested); | 401 initial_chunk_ = new VirtualMemory(requested); |
402 CHECK(initial_chunk_ != NULL); | 402 CHECK(initial_chunk_ != NULL); |
403 if (!initial_chunk_->IsReserved()) { | 403 if (!initial_chunk_->IsReserved()) { |
(...skipping 2517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2921 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) { | 2921 for (HeapObject* obj = obj_it.next(); obj != NULL; obj = obj_it.next()) { |
2922 if (obj->IsCode()) { | 2922 if (obj->IsCode()) { |
2923 Code* code = Code::cast(obj); | 2923 Code* code = Code::cast(obj); |
2924 code_kind_statistics[code->kind()] += code->Size(); | 2924 code_kind_statistics[code->kind()] += code->Size(); |
2925 } | 2925 } |
2926 } | 2926 } |
2927 } | 2927 } |
2928 #endif // DEBUG | 2928 #endif // DEBUG |
2929 | 2929 |
2930 } } // namespace v8::internal | 2930 } } // namespace v8::internal |
OLD | NEW |