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 and properties of the bound function. | 801 * scalar wrapper objects, properties of the bound function and properties of |
| 802 * the promise. |
802 * This method is done static to be accessible from Debug API with the bare | 803 * This method is done static to be accessible from Debug API with the bare |
803 * values without mirrors. | 804 * values without mirrors. |
804 * @return {Array} array (possibly empty) of InternalProperty instances | 805 * @return {Array} array (possibly empty) of InternalProperty instances |
805 */ | 806 */ |
806 ObjectMirror.GetInternalProperties = function(value) { | 807 ObjectMirror.GetInternalProperties = function(value) { |
807 if (IS_STRING_WRAPPER(value) || IS_NUMBER_WRAPPER(value) || | 808 if (IS_STRING_WRAPPER(value) || IS_NUMBER_WRAPPER(value) || |
808 IS_BOOLEAN_WRAPPER(value)) { | 809 IS_BOOLEAN_WRAPPER(value)) { |
809 var primitiveValue = %_ValueOf(value); | 810 var primitiveValue = %_ValueOf(value); |
810 return [new InternalPropertyMirror("[[PrimitiveValue]]", primitiveValue)]; | 811 return [new InternalPropertyMirror("[[PrimitiveValue]]", primitiveValue)]; |
811 } else if (IS_FUNCTION(value)) { | 812 } else if (IS_FUNCTION(value)) { |
812 var bindings = %BoundFunctionGetBindings(value); | 813 var bindings = %BoundFunctionGetBindings(value); |
813 var result = []; | 814 var result = []; |
814 if (bindings && IS_ARRAY(bindings)) { | 815 if (bindings && IS_ARRAY(bindings)) { |
815 result.push(new InternalPropertyMirror("[[TargetFunction]]", | 816 result.push(new InternalPropertyMirror("[[TargetFunction]]", |
816 bindings[0])); | 817 bindings[0])); |
817 result.push(new InternalPropertyMirror("[[BoundThis]]", bindings[1])); | 818 result.push(new InternalPropertyMirror("[[BoundThis]]", bindings[1])); |
818 var boundArgs = []; | 819 var boundArgs = []; |
819 for (var i = 2; i < bindings.length; i++) { | 820 for (var i = 2; i < bindings.length; i++) { |
820 boundArgs.push(bindings[i]); | 821 boundArgs.push(bindings[i]); |
821 } | 822 } |
822 result.push(new InternalPropertyMirror("[[BoundArgs]]", boundArgs)); | 823 result.push(new InternalPropertyMirror("[[BoundArgs]]", boundArgs)); |
823 } | 824 } |
824 return result; | 825 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; |
825 } | 834 } |
826 return []; | 835 return []; |
827 } | 836 } |
828 | 837 |
829 | 838 |
830 /** | 839 /** |
831 * Mirror object for functions. | 840 * Mirror object for functions. |
832 * @param {function} value The function object reflected by this mirror. | 841 * @param {function} value The function object reflected by this mirror. |
833 * @constructor | 842 * @constructor |
834 * @extends ObjectMirror | 843 * @extends ObjectMirror |
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2716 } | 2725 } |
2717 if (!NUMBER_IS_FINITE(value)) { | 2726 if (!NUMBER_IS_FINITE(value)) { |
2718 if (value > 0) { | 2727 if (value > 0) { |
2719 return 'Infinity'; | 2728 return 'Infinity'; |
2720 } else { | 2729 } else { |
2721 return '-Infinity'; | 2730 return '-Infinity'; |
2722 } | 2731 } |
2723 } | 2732 } |
2724 return value; | 2733 return value; |
2725 } | 2734 } |
OLD | NEW |