Revision f230a1cf deps/v8/src/spaces.h
deps/v8/src/spaces.h | ||
---|---|---|
1317 | 1317 |
// space. |
1318 | 1318 |
class AllocationInfo { |
1319 | 1319 |
public: |
1320 |
AllocationInfo() : top(NULL), limit(NULL) {
|
|
1320 |
AllocationInfo() : top_(NULL), limit_(NULL) {
|
|
1321 | 1321 |
} |
1322 | 1322 |
|
1323 |
Address top; // Current allocation top. |
|
1324 |
Address limit; // Current allocation limit. |
|
1323 |
INLINE(void set_top(Address top)) { |
|
1324 |
SLOW_ASSERT(top == NULL || |
|
1325 |
(reinterpret_cast<intptr_t>(top) & HeapObjectTagMask()) == 0); |
|
1326 |
top_ = top; |
|
1327 |
} |
|
1328 |
|
|
1329 |
INLINE(Address top()) const { |
|
1330 |
SLOW_ASSERT(top_ == NULL || |
|
1331 |
(reinterpret_cast<intptr_t>(top_) & HeapObjectTagMask()) == 0); |
|
1332 |
return top_; |
|
1333 |
} |
|
1334 |
|
|
1335 |
Address* top_address() { |
|
1336 |
return &top_; |
|
1337 |
} |
|
1338 |
|
|
1339 |
INLINE(void set_limit(Address limit)) { |
|
1340 |
SLOW_ASSERT(limit == NULL || |
|
1341 |
(reinterpret_cast<intptr_t>(limit) & HeapObjectTagMask()) == 0); |
|
1342 |
limit_ = limit; |
|
1343 |
} |
|
1344 |
|
|
1345 |
INLINE(Address limit()) const { |
|
1346 |
SLOW_ASSERT(limit_ == NULL || |
|
1347 |
(reinterpret_cast<intptr_t>(limit_) & HeapObjectTagMask()) == 0); |
|
1348 |
return limit_; |
|
1349 |
} |
|
1350 |
|
|
1351 |
Address* limit_address() { |
|
1352 |
return &limit_; |
|
1353 |
} |
|
1325 | 1354 |
|
1326 | 1355 |
#ifdef DEBUG |
1327 | 1356 |
bool VerifyPagedAllocation() { |
1328 |
return (Page::FromAllocationTop(top) == Page::FromAllocationTop(limit))
|
|
1329 |
&& (top <= limit);
|
|
1357 |
return (Page::FromAllocationTop(top_) == Page::FromAllocationTop(limit_))
|
|
1358 |
&& (top_ <= limit_);
|
|
1330 | 1359 |
} |
1331 | 1360 |
#endif |
1361 |
|
|
1362 |
private: |
|
1363 |
// Current allocation top. |
|
1364 |
Address top_; |
|
1365 |
// Current allocation limit. |
|
1366 |
Address limit_; |
|
1332 | 1367 |
}; |
1333 | 1368 |
|
1334 | 1369 |
|
... | ... | |
1707 | 1742 |
virtual intptr_t Waste() { return accounting_stats_.Waste(); } |
1708 | 1743 |
|
1709 | 1744 |
// Returns the allocation pointer in this space. |
1710 |
Address top() { return allocation_info_.top; } |
|
1711 |
Address limit() { return allocation_info_.limit; } |
|
1745 |
Address top() { return allocation_info_.top(); } |
|
1746 |
Address limit() { return allocation_info_.limit(); } |
|
1747 |
|
|
1748 |
// The allocation top address. |
|
1749 |
Address* allocation_top_address() { |
|
1750 |
return allocation_info_.top_address(); |
|
1751 |
} |
|
1712 | 1752 |
|
1713 |
// The allocation top and limit addresses. |
|
1714 |
Address* allocation_top_address() { return &allocation_info_.top; } |
|
1715 |
Address* allocation_limit_address() { return &allocation_info_.limit; } |
|
1753 |
// The allocation limit address. |
|
1754 |
Address* allocation_limit_address() { |
|
1755 |
return allocation_info_.limit_address(); |
|
1756 |
} |
|
1757 |
|
|
1758 |
enum AllocationType { |
|
1759 |
NEW_OBJECT, |
|
1760 |
MOVE_OBJECT |
|
1761 |
}; |
|
1716 | 1762 |
|
1717 | 1763 |
// Allocate the requested number of bytes in the space if possible, return a |
1718 | 1764 |
// failure object if not. |
1719 |
MUST_USE_RESULT inline MaybeObject* AllocateRaw(int size_in_bytes); |
|
1765 |
MUST_USE_RESULT inline MaybeObject* AllocateRaw( |
|
1766 |
int size_in_bytes, |
|
1767 |
AllocationType event = NEW_OBJECT); |
|
1720 | 1768 |
|
1721 | 1769 |
virtual bool ReserveSpace(int bytes); |
1722 | 1770 |
|
... | ... | |
1738 | 1786 |
void SetTop(Address top, Address limit) { |
1739 | 1787 |
ASSERT(top == limit || |
1740 | 1788 |
Page::FromAddress(top) == Page::FromAddress(limit - 1)); |
1741 |
MemoryChunk::UpdateHighWaterMark(allocation_info_.top); |
|
1742 |
allocation_info_.top = top;
|
|
1743 |
allocation_info_.limit = limit;
|
|
1789 |
MemoryChunk::UpdateHighWaterMark(allocation_info_.top());
|
|
1790 |
allocation_info_.set_top(top);
|
|
1791 |
allocation_info_.set_limit(limit);
|
|
1744 | 1792 |
} |
1745 | 1793 |
|
1746 | 1794 |
void Allocate(int bytes) { |
... | ... | |
2381 | 2429 |
|
2382 | 2430 |
// Return the address of the allocation pointer in the active semispace. |
2383 | 2431 |
Address top() { |
2384 |
ASSERT(to_space_.current_page()->ContainsLimit(allocation_info_.top)); |
|
2385 |
return allocation_info_.top; |
|
2432 |
ASSERT(to_space_.current_page()->ContainsLimit(allocation_info_.top()));
|
|
2433 |
return allocation_info_.top();
|
|
2386 | 2434 |
} |
2435 |
|
|
2436 |
void set_top(Address top) { |
|
2437 |
ASSERT(to_space_.current_page()->ContainsLimit(top)); |
|
2438 |
allocation_info_.set_top(top); |
|
2439 |
} |
|
2440 |
|
|
2387 | 2441 |
// Return the address of the first object in the active semispace. |
2388 | 2442 |
Address bottom() { return to_space_.space_start(); } |
2389 | 2443 |
|
... | ... | |
2408 | 2462 |
return reinterpret_cast<Address>(index << kPointerSizeLog2); |
2409 | 2463 |
} |
2410 | 2464 |
|
2411 |
// The allocation top and limit addresses. |
|
2412 |
Address* allocation_top_address() { return &allocation_info_.top; } |
|
2413 |
Address* allocation_limit_address() { return &allocation_info_.limit; } |
|
2465 |
// The allocation top and limit address. |
|
2466 |
Address* allocation_top_address() { |
|
2467 |
return allocation_info_.top_address(); |
|
2468 |
} |
|
2469 |
|
|
2470 |
// The allocation limit address. |
|
2471 |
Address* allocation_limit_address() { |
|
2472 |
return allocation_info_.limit_address(); |
|
2473 |
} |
|
2414 | 2474 |
|
2415 | 2475 |
MUST_USE_RESULT INLINE(MaybeObject* AllocateRaw(int size_in_bytes)); |
2416 | 2476 |
|
... | ... | |
2420 | 2480 |
void LowerInlineAllocationLimit(intptr_t step) { |
2421 | 2481 |
inline_allocation_limit_step_ = step; |
2422 | 2482 |
if (step == 0) { |
2423 |
allocation_info_.limit = to_space_.page_high();
|
|
2483 |
allocation_info_.set_limit(to_space_.page_high());
|
|
2424 | 2484 |
} else { |
2425 |
allocation_info_.limit = Min( |
|
2426 |
allocation_info_.top + inline_allocation_limit_step_, |
|
2427 |
allocation_info_.limit); |
|
2485 |
Address new_limit = Min( |
|
2486 |
allocation_info_.top() + inline_allocation_limit_step_, |
|
2487 |
allocation_info_.limit()); |
|
2488 |
allocation_info_.set_limit(new_limit); |
|
2428 | 2489 |
} |
2429 |
top_on_previous_step_ = allocation_info_.top; |
|
2490 |
top_on_previous_step_ = allocation_info_.top();
|
|
2430 | 2491 |
} |
2431 | 2492 |
|
2432 | 2493 |
// Get the extent of the inactive semispace (for use as a marking stack, |
... | ... | |
2573 | 2634 |
// For contiguous spaces, top should be in the space (or at the end) and limit |
2574 | 2635 |
// should be the end of the space. |
2575 | 2636 |
#define ASSERT_SEMISPACE_ALLOCATION_INFO(info, space) \ |
2576 |
SLOW_ASSERT((space).page_low() <= (info).top \
|
|
2577 |
&& (info).top <= (space).page_high() \
|
|
2578 |
&& (info).limit <= (space).page_high()) |
|
2637 |
SLOW_ASSERT((space).page_low() <= (info).top() \
|
|
2638 |
&& (info).top() <= (space).page_high() \
|
|
2639 |
&& (info).limit() <= (space).page_high())
|
|
2579 | 2640 |
|
2580 | 2641 |
|
2581 | 2642 |
// ----------------------------------------------------------------------------- |
Also available in: Unified diff