| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 heap_(heap) {} | 386 heap_(heap) {} |
| 387 | 387 |
| 388 void Initialize(); | 388 void Initialize(); |
| 389 | 389 |
| 390 void Destroy() { | 390 void Destroy() { |
| 391 DCHECK(is_empty()); | 391 DCHECK(is_empty()); |
| 392 delete emergency_stack_; | 392 delete emergency_stack_; |
| 393 emergency_stack_ = NULL; | 393 emergency_stack_ = NULL; |
| 394 } | 394 } |
| 395 | 395 |
| 396 inline void ActivateGuardIfOnTheSamePage(); | |
| 397 | |
| 398 Page* GetHeadPage() { | 396 Page* GetHeadPage() { |
| 399 return Page::FromAllocationTop(reinterpret_cast<Address>(rear_)); | 397 return Page::FromAllocationTop(reinterpret_cast<Address>(rear_)); |
| 400 } | 398 } |
| 401 | 399 |
| 402 void SetNewLimit(Address limit) { | 400 void SetNewLimit(Address limit) { |
| 403 if (!guard_) { | |
| 404 return; | |
| 405 } | |
| 406 | |
| 407 DCHECK(GetHeadPage() == Page::FromAllocationTop(limit)); | |
| 408 limit_ = reinterpret_cast<intptr_t*>(limit); | 401 limit_ = reinterpret_cast<intptr_t*>(limit); |
| 409 | 402 |
| 410 if (limit_ <= rear_) { | 403 if (limit_ <= rear_) { |
| 411 return; | 404 return; |
| 412 } | 405 } |
| 413 | 406 |
| 414 RelocateQueueHead(); | 407 RelocateQueueHead(); |
| 415 } | 408 } |
| 416 | 409 |
| 417 bool IsBelowPromotionQueue(Address to_space_top) { | 410 bool IsBelowPromotionQueue(Address to_space_top) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 SemiSpace::AssertValidRange(reinterpret_cast<Address>(rear_), | 447 SemiSpace::AssertValidRange(reinterpret_cast<Address>(rear_), |
| 455 reinterpret_cast<Address>(front_)); | 448 reinterpret_cast<Address>(front_)); |
| 456 } | 449 } |
| 457 | 450 |
| 458 private: | 451 private: |
| 459 // The front of the queue is higher in the memory page chain than the rear. | 452 // The front of the queue is higher in the memory page chain than the rear. |
| 460 intptr_t* front_; | 453 intptr_t* front_; |
| 461 intptr_t* rear_; | 454 intptr_t* rear_; |
| 462 intptr_t* limit_; | 455 intptr_t* limit_; |
| 463 | 456 |
| 464 bool guard_; | |
| 465 | |
| 466 static const int kEntrySizeInWords = 2; | 457 static const int kEntrySizeInWords = 2; |
| 467 | 458 |
| 468 struct Entry { | 459 struct Entry { |
| 469 Entry(HeapObject* obj, int size) : obj_(obj), size_(size) {} | 460 Entry(HeapObject* obj, int size) : obj_(obj), size_(size) {} |
| 470 | 461 |
| 471 HeapObject* obj_; | 462 HeapObject* obj_; |
| 472 int size_; | 463 int size_; |
| 473 }; | 464 }; |
| 474 List<Entry>* emergency_stack_; | 465 List<Entry>* emergency_stack_; |
| 475 | 466 |
| (...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2538 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2529 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2539 | 2530 |
| 2540 private: | 2531 private: |
| 2541 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2532 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2542 }; | 2533 }; |
| 2543 #endif // DEBUG | 2534 #endif // DEBUG |
| 2544 } | 2535 } |
| 2545 } // namespace v8::internal | 2536 } // namespace v8::internal |
| 2546 | 2537 |
| 2547 #endif // V8_HEAP_HEAP_H_ | 2538 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |