Fixes for comments in http://codereview.chromium.org/113641.

Review URL: http://codereview.chromium.org/115757


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2039 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 30a0a7de
...@@ -263,72 +263,75 @@ typedef char* CodeEntityInfo; ...@@ -263,72 +263,75 @@ typedef char* CodeEntityInfo;
class Interval { class Interval {
public: public:
Interval() Interval()
: min_addr(reinterpret_cast<Address>(-1)), : min_addr_(reinterpret_cast<Address>(-1)),
max_addr(reinterpret_cast<Address>(0)), next(NULL) {} max_addr_(reinterpret_cast<Address>(0)), next_(NULL) {}
~Interval() { delete next; } ~Interval() { delete next_; }
size_t Length() { size_t Length() {
size_t result = max_addr - min_addr + 1; size_t result = max_addr_ - min_addr_ + 1;
if (next != NULL) result += next->Length(); if (next_ != NULL) result += next_->Length();
return result; return result;
} }
void CloneFrom(Interval* src) { void CloneFrom(Interval* src) {
while (src != NULL) { while (src != NULL) {
RegisterAddress(src->min_addr); RegisterAddress(src->min_addr_);
RegisterAddress(src->max_addr); RegisterAddress(src->max_addr_);
src = src->next; src = src->next_;
} }
} }
bool Contains(Address addr) { bool Contains(Address addr) {
if (min_addr <= addr && addr <= max_addr) { if (min_addr_ <= addr && addr <= max_addr_) {
return true; return true;
} }
if (next != NULL) return next->Contains(addr); if (next_ != NULL) {
return false; return next_->Contains(addr);
} else {
return false;
}
} }
size_t GetIndex(Address addr) { size_t GetIndex(Address addr) {
if (min_addr <= addr && addr <= max_addr) { if (min_addr_ <= addr && addr <= max_addr_) {
return addr - min_addr; return addr - min_addr_;
} }
CHECK_NE(NULL, next); CHECK_NE(NULL, next_);
return (max_addr - min_addr + 1) + next->GetIndex(addr); return (max_addr_ - min_addr_ + 1) + next_->GetIndex(addr);
} }
Address GetMinAddr() { Address GetMinAddr() {
return next == NULL ? min_addr : i::Min(min_addr, next->GetMinAddr()); return next_ == NULL ? min_addr_ : i::Min(min_addr_, next_->GetMinAddr());
} }
Address GetMaxAddr() { Address GetMaxAddr() {
return next == NULL ? max_addr : i::Max(max_addr, next->GetMaxAddr()); return next_ == NULL ? max_addr_ : i::Max(max_addr_, next_->GetMaxAddr());
} }
void RegisterAddress(Address addr) { void RegisterAddress(Address addr) {
if (min_addr == reinterpret_cast<Address>(-1) if (min_addr_ == reinterpret_cast<Address>(-1)
|| (size_t)(addr > min_addr ? || (size_t)(addr > min_addr_ ?
addr - min_addr : min_addr - addr) < MAX_DELTA) { addr - min_addr_ : min_addr_ - addr) < MAX_DELTA) {
if (addr < min_addr) min_addr = addr; if (addr < min_addr_) min_addr_ = addr;
if (addr > max_addr) max_addr = addr; if (addr > max_addr_) max_addr_ = addr;
} else { } else {
if (next == NULL) next = new Interval(); if (next_ == NULL) next_ = new Interval();
next->RegisterAddress(addr); next_->RegisterAddress(addr);
} }
} }
Address raw_min_addr() { return min_addr; } Address raw_min_addr() { return min_addr_; }
Address raw_max_addr() { return max_addr; } Address raw_max_addr() { return max_addr_; }
Interval* get_next() { return next; } Interval* get_next() { return next_; }
private: private:
static const size_t MAX_DELTA = 0x100000; static const size_t MAX_DELTA = 0x100000;
Address min_addr; Address min_addr_;
Address max_addr; Address max_addr_;
Interval* next; Interval* next_;
}; };
...@@ -395,7 +398,7 @@ class ParseLogResult { ...@@ -395,7 +398,7 @@ class ParseLogResult {
} }
Interval bounds; Interval bounds;
// Memory map of entities start addresses. Biased by bounds.min_addr. // Memory map of entities start addresses.
int* entities_map; int* entities_map;
// An array of code entities. // An array of code entities.
CodeEntityInfo* entities; CodeEntityInfo* entities;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment