function deserialize(json, interpreter) {
  var stack = interpreter.getStateStack();
  if (!Array.isArray(json)) {
    throw TypeError('Top-level JSON is not a list.');
  }
  if (!stack.length) {
    // Require native functions to be present.
    throw Error('Interpreter must be initialized prior to deserialization.');
  }
  recordAcornConstructors_(interpreter);
  // Find all native functions in existing interpreter.
  objectList = [];
  objectMap && objectMap.clear();
  objectHunt_(stack);
  var functionMap = Object.create(null);
  for (var i = 0; i < objectList.length; i++) {
    var obj = objectList[i];
    if (typeof obj === 'function') {
      functionMap[obj.id] = obj;
    }
  }
  // First pass: Create object stubs for every object.
  objectList = new Array(json.length);
  for (var i = 0; i < json.length; i++) {
    objectList[i] = createObjectStub_(json[i], functionMap);
  }
  // Second pass: Populate properties for every object.
  for (var i = 0; i < json.length; i++) {
    populateObject_(json[i], objectList[i]);
  }
  // First object is the interpreter.
  var root = objectList[0];
  for (var prop in root) {
    interpreter[prop] = root[prop];
  }
  // Garbage collect.
  objectList = [];
  objectMap && objectMap.clear();
}
Populate an interpreter to the state defined by serialized JSON.
@param {string} json Serialized JSON.
@param {!Interpreter} interpreter JS-Interpreter instance to restore to.