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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 if (IS_NULL(obj)) return 'null'; | 79 if (IS_NULL(obj)) return 'null'; |
80 if (IS_FUNCTION(obj)) { | 80 if (IS_FUNCTION(obj)) { |
81 var str = %_CallFunction(obj, obj, $functionSourceString); | 81 var str = %_CallFunction(obj, obj, $functionSourceString); |
82 if (str.length > 128) { | 82 if (str.length > 128) { |
83 str = %_SubString(str, 0, 111) + "...<omitted>..." + | 83 str = %_SubString(str, 0, 111) + "...<omitted>..." + |
84 %_SubString(str, str.length - 2, str.length); | 84 %_SubString(str, str.length - 2, str.length); |
85 } | 85 } |
86 return str; | 86 return str; |
87 } | 87 } |
88 if (IS_SYMBOL(obj)) return %_CallFunction(obj, $symbolToString); | 88 if (IS_SYMBOL(obj)) return %_CallFunction(obj, $symbolToString); |
| 89 if (IS_FLOAT32X4(obj)) return %_CallFunction(obj, $float32x4ToString); |
89 if (IS_OBJECT(obj) | 90 if (IS_OBJECT(obj) |
90 && %GetDataProperty(obj, "toString") === ObjectToString) { | 91 && %GetDataProperty(obj, "toString") === ObjectToString) { |
91 var constructor = %GetDataProperty(obj, "constructor"); | 92 var constructor = %GetDataProperty(obj, "constructor"); |
92 if (typeof constructor == "function") { | 93 if (typeof constructor == "function") { |
93 var constructorName = constructor.name; | 94 var constructorName = constructor.name; |
94 if (IS_STRING(constructorName) && constructorName !== "") { | 95 if (IS_STRING(constructorName) && constructorName !== "") { |
95 return "#<" + constructorName + ">"; | 96 return "#<" + constructorName + ">"; |
96 } | 97 } |
97 } | 98 } |
98 } | 99 } |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 // Define accessors first, as this may fail and throw. | 1095 // Define accessors first, as this may fail and throw. |
1095 ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, | 1096 ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, |
1096 set: StackTraceSetter, | 1097 set: StackTraceSetter, |
1097 configurable: true }); | 1098 configurable: true }); |
1098 %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); | 1099 %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); |
1099 }; | 1100 }; |
1100 | 1101 |
1101 GlobalError.captureStackTrace = captureStackTrace; | 1102 GlobalError.captureStackTrace = captureStackTrace; |
1102 | 1103 |
1103 }); | 1104 }); |
OLD | NEW |