1.1 --- a/src/Zone.cpp Sat Dec 29 00:55:38 2012 -0800
1.2 +++ b/src/Zone.cpp Tue Jan 01 15:34:07 2013 -0800
1.3 @@ -24,6 +24,7 @@
1.4 #include "AllocatorPolicies.h"
1.5 #include "Array.h"
1.6 #include "NativeTable.h"
1.7 +#include "Packages.h"
1.8 #include "Spaces-inl.h"
1.9 #include "Heap-inl.h"
1.10
1.11 @@ -39,6 +40,8 @@
1.12 types_(NULL),
1.13 symbols_(NULL),
1.14 globalRoots_(NULL),
1.15 + nativeTable_(NULL),
1.16 + packages_(NULL),
1.17 lastLocalRoot_(NULL),
1.18 specialRoots_(NULL),
1.19 hasPendingException_(false),
1.20 @@ -48,10 +51,11 @@
1.21
1.22 Zone::~Zone()
1.23 {
1.24 + delete nativeTable_;
1.25 delete types_;
1.26 - delete nativeTable_;
1.27 + delete symbols_;
1.28 + delete packages_;
1.29 delete globalRoots_;
1.30 - delete symbols_;
1.31 }
1.32
1.33 bool
1.34 @@ -74,6 +78,10 @@
1.35 if (!nativeTable_ || !nativeTable_->initialize())
1.36 return false;
1.37
1.38 + packages_ = new PackageCache(this);
1.39 + if (!packages_ || !packages_->initialize())
1.40 + return false;
1.41 +
1.42 MapKind maps[] =
1.43 {
1.44 MapKind_Type,
1.45 @@ -95,6 +103,8 @@
1.46 MapKind_Native,
1.47 MapKind_Descriptor,
1.48 MapKind_Box,
1.49 + MapKind_List,
1.50 + MapKind_Package,
1.51 MapKind_FreeRegion,
1.52 MapKind_EnvironmentSlotDescriptorArray
1.53 };
1.54 @@ -176,6 +186,7 @@
1.55 globalRoots_->accept(visitor);
1.56 rootScopes_.accept(visitor);
1.57 nativeTable_->accept(visitor);
1.58 + packages_->accept(visitor);
1.59
1.60 stack_.accept(visitor);
1.61 }
1.62 @@ -326,6 +337,24 @@
1.63 publicFunctionListener_ = listener;
1.64 }
1.65
1.66 +void *
1.67 +Zone::malloc(size_t size)
1.68 +{
1.69 + void *ptr = ::malloc(size);
1.70 + if (!ptr)
1.71 + reportOutOfMemory();
1.72 + return ptr;
1.73 +}
1.74 +
1.75 +void *
1.76 +Zone::realloc(void *ptr, size_t size)
1.77 +{
1.78 + ptr = ::realloc(ptr, size);
1.79 + if (!ptr)
1.80 + reportOutOfMemory();
1.81 + return ptr;
1.82 +}
1.83 +
1.84 AutoRooted::AutoRooted(Zone *zone)
1.85 : zone_(zone),
1.86 prev_(*zone->lastSpecialRoot())