[cfe-commits] r65171 - /cfe/trunk/lib/AST/DeclObjC.cpp

Chris Lattner sabre at nondot.org
Fri Feb 20 13:44:01 PST 2009


Author: lattner
Date: Fri Feb 20 15:44:01 2009
New Revision: 65171

URL: http://llvm.org/viewvc/llvm-project?rev=65171&view=rev
Log:
allocate and dellocate objc decl list through AST Context instead of
with new/delete.  With disable-free, this reduces the number of 4/8 byte
mallocs from 4793/1541 to 865/456 and also drops other sizes as well.

This is a very small perf win, nothing major.

Modified:
    cfe/trunk/lib/AST/DeclObjC.cpp

Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=65171&r1=65170&r2=65171&view=diff

==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Fri Feb 20 15:44:01 2009
@@ -21,7 +21,7 @@
 //===----------------------------------------------------------------------===//
 
 void ObjCListBase::Destroy(ASTContext &Ctx) {
-  delete[] List;
+  Ctx.Deallocate(List);
   NumElts = 0;
   List = 0;
 }
@@ -30,7 +30,8 @@
   assert(List == 0 && "Elements already set!");
   if (Elts == 0) return;  // Setting to an empty list is a noop.
   
-  List = new void*[Elts];
+  
+  List = new (Ctx) void*[Elts];
   NumElts = Elts;
   memcpy(List, InList, sizeof(void*)*Elts);
 }





More information about the cfe-commits mailing list