Fix some defects identifies by Coverity Prevent. All are false
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
This commit is contained in:
parent
1cbe7a240a
commit
dc30b11fbc
@ -194,7 +194,10 @@ HashMap::Entry* HashMap::Probe(void* key, uint32_t hash) {
|
||||
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();
|
||||
}
|
||||
|
@ -3857,7 +3857,7 @@ Result CodeGenerator::LoadFromGlobalSlotCheckExtensions(
|
||||
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;
|
||||
@ -5388,12 +5388,6 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) {
|
||||
} 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 &&
|
||||
@ -5448,6 +5442,8 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) {
|
||||
}
|
||||
|
||||
default:
|
||||
// NOT, DELETE, TYPEOF, and VOID are handled outside the
|
||||
// switch.
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,10 @@ Address Zone::NewExpand(int size) {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user