OLD | NEW |
1 // Copyright 2006-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2010 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 | 372 |
373 bool MemoryAllocator::InInitialChunk(Address address) { | 373 bool MemoryAllocator::InInitialChunk(Address address) { |
374 if (initial_chunk_ == NULL) return false; | 374 if (initial_chunk_ == NULL) return false; |
375 | 375 |
376 Address start = static_cast<Address>(initial_chunk_->address()); | 376 Address start = static_cast<Address>(initial_chunk_->address()); |
377 return (start <= address) && (address < start + initial_chunk_->size()); | 377 return (start <= address) && (address < start + initial_chunk_->size()); |
378 } | 378 } |
379 | 379 |
380 | 380 |
381 #ifdef ENABLE_HEAP_PROTECTION | |
382 | |
383 void MemoryAllocator::Protect(Address start, size_t size) { | |
384 OS::Protect(start, size); | |
385 } | |
386 | |
387 | |
388 void MemoryAllocator::Unprotect(Address start, | |
389 size_t size, | |
390 Executability executable) { | |
391 OS::Unprotect(start, size, executable); | |
392 } | |
393 | |
394 | |
395 void MemoryAllocator::ProtectChunkFromPage(Page* page) { | |
396 int id = GetChunkId(page); | |
397 OS::Protect(chunks_[id].address(), chunks_[id].size()); | |
398 } | |
399 | |
400 | |
401 void MemoryAllocator::UnprotectChunkFromPage(Page* page) { | |
402 int id = GetChunkId(page); | |
403 OS::Unprotect(chunks_[id].address(), chunks_[id].size(), | |
404 chunks_[id].owner()->executable() == EXECUTABLE); | |
405 } | |
406 | |
407 #endif | |
408 | |
409 | |
410 // -------------------------------------------------------------------------- | 381 // -------------------------------------------------------------------------- |
411 // PagedSpace | 382 // PagedSpace |
412 | 383 |
413 bool PagedSpace::Contains(Address addr) { | 384 bool PagedSpace::Contains(Address addr) { |
414 Page* p = Page::FromAddress(addr); | 385 Page* p = Page::FromAddress(addr); |
415 if (!p->is_valid()) return false; | 386 if (!p->is_valid()) return false; |
416 return heap()->isolate()->memory_allocator()->IsPageInSpace(p, this); | 387 return heap()->isolate()->memory_allocator()->IsPageInSpace(p, this); |
417 } | 388 } |
418 | 389 |
419 | 390 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 491 |
521 bool FreeListNode::IsFreeListNode(HeapObject* object) { | 492 bool FreeListNode::IsFreeListNode(HeapObject* object) { |
522 return object->map() == HEAP->raw_unchecked_byte_array_map() | 493 return object->map() == HEAP->raw_unchecked_byte_array_map() |
523 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map() | 494 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map() |
524 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map(); | 495 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map(); |
525 } | 496 } |
526 | 497 |
527 } } // namespace v8::internal | 498 } } // namespace v8::internal |
528 | 499 |
529 #endif // V8_SPACES_INL_H_ | 500 #endif // V8_SPACES_INL_H_ |
OLD | NEW |