diff -r 0998a43cc155 -r ca99a81745fe src/Zone.cpp --- a/src/Zone.cpp Sat Dec 29 00:55:38 2012 -0800 +++ b/src/Zone.cpp Tue Jan 01 15:34:07 2013 -0800 @@ -24,6 +24,7 @@ #include "AllocatorPolicies.h" #include "Array.h" #include "NativeTable.h" +#include "Packages.h" #include "Spaces-inl.h" #include "Heap-inl.h" @@ -39,6 +40,8 @@ types_(NULL), symbols_(NULL), globalRoots_(NULL), + nativeTable_(NULL), + packages_(NULL), lastLocalRoot_(NULL), specialRoots_(NULL), hasPendingException_(false), @@ -48,10 +51,11 @@ Zone::~Zone() { + delete nativeTable_; delete types_; - delete nativeTable_; + delete symbols_; + delete packages_; delete globalRoots_; - delete symbols_; } bool @@ -74,6 +78,10 @@ if (!nativeTable_ || !nativeTable_->initialize()) return false; + packages_ = new PackageCache(this); + if (!packages_ || !packages_->initialize()) + return false; + MapKind maps[] = { MapKind_Type, @@ -95,6 +103,8 @@ MapKind_Native, MapKind_Descriptor, MapKind_Box, + MapKind_List, + MapKind_Package, MapKind_FreeRegion, MapKind_EnvironmentSlotDescriptorArray }; @@ -176,6 +186,7 @@ globalRoots_->accept(visitor); rootScopes_.accept(visitor); nativeTable_->accept(visitor); + packages_->accept(visitor); stack_.accept(visitor); } @@ -326,6 +337,24 @@ publicFunctionListener_ = listener; } +void * +Zone::malloc(size_t size) +{ + void *ptr = ::malloc(size); + if (!ptr) + reportOutOfMemory(); + return ptr; +} + +void * +Zone::realloc(void *ptr, size_t size) +{ + ptr = ::realloc(ptr, size); + if (!ptr) + reportOutOfMemory(); + return ptr; +} + AutoRooted::AutoRooted(Zone *zone) : zone_(zone), prev_(*zone->lastSpecialRoot())