1.1 --- a/jitcraft/Zone.cpp Sun Jul 08 17:57:44 2012 -0700
1.2 +++ b/jitcraft/Zone.cpp Mon Jul 09 01:22:03 2012 -0700
1.3 @@ -21,6 +21,7 @@
1.4 #include "TypeManager.h"
1.5 #include "GlobalRoots.h"
1.6 #include "AllocatorPolicies.h"
1.7 +#include "Array.h"
1.8
1.9 using namespace ke;
1.10
1.11 @@ -84,6 +85,36 @@
1.12 if (!types_ || !types_->initialize())
1.13 return false;
1.14
1.15 + // Create the cached array maps for generic arrays. This is for the API
1.16 + // version of Invoke(), which needs to make arrays very quickly from C++.
1.17 + {
1.18 + // Generic "cell" array (contents do not matter, just non-gc things).
1.19 + Local<Type> type(this, types_->getPrimitive(PrimitiveType_Int32));
1.20 + if (!type)
1.21 + return false;
1.22 +
1.23 + type = types_->unsafeArray(type, Type::UNKNOWN_SIZE);
1.24 + if (!type)
1.25 + return false;
1.26 +
1.27 + Local<ArrayMap> contained(this);
1.28 + genericArrayMap_ = ArrayMap::New(this, type, contained);
1.29 + if (!genericArrayMap_)
1.30 + return false;
1.31 +
1.32 + type = types_->getPrimitive(PrimitiveType_Char);
1.33 + if (!type)
1.34 + return false;
1.35 +
1.36 + type = types_->unsafeArray(type, Type::UNKNOWN_SIZE);
1.37 + if (!type)
1.38 + return false;
1.39 +
1.40 + charArrayMap_ = ArrayMap::New(this, type, contained);
1.41 + if (!charArrayMap_)
1.42 + return false;
1.43 + }
1.44 +
1.45 return true;
1.46 }
1.47
1.48 @@ -103,6 +134,8 @@
1.49 {
1.50 for (unsigned i = 0; i < MapKinds_Total; i++)
1.51 visitor->visit(maps_[i].address());
1.52 + visitor->visit(charArrayMap_.address());
1.53 + visitor->visit(genericArrayMap_.address());
1.54 types()->accept(visitor);
1.55
1.56 Local<Object> *local = lastLocalRoot_;