OLD | NEW |
1 // Copyright 2006-2012 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Handle id counters. | 5 // Handle id counters. |
6 var next_handle_ = 0; | 6 var next_handle_ = 0; |
7 var next_transient_handle_ = -1; | 7 var next_transient_handle_ = -1; |
8 | 8 |
9 // Mirror cache. | 9 // Mirror cache. |
10 var mirror_cache_ = []; | 10 var mirror_cache_ = []; |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 if (!name) { | 791 if (!name) { |
792 name = this.className(); | 792 name = this.className(); |
793 } | 793 } |
794 } | 794 } |
795 return '#<' + name + '>'; | 795 return '#<' + name + '>'; |
796 }; | 796 }; |
797 | 797 |
798 | 798 |
799 /** | 799 /** |
800 * Return the internal properties of the value, such as [[PrimitiveValue]] of | 800 * Return the internal properties of the value, such as [[PrimitiveValue]] of |
801 * scalar wrapper objects, properties of the bound function and properties of | 801 * scalar wrapper objects and properties of the bound function. |
802 * the promise. | |
803 * This method is done static to be accessible from Debug API with the bare | 802 * This method is done static to be accessible from Debug API with the bare |
804 * values without mirrors. | 803 * values without mirrors. |
805 * @return {Array} array (possibly empty) of InternalProperty instances | 804 * @return {Array} array (possibly empty) of InternalProperty instances |
806 */ | 805 */ |
807 ObjectMirror.GetInternalProperties = function(value) { | 806 ObjectMirror.GetInternalProperties = function(value) { |
808 if (IS_STRING_WRAPPER(value) || IS_NUMBER_WRAPPER(value) || | 807 if (IS_STRING_WRAPPER(value) || IS_NUMBER_WRAPPER(value) || |
809 IS_BOOLEAN_WRAPPER(value)) { | 808 IS_BOOLEAN_WRAPPER(value)) { |
810 var primitiveValue = %_ValueOf(value); | 809 var primitiveValue = %_ValueOf(value); |
811 return [new InternalPropertyMirror("[[PrimitiveValue]]", primitiveValue)]; | 810 return [new InternalPropertyMirror("[[PrimitiveValue]]", primitiveValue)]; |
812 } else if (IS_FUNCTION(value)) { | 811 } else if (IS_FUNCTION(value)) { |
813 var bindings = %BoundFunctionGetBindings(value); | 812 var bindings = %BoundFunctionGetBindings(value); |
814 var result = []; | 813 var result = []; |
815 if (bindings && IS_ARRAY(bindings)) { | 814 if (bindings && IS_ARRAY(bindings)) { |
816 result.push(new InternalPropertyMirror("[[TargetFunction]]", | 815 result.push(new InternalPropertyMirror("[[TargetFunction]]", |
817 bindings[0])); | 816 bindings[0])); |
818 result.push(new InternalPropertyMirror("[[BoundThis]]", bindings[1])); | 817 result.push(new InternalPropertyMirror("[[BoundThis]]", bindings[1])); |
819 var boundArgs = []; | 818 var boundArgs = []; |
820 for (var i = 2; i < bindings.length; i++) { | 819 for (var i = 2; i < bindings.length; i++) { |
821 boundArgs.push(bindings[i]); | 820 boundArgs.push(bindings[i]); |
822 } | 821 } |
823 result.push(new InternalPropertyMirror("[[BoundArgs]]", boundArgs)); | 822 result.push(new InternalPropertyMirror("[[BoundArgs]]", boundArgs)); |
824 } | 823 } |
825 return result; | 824 return result; |
826 } else if (ObjectIsPromise(value)) { | |
827 var mirror = new PromiseMirror(value); | |
828 var result = []; | |
829 result.push(new InternalPropertyMirror("[[PromiseStatus]]", | |
830 mirror.status())); | |
831 result.push(new InternalPropertyMirror("[[PromiseValue]]", | |
832 mirror.promiseValue())); | |
833 return result; | |
834 } | 825 } |
835 return []; | 826 return []; |
836 } | 827 } |
837 | 828 |
838 | 829 |
839 /** | 830 /** |
840 * Mirror object for functions. | 831 * Mirror object for functions. |
841 * @param {function} value The function object reflected by this mirror. | 832 * @param {function} value The function object reflected by this mirror. |
842 * @constructor | 833 * @constructor |
843 * @extends ObjectMirror | 834 * @extends ObjectMirror |
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2725 } | 2716 } |
2726 if (!NUMBER_IS_FINITE(value)) { | 2717 if (!NUMBER_IS_FINITE(value)) { |
2727 if (value > 0) { | 2718 if (value > 0) { |
2728 return 'Infinity'; | 2719 return 'Infinity'; |
2729 } else { | 2720 } else { |
2730 return '-Infinity'; | 2721 return '-Infinity'; |
2731 } | 2722 } |
2732 } | 2723 } |
2733 return value; | 2724 return value; |
2734 } | 2725 } |
OLD | NEW |