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 typ e (but not Date). | |
Yang
2012/04/17 12:48:44
Please keep the 80 character limit.
Peter Rybin
2012/04/18 12:36:09
Sorry, too much programming in WebKit :)
| |
601 * Otherwise return undefined. | |
602 */ | |
603 ObjectMirror.prototype.primitiveValue = function() { | |
604 if (!IS_STRING_WRAPPER(this.value_) && !IS_NUMBER_WRAPPER(this.value_) && !IS_ BOOLEAN_WRAPPER(this.value_)) { | |
Yang
2012/04/17 12:48:44
Ditto.
Peter Rybin
2012/04/18 12:36:09
Done.
| |
605 return void 0; | |
606 } | |
607 var primitiveValue = %DebugGetPrimitiveValue(this.value_); | |
608 if (IS_UNDEFINED(primitiveValue)) { | |
609 return void 0; | |
610 } | |
611 return MakeMirror(primitiveValue); | |
612 }; | |
613 | |
614 | |
599 ObjectMirror.prototype.hasNamedInterceptor = function() { | 615 ObjectMirror.prototype.hasNamedInterceptor = function() { |
600 // Get information on interceptors for this object. | 616 // Get information on interceptors for this object. |
601 var x = %GetInterceptorInfo(this.value_); | 617 var x = %GetInterceptorInfo(this.value_); |
602 return (x & 2) != 0; | 618 return (x & 2) != 0; |
603 }; | 619 }; |
604 | 620 |
605 | 621 |
606 ObjectMirror.prototype.hasIndexedInterceptor = function() { | 622 ObjectMirror.prototype.hasIndexedInterceptor = function() { |
607 // Get information on interceptors for this object. | 623 // Get information on interceptors for this object. |
608 var x = %GetInterceptorInfo(this.value_); | 624 var x = %GetInterceptorInfo(this.value_); |
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2226 * "properties":[<properties>]} | 2242 * "properties":[<properties>]} |
2227 */ | 2243 */ |
2228 JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content, | 2244 JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content, |
2229 details) { | 2245 details) { |
2230 // Add general object properties. | 2246 // Add general object properties. |
2231 content.className = mirror.className(); | 2247 content.className = mirror.className(); |
2232 content.constructorFunction = | 2248 content.constructorFunction = |
2233 this.serializeReference(mirror.constructorFunction()); | 2249 this.serializeReference(mirror.constructorFunction()); |
2234 content.protoObject = this.serializeReference(mirror.protoObject()); | 2250 content.protoObject = this.serializeReference(mirror.protoObject()); |
2235 content.prototypeObject = this.serializeReference(mirror.prototypeObject()); | 2251 content.prototypeObject = this.serializeReference(mirror.prototypeObject()); |
2252 | |
2253 var primitiveValue = mirror.primitiveValue(); | |
2254 if (!IS_UNDEFINED(primitiveValue)) { | |
2255 content.primitiveValue = this.serializeReference(primitiveValue); | |
2256 } | |
2236 | 2257 |
2237 // Add flags to indicate whether there are interceptors. | 2258 // Add flags to indicate whether there are interceptors. |
2238 if (mirror.hasNamedInterceptor()) { | 2259 if (mirror.hasNamedInterceptor()) { |
2239 content.namedInterceptor = true; | 2260 content.namedInterceptor = true; |
2240 } | 2261 } |
2241 if (mirror.hasIndexedInterceptor()) { | 2262 if (mirror.hasIndexedInterceptor()) { |
2242 content.indexedInterceptor = true; | 2263 content.indexedInterceptor = true; |
2243 } | 2264 } |
2244 | 2265 |
2245 // Add function specific properties. | 2266 // Add function specific properties. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2428 } | 2449 } |
2429 if (!NUMBER_IS_FINITE(value)) { | 2450 if (!NUMBER_IS_FINITE(value)) { |
2430 if (value > 0) { | 2451 if (value > 0) { |
2431 return 'Infinity'; | 2452 return 'Infinity'; |
2432 } else { | 2453 } else { |
2433 return '-Infinity'; | 2454 return '-Infinity'; |
2434 } | 2455 } |
2435 } | 2456 } |
2436 return value; | 2457 return value; |
2437 } | 2458 } |
OLD | NEW |