OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 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 // ------------------------------------------------------------------- | 5 // ------------------------------------------------------------------- |
6 | 6 |
7 var $errorToString; | 7 var $errorToString; |
8 var $getStackTraceLine; | 8 var $getStackTraceLine; |
9 var $messageGetPositionInLine; | 9 var $messageGetPositionInLine; |
10 var $messageGetLineNumber; | 10 var $messageGetLineNumber; |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 line = "<error>"; | 842 line = "<error>"; |
843 } | 843 } |
844 } | 844 } |
845 lines.push(" at " + line); | 845 lines.push(" at " + line); |
846 } | 846 } |
847 return %_CallFunction(lines, "\n", ArrayJoin); | 847 return %_CallFunction(lines, "\n", ArrayJoin); |
848 } | 848 } |
849 | 849 |
850 | 850 |
851 function GetTypeName(receiver, requireConstructor) { | 851 function GetTypeName(receiver, requireConstructor) { |
| 852 if (IS_NULL_OR_UNDEFINED(receiver)) return null; |
852 var constructor = receiver.constructor; | 853 var constructor = receiver.constructor; |
853 if (!constructor) { | 854 if (!constructor) { |
854 return requireConstructor ? null : | 855 return requireConstructor ? null : |
855 %_CallFunction(receiver, NoSideEffectsObjectToString); | 856 %_CallFunction(receiver, NoSideEffectsObjectToString); |
856 } | 857 } |
857 var constructorName = constructor.name; | 858 var constructorName = constructor.name; |
858 if (!constructorName) { | 859 if (!constructorName) { |
859 return requireConstructor ? null : | 860 return requireConstructor ? null : |
860 %_CallFunction(receiver, NoSideEffectsObjectToString); | 861 %_CallFunction(receiver, NoSideEffectsObjectToString); |
861 } | 862 } |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 // Define accessors first, as this may fail and throw. | 1083 // Define accessors first, as this may fail and throw. |
1083 ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, | 1084 ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, |
1084 set: StackTraceSetter, | 1085 set: StackTraceSetter, |
1085 configurable: true }); | 1086 configurable: true }); |
1086 %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); | 1087 %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); |
1087 }; | 1088 }; |
1088 | 1089 |
1089 GlobalError.captureStackTrace = captureStackTrace; | 1090 GlobalError.captureStackTrace = captureStackTrace; |
1090 | 1091 |
1091 }); | 1092 }); |
OLD | NEW |