Revision: 4554
Author: [email protected]
Date: Fri Apr 30 03:27:25 2010
Log: Use ScopedVector instead of dynamically allocated array.

This ensures that it'll be released on any control path leaving
the function thanks to desctuctor semantics.

BUG=42925

Review URL: http://codereview.chromium.org/1712025
http://code.google.com/p/v8/source/detail?r=4554

Modified:
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /branches/bleeding_edge/src/runtime.cc      Thu Apr 29 08:14:39 2010
+++ /branches/bleeding_edge/src/runtime.cc      Fri Apr 30 03:27:25 2010
@@ -4225,7 +4225,7 @@
   int length = LocalPrototypeChainLength(*obj);

   // Find the number of local properties for each of the objects.
-  int* local_property_count = NewArray<int>(length);
+  ScopedVector<int> local_property_count(length);
   int total_property_count = 0;
   Handle<JSObject> jsproto = obj;
   for (int i = 0; i < length; i++) {
@@ -4278,7 +4278,6 @@
     }
   }

-  DeleteArray(local_property_count);
   return *Factory::NewJSArrayWithElements(names);
 }

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

Reply via email to