OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 heap_(heap) {} | 376 heap_(heap) {} |
377 | 377 |
378 void Initialize(); | 378 void Initialize(); |
379 | 379 |
380 void Destroy() { | 380 void Destroy() { |
381 DCHECK(is_empty()); | 381 DCHECK(is_empty()); |
382 delete emergency_stack_; | 382 delete emergency_stack_; |
383 emergency_stack_ = NULL; | 383 emergency_stack_ = NULL; |
384 } | 384 } |
385 | 385 |
386 inline void ActivateGuardIfOnTheSamePage(); | |
387 | |
388 Page* GetHeadPage() { | 386 Page* GetHeadPage() { |
389 return Page::FromAllocationTop(reinterpret_cast<Address>(rear_)); | 387 return Page::FromAllocationTop(reinterpret_cast<Address>(rear_)); |
390 } | 388 } |
391 | 389 |
392 void SetNewLimit(Address limit) { | 390 void SetNewLimit(Address limit) { |
393 if (!guard_) { | |
394 return; | |
395 } | |
396 | |
397 DCHECK(GetHeadPage() == Page::FromAllocationTop(limit)); | |
398 limit_ = reinterpret_cast<intptr_t*>(limit); | 391 limit_ = reinterpret_cast<intptr_t*>(limit); |
399 | 392 |
400 if (limit_ <= rear_) { | 393 if (limit_ <= rear_) { |
401 return; | 394 return; |
402 } | 395 } |
403 | 396 |
404 RelocateQueueHead(); | 397 RelocateQueueHead(); |
405 } | 398 } |
406 | 399 |
407 bool IsBelowPromotionQueue(Address to_space_top) { | 400 bool IsBelowPromotionQueue(Address to_space_top) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 SemiSpace::AssertValidRange(reinterpret_cast<Address>(rear_), | 437 SemiSpace::AssertValidRange(reinterpret_cast<Address>(rear_), |
445 reinterpret_cast<Address>(front_)); | 438 reinterpret_cast<Address>(front_)); |
446 } | 439 } |
447 | 440 |
448 private: | 441 private: |
449 // The front of the queue is higher in the memory page chain than the rear. | 442 // The front of the queue is higher in the memory page chain than the rear. |
450 intptr_t* front_; | 443 intptr_t* front_; |
451 intptr_t* rear_; | 444 intptr_t* rear_; |
452 intptr_t* limit_; | 445 intptr_t* limit_; |
453 | 446 |
454 bool guard_; | |
455 | |
456 static const int kEntrySizeInWords = 2; | 447 static const int kEntrySizeInWords = 2; |
457 | 448 |
458 struct Entry { | 449 struct Entry { |
459 Entry(HeapObject* obj, int size) : obj_(obj), size_(size) {} | 450 Entry(HeapObject* obj, int size) : obj_(obj), size_(size) {} |
460 | 451 |
461 HeapObject* obj_; | 452 HeapObject* obj_; |
462 int size_; | 453 int size_; |
463 }; | 454 }; |
464 List<Entry>* emergency_stack_; | 455 List<Entry>* emergency_stack_; |
465 | 456 |
(...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2499 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2490 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2500 | 2491 |
2501 private: | 2492 private: |
2502 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2493 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2503 }; | 2494 }; |
2504 #endif // DEBUG | 2495 #endif // DEBUG |
2505 } | 2496 } |
2506 } // namespace v8::internal | 2497 } // namespace v8::internal |
2507 | 2498 |
2508 #endif // V8_HEAP_HEAP_H_ | 2499 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |