Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: src/heap/spaces.h

Issue 2028633002: Provide a tagged allocation top pointer. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/globals.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <list> 8 #include <list>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 1623
1624 1624
1625 // ----------------------------------------------------------------------------- 1625 // -----------------------------------------------------------------------------
1626 // A space has a circular list of pages. The next page can be accessed via 1626 // A space has a circular list of pages. The next page can be accessed via
1627 // Page::next_page() call. 1627 // Page::next_page() call.
1628 1628
1629 // An abstraction of allocation and relocation pointers in a page-structured 1629 // An abstraction of allocation and relocation pointers in a page-structured
1630 // space. 1630 // space.
1631 class AllocationInfo { 1631 class AllocationInfo {
1632 public: 1632 public:
1633 AllocationInfo() : top_(nullptr), limit_(nullptr) {} 1633 AllocationInfo() { Reset(nullptr, nullptr); }
1634 AllocationInfo(Address top, Address limit) : top_(top), limit_(limit) {} 1634 AllocationInfo(Address top, Address limit) { Reset(top, limit); }
1635 1635
1636 void Reset(Address top, Address limit) { 1636 void Reset(Address top, Address limit) {
1637 set_top(top); 1637 set_top(top);
1638 set_limit(limit); 1638 set_limit(limit);
1639 } 1639 }
1640 1640
1641 INLINE(void set_top(Address top)) { 1641 inline void set_top(Address top) {
1642 SLOW_DCHECK(top == NULL || 1642 SLOW_DCHECK((reinterpret_cast<intptr_t>(top) & kHeapObjectTagMask) == 0);
1643 (reinterpret_cast<intptr_t>(top) & kHeapObjectTagMask) == 0); 1643 top_ = reinterpret_cast<intptr_t>(top) + kHeapObjectTag;
1644 top_ = top;
1645 } 1644 }
1646 1645
1647 INLINE(Address top()) const { 1646 inline Address top() const {
1648 SLOW_DCHECK(top_ == NULL || 1647 SLOW_DCHECK((top_ & kHeapObjectTagMask) == kHeapObjectTag);
1649 (reinterpret_cast<intptr_t>(top_) & kHeapObjectTagMask) == 0); 1648 return reinterpret_cast<Address>(top_ - kHeapObjectTag);
1650 return top_;
1651 } 1649 }
1652 1650
1653 Address* top_address() { return &top_; } 1651 Address* top_address() { return reinterpret_cast<Address*>(&top_); }
1654 1652
1655 INLINE(void set_limit(Address limit)) { 1653 inline void set_limit(Address limit) {
1656 limit_ = limit; 1654 limit_ = reinterpret_cast<intptr_t>(limit);
1657 } 1655 }
1658 1656
1659 INLINE(Address limit()) const { 1657 inline Address limit() const { return reinterpret_cast<Address>(limit_); }
1660 return limit_;
1661 }
1662 1658
1663 Address* limit_address() { return &limit_; } 1659 Address* limit_address() { return reinterpret_cast<Address*>(&limit_); }
1664
1665 #ifdef DEBUG
1666 bool VerifyPagedAllocation() {
1667 return (Page::FromAllocationAreaAddress(top_) ==
1668 Page::FromAllocationAreaAddress(limit_)) &&
1669 (top_ <= limit_);
1670 }
1671 #endif
1672 1660
1673 private: 1661 private:
1674 // Current allocation top. 1662 // Current tagged allocation top.
1675 Address top_; 1663 intptr_t top_;
1676 // Current allocation limit. 1664 // Current allocation limit.
Hannes Payer (out of office) 2016/05/31 18:19:35 Mention that limit is untagged.
epertoso 2016/06/01 08:06:22 Done.
1677 Address limit_; 1665 intptr_t limit_;
1678 }; 1666 };
1679 1667
1680 1668
1681 // An abstraction of the accounting statistics of a page-structured space. 1669 // An abstraction of the accounting statistics of a page-structured space.
1682 // 1670 //
1683 // The stats are only set by functions that ensure they stay balanced. These 1671 // The stats are only set by functions that ensure they stay balanced. These
1684 // functions increase or decrease one of the non-capacity stats in conjunction 1672 // functions increase or decrease one of the non-capacity stats in conjunction
1685 // with capacity, or else they always balance increases and decreases to the 1673 // with capacity, or else they always balance increases and decreases to the
1686 // non-capacity stats. 1674 // non-capacity stats.
1687 class AllocationStats BASE_EMBEDDED { 1675 class AllocationStats BASE_EMBEDDED {
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after
3136 count = 0; 3124 count = 0;
3137 } 3125 }
3138 // Must be small, since an iteration is used for lookup. 3126 // Must be small, since an iteration is used for lookup.
3139 static const int kMaxComments = 64; 3127 static const int kMaxComments = 64;
3140 }; 3128 };
3141 #endif 3129 #endif
3142 } // namespace internal 3130 } // namespace internal
3143 } // namespace v8 3131 } // namespace v8
3144 3132
3145 #endif // V8_HEAP_SPACES_H_ 3133 #endif // V8_HEAP_SPACES_H_
OLDNEW
« no previous file with comments | « src/globals.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698