jitcraft/Interpreter.cpp
changeset 42 97e089e19d7d
parent 39 158f476b92b3
child 43 f6b1a68e7ebb
     1.1 --- a/jitcraft/Interpreter.cpp	Tue Jul 03 01:21:32 2012 -0700
     1.2 +++ b/jitcraft/Interpreter.cpp	Tue Jul 03 01:22:28 2012 -0700
     1.3 @@ -120,9 +120,9 @@
     1.4  }
     1.5  
     1.6  bool
     1.7 -jc::Interpret(Frame *frame, LocalSlot *result)
     1.8 +jc::Interpret(Zone *zone, Frame *frame, LocalSlot *result)
     1.9  {
    1.10 -    Top &top = *ZONE()->stack().top();
    1.11 +    Top &top = *zone->stack().top();
    1.12      LocalSlot *locals = frame->locals();
    1.13  
    1.14      for (;;) {
    1.15 @@ -146,7 +146,7 @@
    1.16      if (!frame->prev())
    1.17          return true;
    1.18  
    1.19 -    frame = ZONE()->stack().popFrame(frame);
    1.20 +    frame = zone->stack().popFrame(frame);
    1.21      locals = frame->locals();
    1.22      *top.sp++ = *result;
    1.23      top.pc += OpcodeInfo[*top.pc].length;
    1.24 @@ -368,7 +368,7 @@
    1.25      unsigned argc = READ_UINT32(top.pc);
    1.26      unsigned index = READ_UINT32(top.pc + 4);
    1.27      Function *newFun = frame->code()->module()->getFunction(index);
    1.28 -    frame = ZONE()->stack().pushFrame(frame, newFun);
    1.29 +    frame = zone->stack().pushFrame(frame, newFun);
    1.30      assert(frame);
    1.31      assert(newFun->nargs() == argc);
    1.32  
    1.33 @@ -476,8 +476,8 @@
    1.34  case OP_NEWARRAY_LIFO:
    1.35  {
    1.36      // :TODO: use Local
    1.37 -    Local<ArrayMap> map(ZONE(), ArrayMap::cast(frame->code()->map(READ_UINT32(top.pc))));
    1.38 -    Array *array = GenerateArray(ZONE(), map);
    1.39 +    Local<ArrayMap> map(zone, ArrayMap::cast(frame->code()->map(READ_UINT32(top.pc))));
    1.40 +    Array *array = GenerateArray(zone, map);
    1.41      if (!array) {
    1.42          assert(false);
    1.43          return false;
    1.44 @@ -490,21 +490,21 @@
    1.45  case OP_SAVELIFO:
    1.46  {
    1.47      unsigned slot = READ_UINT32(top.pc);
    1.48 -    locals[slot].address = ZONE()->heap().lifoPosition();
    1.49 +    locals[slot].address = zone->heap().lifoPosition();
    1.50      break;
    1.51  }
    1.52  
    1.53  case OP_UNWINDLIFO:
    1.54  {
    1.55      unsigned slot = READ_UINT32(top.pc);
    1.56 -    ZONE()->heap().unwindLifo(locals[slot].address);
    1.57 +    zone->heap().unwindLifo(locals[slot].address);
    1.58      break;
    1.59  }
    1.60  
    1.61  case OP_VARREF_LIFO:
    1.62  {
    1.63      unsigned slot = READ_UINT32(top.pc);
    1.64 -    if (!PushNewRef(ZONE(), top, &locals[slot], Heap::Tenure_Stack)) {
    1.65 +    if (!PushNewRef(zone, top, &locals[slot], Heap::Tenure_Stack)) {
    1.66          assert(false);
    1.67          return false;
    1.68      }
    1.69 @@ -514,7 +514,7 @@
    1.70  case OP_ARGREF_LIFO:
    1.71  {
    1.72      unsigned slot = READ_UINT32(top.pc);
    1.73 -    if (!PushNewRef(ZONE(), top, &frame->arg(slot), Heap::Tenure_Stack)) {
    1.74 +    if (!PushNewRef(zone, top, &frame->arg(slot), Heap::Tenure_Stack)) {
    1.75          assert(false);
    1.76          return false;
    1.77      }
    1.78 @@ -523,8 +523,8 @@
    1.79  
    1.80  case OP_ARRAYREF_LIFO:
    1.81  {
    1.82 -    Local<Array> array(ZONE(), top.sp[-2].array);
    1.83 -    Local<Reference> ref(ZONE(), Reference::NewArray(ZONE(), array, top.sp[-1].i32, Heap::Tenure_Stack));
    1.84 +    Local<Array> array(zone, top.sp[-2].array);
    1.85 +    Local<Reference> ref(zone, Reference::NewArray(zone, array, top.sp[-1].i32, Heap::Tenure_Stack));
    1.86      if (!ref) {
    1.87          assert(false);
    1.88          return false;
    1.89 @@ -536,7 +536,7 @@
    1.90  
    1.91  case OP_SLOTREF_LIFO:
    1.92  {
    1.93 -    Reference *ref = Reference::NewStack(ZONE(), top.sp[-1], Heap::Tenure_Stack);
    1.94 +    Reference *ref = Reference::NewStack(zone, top.sp[-1], Heap::Tenure_Stack);
    1.95      if (!ref) {
    1.96          assert(false);
    1.97          return false;
    1.98 @@ -583,7 +583,7 @@
    1.99  {
   1.100      // Note for this assignment opcode, we return the left-hand side, not the
   1.101      // right, since in this case the result of the expression could be different.
   1.102 -    if (!CopyArray(ZONE(), top.sp[-2].array, top.sp[-1].array)) {
   1.103 +    if (!CopyArray(zone, top.sp[-2].array, top.sp[-1].array)) {
   1.104          assert(false);
   1.105          return false;
   1.106      }