Reviewers: Michail Naganov,

Message:
Misha,

may you have a look?

Guys, if I correctly use ScopedVector, I'll go over rest of NewArray usages to
audit them and probably turn some into ScopedVector.

Description:
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

Please review this at http://codereview.chromium.org/1712025/show

Affected files:
  M src/runtime.cc


Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index c35a1fb418e9338d121296f64910ff73afe82b76..0ac0641c37e0d0e96bc811094d14973528dc3cc6 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -4225,7 +4225,7 @@ static Object* Runtime_GetLocalPropertyNames(Arguments args) {
   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 @@ static Object* Runtime_GetLocalPropertyNames(Arguments args) {
     }
   }

-  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