Merge "add src/ component to VDLPATH"
diff --git a/go/src/v.io/x/js.core/stress/stress.vdl.go b/go/src/v.io/x/js.core/stress/stress.vdl.go
index a517331..8b7fbd3 100644
--- a/go/src/v.io/x/js.core/stress/stress.vdl.go
+++ b/go/src/v.io/x/js.core/stress/stress.vdl.go
@@ -40,6 +40,8 @@
 type StressClientMethods interface {
 	// Echo returns the payload that it receives.
 	Echo(ctx *context.T, Payload []byte, opts ...rpc.CallOpt) ([]byte, error)
+	// ServerEcho runs as many calls to Echo on the name provided in the duration
+	// specified and returns the peformance results.
 	ServerEcho(ctx *context.T, totalTime time.Duration, name string, opts ...rpc.CallOpt) (StressResults, error)
 }
 
@@ -73,6 +75,8 @@
 type StressServerMethods interface {
 	// Echo returns the payload that it receives.
 	Echo(ctx *context.T, call rpc.ServerCall, Payload []byte) ([]byte, error)
+	// ServerEcho runs as many calls to Echo on the name provided in the duration
+	// specified and returns the peformance results.
 	ServerEcho(ctx *context.T, call rpc.ServerCall, totalTime time.Duration, name string) (StressResults, error)
 }
 
@@ -148,6 +152,7 @@
 		},
 		{
 			Name: "ServerEcho",
+			Doc:  "// ServerEcho runs as many calls to Echo on the name provided in the duration\n// specified and returns the peformance results.",
 			InArgs: []rpc.ArgDesc{
 				{"totalTime", ``}, // time.Duration
 				{"name", ``},      // string
diff --git a/src/rpc/client.js b/src/rpc/client.js
index b618c5c..aca847f 100644
--- a/src/rpc/client.js
+++ b/src/rpc/client.js
@@ -310,10 +310,9 @@
     }
   };
 
-  var header = new RpcRequest(jsonMessage);
   var writer = new ByteArrayMessageWriter();
   var encoder = new Encoder(writer, this._typeEncoder);
-  encoder.encode(header);
+  encoder.encode(jsonMessage, RpcRequest.prototype._type);
   for (var i = 0; i < this._args.length; i++) {
     encoder.encode(this._args[i]);
   }
diff --git a/src/rpc/server-router.js b/src/rpc/server-router.js
index 5c327fe..eebfa17 100644
--- a/src/rpc/server-router.js
+++ b/src/rpc/server-router.js
@@ -226,13 +226,14 @@
    var signatureList = value.invoker.signature();
    var hasAuthorizer = (typeof value.authorizer === 'function');
    var hasGlobber = value.invoker.hasGlobber();
-   var reply = new LookupReply({
+   var reply = {
      handle: value._handle,
      signature: signatureList,
      hasAuthorizer: hasAuthorizer,
      hasGlobber: hasGlobber
-   });
-   self._proxy.sendRequest(hexVom.encode(reply, undefined, self._typeEncoder),
+   };
+   self._proxy.sendRequest(hexVom.encode(reply, LookupReply.prototype._type,
+                                         self._typeEncoder),
                            Outgoing.LOOKUP_RESPONSE,
                            null, messageId);
  }).catch(function(err) {
diff --git a/src/vom/bootstrap-types.js b/src/vom/bootstrap-types.js
index 479fad5..e230a5c 100644
--- a/src/vom/bootstrap-types.js
+++ b/src/vom/bootstrap-types.js
@@ -12,6 +12,7 @@
   definitions: undefined,
   idToType: idToType,
   typeToId: typeToId,
+  typeStringToId: typeStringToId,
   unionIds: {
     NAMED_TYPE: 0,
     ENUM_TYPE: 1,
@@ -136,6 +137,18 @@
 }
 
 /**
+ * Type to ID finds the bootstrap id for a type.
+ * @private
+ * @param {Type} type The type to search for.
+ * @return {number} The bootstrap id or undefined if no boostrap type is found.
+ */
+function typeStringToId(typeStr) {
+  return typeToIdMap[typeStr];
+}
+
+
+
+/**
  * ID to type looks up the boostrap type for a given ID.
  * @private
  * @param {number} id The id of the boostrap type.
diff --git a/src/vom/decoder.js b/src/vom/decoder.js
index 4787424..28e8561 100644
--- a/src/vom/decoder.js
+++ b/src/vom/decoder.js
@@ -42,7 +42,7 @@
 function Decoder(messageReader, deepWrap, typeDecoder) {
   this._messageReader = messageReader;
   this._typeDecoder = typeDecoder || new TypeDecoder();
-  this._deepWrap = deepWrap || false;
+  this._deepWrap = false;
   this._tasks = new TaskSequence();
 }
 
@@ -87,7 +87,14 @@
     // If this value should be wrapped, apply the constructor.
     if (t.kind !== kind.TYPEOBJECT && shouldWrap) {
       var Ctor = Registry.lookupOrCreateConstructor(t);
-      return new Ctor(value, this._deepWrap);
+      if (Ctor.prototype._wrappedType) {
+        return new Ctor(value);
+      }
+      if (value !== null && value !== undefined) {
+        Object.defineProperty(value, 'constructor', {
+          value: Ctor,
+        });
+      }
     }
     return value;
   });
@@ -257,6 +264,14 @@
 
   return promiseWhile(notEndByte, readField).then(function() {
     return obj;
+  }).then(function(obj) {
+    t.fields.forEach(function(field) {
+      var name = util.uncapitalize(field.name);
+      if (!obj.hasOwnProperty(name)) {
+        obj[name] = unwrap(canonicalize.zero(field.type));
+      }
+    });
+    return obj;
   });
   function notEndByte() {
     return reader.tryReadControlByte().then(function(ctrl) {
diff --git a/src/vom/type-encoder.js b/src/vom/type-encoder.js
index d74c5e8..44f9636 100644
--- a/src/vom/type-encoder.js
+++ b/src/vom/type-encoder.js
@@ -51,18 +51,19 @@
     throw new Error('Type must be an object, but instead had value ' + type);
   }
 
-  var id = BootstrapTypes.typeToId(type);
-  if (id !== undefined) {
-    return id;
-  }
-
   // This isn't a bootstrap type, so it needs to be canonicalized.
   if (!Object.isFrozen(type)) {
     type = canonicalize.type(type);
   }
 
-  // Check the cache of types that have been encoded already.
   var stringifiedType = stringify(type);
+
+  var id = BootstrapTypes.typeStringToId(stringifiedType);
+  if (id !== undefined) {
+    return id;
+  }
+
+  // Check the cache of types that have been encoded already.
   id = this._typeIds[stringifiedType];
   if (id !== undefined) {
     return id;