Revision: 2521
Author: [email protected]
Date: Wed Jul 22 04:29:38 2009
Log: 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
http://code.google.com/p/v8/source/detail?r=2521

Modified:
  /branches/bleeding_edge/src/hashmap.cc
  /branches/bleeding_edge/src/ia32/codegen-ia32.cc
  /branches/bleeding_edge/src/zone.cc

=======================================
--- /branches/bleeding_edge/src/hashmap.cc      Tue May 26 02:17:50 2009
+++ /branches/bleeding_edge/src/hashmap.cc      Wed Jul 22 04:29:38 2009
@@ -194,7 +194,10 @@
  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();
  }
=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc    Fri Jul 17 05:12:24  
2009
+++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc    Wed Jul 22 04:29:38  
2009
@@ -3857,7 +3857,7 @@
      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 @@
    } 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 @@
        }

        default:
+        // NOT, DELETE, TYPEOF, and VOID are handled outside the
+        // switch.
          UNREACHABLE();
      }
    }
=======================================
--- /branches/bleeding_edge/src/zone.cc Mon May 25 03:05:56 2009
+++ /branches/bleeding_edge/src/zone.cc Wed Jul 22 04:29:38 2009
@@ -176,7 +176,10 @@
      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);

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to