positives, but I've restructured the code to be more explicit.
Review URL: http://codereview.chromium.org/159192
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2521
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
void HashMap::Initialize(uint32_t capacity) {
ASSERT(IsPowerOf2(capacity));
map_ = reinterpret_cast<Entry*>(allocator_->New(capacity * sizeof(Entry)));
- if (map_ == NULL) V8::FatalProcessOutOfMemory("HashMap::Initialize");
+ if (map_ == NULL) {
+ V8::FatalProcessOutOfMemory("HashMap::Initialize");
+ return;
+ }
capacity_ = capacity;
Clear();
}
s = s->outer_scope();
}
- if (s->is_eval_scope()) {
+ if (s != NULL && s->is_eval_scope()) {
// Loop up the context chain. There is no frame effect so it is
// safe to use raw labels here.
Label next, fast;
} else {
Load(node->expression());
switch (op) {
- case Token::NOT:
- case Token::DELETE:
- case Token::TYPEOF:
- UNREACHABLE(); // handled above
- break;
-
case Token::SUB: {
bool overwrite =
(node->AsBinaryOperation() != NULL &&
}
default:
+ // NOT, DELETE, TYPEOF, and VOID are handled outside the
+ // switch.
UNREACHABLE();
}
}
new_size = Max(kSegmentOverhead + size, kMaximumSegmentSize);
}
Segment* segment = Segment::New(new_size);
- if (segment == NULL) V8::FatalProcessOutOfMemory("Zone");
+ if (segment == NULL) {
+ V8::FatalProcessOutOfMemory("Zone");
+ return NULL;
+ }
// Recompute 'top' and 'limit' based on the new segment.
Address result = RoundUp(segment->start(), kAlignment);