OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 ObjectMirror.prototype.prototypeObject = function() { | 589 ObjectMirror.prototype.prototypeObject = function() { |
590 return MakeMirror(%DebugGetProperty(this.value_, 'prototype')); | 590 return MakeMirror(%DebugGetProperty(this.value_, 'prototype')); |
591 }; | 591 }; |
592 | 592 |
593 | 593 |
594 ObjectMirror.prototype.protoObject = function() { | 594 ObjectMirror.prototype.protoObject = function() { |
595 return MakeMirror(%DebugGetPrototype(this.value_)); | 595 return MakeMirror(%DebugGetPrototype(this.value_)); |
596 }; | 596 }; |
597 | 597 |
598 | 598 |
| 599 /** |
| 600 * Return the primitive value if this is object of Boolean, Number or String |
| 601 * type (but not Date). Otherwise return undefined. |
| 602 */ |
| 603 ObjectMirror.prototype.primitiveValue = function() { |
| 604 if (!IS_STRING_WRAPPER(this.value_) && !IS_NUMBER_WRAPPER(this.value_) && |
| 605 !IS_BOOLEAN_WRAPPER(this.value_)) { |
| 606 return void 0; |
| 607 } |
| 608 var primitiveValue = %_ValueOf(this.value_); |
| 609 if (IS_UNDEFINED(primitiveValue)) { |
| 610 return void 0; |
| 611 } |
| 612 return MakeMirror(primitiveValue); |
| 613 }; |
| 614 |
| 615 |
599 ObjectMirror.prototype.hasNamedInterceptor = function() { | 616 ObjectMirror.prototype.hasNamedInterceptor = function() { |
600 // Get information on interceptors for this object. | 617 // Get information on interceptors for this object. |
601 var x = %GetInterceptorInfo(this.value_); | 618 var x = %GetInterceptorInfo(this.value_); |
602 return (x & 2) != 0; | 619 return (x & 2) != 0; |
603 }; | 620 }; |
604 | 621 |
605 | 622 |
606 ObjectMirror.prototype.hasIndexedInterceptor = function() { | 623 ObjectMirror.prototype.hasIndexedInterceptor = function() { |
607 // Get information on interceptors for this object. | 624 // Get information on interceptors for this object. |
608 var x = %GetInterceptorInfo(this.value_); | 625 var x = %GetInterceptorInfo(this.value_); |
(...skipping 1618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 */ | 2244 */ |
2228 JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content, | 2245 JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content, |
2229 details) { | 2246 details) { |
2230 // Add general object properties. | 2247 // Add general object properties. |
2231 content.className = mirror.className(); | 2248 content.className = mirror.className(); |
2232 content.constructorFunction = | 2249 content.constructorFunction = |
2233 this.serializeReference(mirror.constructorFunction()); | 2250 this.serializeReference(mirror.constructorFunction()); |
2234 content.protoObject = this.serializeReference(mirror.protoObject()); | 2251 content.protoObject = this.serializeReference(mirror.protoObject()); |
2235 content.prototypeObject = this.serializeReference(mirror.prototypeObject()); | 2252 content.prototypeObject = this.serializeReference(mirror.prototypeObject()); |
2236 | 2253 |
| 2254 var primitiveValue = mirror.primitiveValue(); |
| 2255 if (!IS_UNDEFINED(primitiveValue)) { |
| 2256 content.primitiveValue = this.serializeReference(primitiveValue); |
| 2257 } |
| 2258 |
2237 // Add flags to indicate whether there are interceptors. | 2259 // Add flags to indicate whether there are interceptors. |
2238 if (mirror.hasNamedInterceptor()) { | 2260 if (mirror.hasNamedInterceptor()) { |
2239 content.namedInterceptor = true; | 2261 content.namedInterceptor = true; |
2240 } | 2262 } |
2241 if (mirror.hasIndexedInterceptor()) { | 2263 if (mirror.hasIndexedInterceptor()) { |
2242 content.indexedInterceptor = true; | 2264 content.indexedInterceptor = true; |
2243 } | 2265 } |
2244 | 2266 |
2245 // Add function specific properties. | 2267 // Add function specific properties. |
2246 if (mirror.isFunction()) { | 2268 if (mirror.isFunction()) { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2428 } | 2450 } |
2429 if (!NUMBER_IS_FINITE(value)) { | 2451 if (!NUMBER_IS_FINITE(value)) { |
2430 if (value > 0) { | 2452 if (value > 0) { |
2431 return 'Infinity'; | 2453 return 'Infinity'; |
2432 } else { | 2454 } else { |
2433 return '-Infinity'; | 2455 return '-Infinity'; |
2434 } | 2456 } |
2435 } | 2457 } |
2436 return value; | 2458 return value; |
2437 } | 2459 } |
OLD | NEW |