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 | |
616 ObjectMirror.prototype.hasNamedInterceptor = function() { | 599 ObjectMirror.prototype.hasNamedInterceptor = function() { |
617 // Get information on interceptors for this object. | 600 // Get information on interceptors for this object. |
618 var x = %GetInterceptorInfo(this.value_); | 601 var x = %GetInterceptorInfo(this.value_); |
619 return (x & 2) != 0; | 602 return (x & 2) != 0; |
620 }; | 603 }; |
621 | 604 |
622 | 605 |
623 ObjectMirror.prototype.hasIndexedInterceptor = function() { | 606 ObjectMirror.prototype.hasIndexedInterceptor = function() { |
624 // Get information on interceptors for this object. | 607 // Get information on interceptors for this object. |
625 var x = %GetInterceptorInfo(this.value_); | 608 var x = %GetInterceptorInfo(this.value_); |
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2243 * "properties":[<properties>]} | 2226 * "properties":[<properties>]} |
2244 */ | 2227 */ |
2245 JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content, | 2228 JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content, |
2246 details) { | 2229 details) { |
2247 // Add general object properties. | 2230 // Add general object properties. |
2248 content.className = mirror.className(); | 2231 content.className = mirror.className(); |
2249 content.constructorFunction = | 2232 content.constructorFunction = |
2250 this.serializeReference(mirror.constructorFunction()); | 2233 this.serializeReference(mirror.constructorFunction()); |
2251 content.protoObject = this.serializeReference(mirror.protoObject()); | 2234 content.protoObject = this.serializeReference(mirror.protoObject()); |
2252 content.prototypeObject = this.serializeReference(mirror.prototypeObject()); | 2235 content.prototypeObject = this.serializeReference(mirror.prototypeObject()); |
2253 | |
2254 var primitiveValue = mirror.primitiveValue(); | |
2255 if (!IS_UNDEFINED(primitiveValue)) { | |
2256 content.primitiveValue = this.serializeReference(primitiveValue); | |
2257 } | |
2258 | 2236 |
2259 // Add flags to indicate whether there are interceptors. | 2237 // Add flags to indicate whether there are interceptors. |
2260 if (mirror.hasNamedInterceptor()) { | 2238 if (mirror.hasNamedInterceptor()) { |
2261 content.namedInterceptor = true; | 2239 content.namedInterceptor = true; |
2262 } | 2240 } |
2263 if (mirror.hasIndexedInterceptor()) { | 2241 if (mirror.hasIndexedInterceptor()) { |
2264 content.indexedInterceptor = true; | 2242 content.indexedInterceptor = true; |
2265 } | 2243 } |
2266 | 2244 |
2267 // Add function specific properties. | 2245 // Add function specific properties. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2450 } | 2428 } |
2451 if (!NUMBER_IS_FINITE(value)) { | 2429 if (!NUMBER_IS_FINITE(value)) { |
2452 if (value > 0) { | 2430 if (value > 0) { |
2453 return 'Infinity'; | 2431 return 'Infinity'; |
2454 } else { | 2432 } else { |
2455 return '-Infinity'; | 2433 return '-Infinity'; |
2456 } | 2434 } |
2457 } | 2435 } |
2458 return value; | 2436 return value; |
2459 } | 2437 } |
OLD | NEW |