diff -r f9c4371d59d4 -r 7721042bdb67 src/Interpreter.cpp --- a/src/Interpreter.cpp Thu Dec 27 21:07:03 2012 -0800 +++ b/src/Interpreter.cpp Fri Dec 28 17:13:51 2012 -0800 @@ -986,6 +986,26 @@ break; } +case OP_DEPARRAY: +{ + Local map(zone, ArrayMap::cast(top.fp->code()->object(READ_UINT32(top.pc)))); + Local array(zone, Array::cast(top.sp[-2].obj)); + int index = top.sp[-1].i32; + + // We allow taking 0-length dependent arrays. + if (index < 0 || unsigned(index) > array->length()) { + zone->reportError(Message_ArrayIndexOutOfBounds, index, array->length()); + goto error; + } + + top.sp[-2].obj = DependentArray::New(zone, array, map, index); + if (!top.sp[-2].obj) + goto error; + + top.sp--; + break; +} + default: assert(false); return false;