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_SIMD_OBJECT(obj)) { |
| 90 switch (typeof(obj)) { |
| 91 case 'float32x4': %_CallFunction(obj, $float32x4ToString); break; |
| 92 case 'int32x4': %_CallFunction(obj, $int32x4ToString); break; |
| 93 case 'bool32x4': %_CallFunction(obj, $bool32x4ToString); break; |
| 94 case 'int16x8': %_CallFunction(obj, $int16x8ToString); break; |
| 95 case 'bool16x8': %_CallFunction(obj, $bool16x8ToString); break; |
| 96 case 'int16x8': %_CallFunction(obj, $int16x8ToString); break; |
| 97 case 'bool16x8': %_CallFunction(obj, $bool16x8ToString); break; |
| 98 } |
| 99 } |
90 if (IS_OBJECT(obj) | 100 if (IS_OBJECT(obj) |
91 && %GetDataProperty(obj, "toString") === ObjectToString) { | 101 && %GetDataProperty(obj, "toString") === ObjectToString) { |
92 var constructor = %GetDataProperty(obj, "constructor"); | 102 var constructor = %GetDataProperty(obj, "constructor"); |
93 if (typeof constructor == "function") { | 103 if (typeof constructor == "function") { |
94 var constructorName = constructor.name; | 104 var constructorName = constructor.name; |
95 if (IS_STRING(constructorName) && constructorName !== "") { | 105 if (IS_STRING(constructorName) && constructorName !== "") { |
96 return "#<" + constructorName + ">"; | 106 return "#<" + constructorName + ">"; |
97 } | 107 } |
98 } | 108 } |
99 } | 109 } |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 // Define accessors first, as this may fail and throw. | 1105 // Define accessors first, as this may fail and throw. |
1096 ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, | 1106 ObjectDefineProperty(obj, 'stack', { get: StackTraceGetter, |
1097 set: StackTraceSetter, | 1107 set: StackTraceSetter, |
1098 configurable: true }); | 1108 configurable: true }); |
1099 %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); | 1109 %CollectStackTrace(obj, cons_opt ? cons_opt : captureStackTrace); |
1100 }; | 1110 }; |
1101 | 1111 |
1102 GlobalError.captureStackTrace = captureStackTrace; | 1112 GlobalError.captureStackTrace = captureStackTrace; |
1103 | 1113 |
1104 }); | 1114 }); |
OLD | NEW |