OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_SPACES_H_ | 5 #ifndef V8_HEAP_SPACES_H_ |
6 #define V8_HEAP_SPACES_H_ | 6 #define V8_HEAP_SPACES_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/atomic-utils.h" | 9 #include "src/atomic-utils.h" |
10 #include "src/base/atomicops.h" | 10 #include "src/base/atomicops.h" |
(...skipping 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2506 // Last page returned. | 2506 // Last page returned. |
2507 NewSpacePage* last_page_; | 2507 NewSpacePage* last_page_; |
2508 }; | 2508 }; |
2509 | 2509 |
2510 // ----------------------------------------------------------------------------- | 2510 // ----------------------------------------------------------------------------- |
2511 // Allows observation of inline allocation in the new space. | 2511 // Allows observation of inline allocation in the new space. |
2512 class InlineAllocationObserver { | 2512 class InlineAllocationObserver { |
2513 public: | 2513 public: |
2514 explicit InlineAllocationObserver(intptr_t step_size) | 2514 explicit InlineAllocationObserver(intptr_t step_size) |
2515 : step_size_(step_size), bytes_to_next_step_(step_size) { | 2515 : step_size_(step_size), bytes_to_next_step_(step_size) { |
2516 DCHECK(step_size >= kPointerSize && (step_size & kHeapObjectTagMask) == 0); | 2516 DCHECK(step_size >= kPointerSize); |
2517 } | 2517 } |
2518 virtual ~InlineAllocationObserver() {} | 2518 virtual ~InlineAllocationObserver() {} |
2519 | 2519 |
2520 private: | 2520 private: |
2521 intptr_t step_size() const { return step_size_; } | 2521 intptr_t step_size() const { return step_size_; } |
2522 intptr_t bytes_to_next_step() const { return bytes_to_next_step_; } | 2522 intptr_t bytes_to_next_step() const { return bytes_to_next_step_; } |
2523 | 2523 |
2524 // Pure virtual method provided by the subclasses that gets called when more | 2524 // Pure virtual method provided by the subclasses that gets called when at |
2525 // than step_size byte have been allocated. | 2525 // least step_size byte have been allocated. |
Hannes Payer (out of office)
2015/11/17 14:41:30
byte => bytes
| |
2526 virtual void Step(int bytes_allocated) = 0; | 2526 virtual void Step(int bytes_allocated) = 0; |
2527 | 2527 |
2528 // Called each time the new space does an inline allocation step. This may be | 2528 // Called each time the new space does an inline allocation step. This may be |
2529 // more frequently than the step_size we are monitoring (e.g. when there are | 2529 // more frequently than the step_size we are monitoring (e.g. when there are |
2530 // multiple observers, or when page or space boundary is encountered.) The | 2530 // multiple observers, or when page or space boundary is encountered.) The |
2531 // Step method is only called once more than step_size bytes have been | 2531 // Step method is only called once at least than step_size bytes have been |
Hannes Payer (out of office)
2015/11/17 14:41:30
This sentence seems to be broken. Do we still need
| |
2532 // allocated. | 2532 // allocated. |
2533 void InlineAllocationStep(int bytes_allocated) { | 2533 void InlineAllocationStep(int bytes_allocated) { |
2534 bytes_to_next_step_ -= bytes_allocated; | 2534 bytes_to_next_step_ -= bytes_allocated; |
2535 if (bytes_to_next_step_ <= 0) { | 2535 if (bytes_to_next_step_ <= 0) { |
2536 Step(static_cast<int>(step_size_ - bytes_to_next_step_)); | 2536 Step(static_cast<int>(step_size_ - bytes_to_next_step_)); |
2537 bytes_to_next_step_ = step_size_; | 2537 bytes_to_next_step_ = step_size_; |
2538 } | 2538 } |
2539 } | 2539 } |
2540 | 2540 |
2541 intptr_t step_size_; | 2541 intptr_t step_size_; |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3124 count = 0; | 3124 count = 0; |
3125 } | 3125 } |
3126 // Must be small, since an iteration is used for lookup. | 3126 // Must be small, since an iteration is used for lookup. |
3127 static const int kMaxComments = 64; | 3127 static const int kMaxComments = 64; |
3128 }; | 3128 }; |
3129 #endif | 3129 #endif |
3130 } // namespace internal | 3130 } // namespace internal |
3131 } // namespace v8 | 3131 } // namespace v8 |
3132 | 3132 |
3133 #endif // V8_HEAP_SPACES_H_ | 3133 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |