Revision: 11407
Author:   [email protected]
Date:     Fri Apr 20 10:08:01 2012
Log:      Issue 2089 Expose value wrapper's inner values

Review URL: https://chromiumcodereview.appspot.com/10162006
http://code.google.com/p/v8/source/detail?r=11407

Modified:
 /branches/bleeding_edge/src/mirror-debugger.js

=======================================
--- /branches/bleeding_edge/src/mirror-debugger.js      Thu Mar 15 04:51:26 2012
+++ /branches/bleeding_edge/src/mirror-debugger.js      Fri Apr 20 10:08:01 2012
@@ -596,6 +596,23 @@
 };


+/**
+ * Return the primitive value if this is object of Boolean, Number or String
+ * type (but not Date). Otherwise return undefined.
+ */
+ObjectMirror.prototype.primitiveValue = function() {
+  if (!IS_STRING_WRAPPER(this.value_) && !IS_NUMBER_WRAPPER(this.value_) &&
+      !IS_BOOLEAN_WRAPPER(this.value_)) {
+    return void 0;
+  }
+  var primitiveValue = %_ValueOf(this.value_);
+  if (IS_UNDEFINED(primitiveValue)) {
+    return void 0;
+  }
+  return MakeMirror(primitiveValue);
+};
+
+
 ObjectMirror.prototype.hasNamedInterceptor = function() {
   // Get information on interceptors for this object.
   var x = %GetInterceptorInfo(this.value_);
@@ -2233,6 +2250,11 @@
       this.serializeReference(mirror.constructorFunction());
   content.protoObject = this.serializeReference(mirror.protoObject());
content.prototypeObject = this.serializeReference(mirror.prototypeObject());
+
+  var primitiveValue = mirror.primitiveValue();
+  if (!IS_UNDEFINED(primitiveValue)) {
+    content.primitiveValue = this.serializeReference(primitiveValue);
+  }

   // Add flags to indicate whether there are interceptors.
   if (mirror.hasNamedInterceptor()) {

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to