5 #ifndef V8_BASE_ADDRESS_REGION_H_ 6 #define V8_BASE_ADDRESS_REGION_H_ 10 #include "src/base/macros.h" 23 : address_(address), size_(size) {}
25 Address begin()
const {
return address_; }
26 Address end()
const {
return address_ + size_; }
28 size_t size()
const {
return size_; }
29 void set_size(
size_t size) { size_ = size; }
31 bool is_empty()
const {
return size_ == 0; }
33 bool contains(
Address address)
const {
34 STATIC_ASSERT(std::is_unsigned<Address>::value);
35 return (address - begin()) < size();
38 bool contains(
Address address,
size_t size)
const {
39 STATIC_ASSERT(std::is_unsigned<Address>::value);
40 Address offset = address - begin();
41 return (offset < size_) && (offset + size <= size_);
45 return contains(region.address_, region.size_);
49 return address_ == other.address_ && size_ == other.size_;
53 return address_ != other.address_ || size_ != other.size_;
62 inline std::ostream& operator<<(std::ostream& out,
AddressRegion region) {
63 return out <<
"[" <<
reinterpret_cast<void*
>(region.begin()) <<
"+" 64 << region.size() <<
"]";
70 #endif // V8_BASE_ADDRESS_REGION_H_