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 kMessages = { | 7 var kMessages = { |
8 // Error | 8 // Error |
9 cyclic_proto: ["Cyclic __proto__ value"], | 9 cyclic_proto: ["Cyclic __proto__ value"], |
10 code_gen_from_strings: ["%0"], | 10 code_gen_from_strings: ["%0"], |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 if (IS_UNDEFINED(obj)) return 'undefined'; | 204 if (IS_UNDEFINED(obj)) return 'undefined'; |
205 if (IS_NULL(obj)) return 'null'; | 205 if (IS_NULL(obj)) return 'null'; |
206 if (IS_FUNCTION(obj)) { | 206 if (IS_FUNCTION(obj)) { |
207 var str = %_CallFunction(obj, FunctionToString); | 207 var str = %_CallFunction(obj, FunctionToString); |
208 if (str.length > 128) { | 208 if (str.length > 128) { |
209 str = %_SubString(str, 0, 111) + "...<omitted>..." + | 209 str = %_SubString(str, 0, 111) + "...<omitted>..." + |
210 %_SubString(str, str.length - 2, str.length); | 210 %_SubString(str, str.length - 2, str.length); |
211 } | 211 } |
212 return str; | 212 return str; |
213 } | 213 } |
| 214 if (IS_SYMBOL(obj)) return %_CallFunction(obj, SymbolToString); |
214 if (IS_OBJECT(obj) && %GetDataProperty(obj, "toString") === ObjectToString) { | 215 if (IS_OBJECT(obj) && %GetDataProperty(obj, "toString") === ObjectToString) { |
215 var constructor = %GetDataProperty(obj, "constructor"); | 216 var constructor = %GetDataProperty(obj, "constructor"); |
216 if (typeof constructor == "function") { | 217 if (typeof constructor == "function") { |
217 var constructorName = constructor.name; | 218 var constructorName = constructor.name; |
218 if (IS_STRING(constructorName) && constructorName !== "") { | 219 if (IS_STRING(constructorName) && constructorName !== "") { |
219 return "#<" + constructorName + ">"; | 220 return "#<" + constructorName + ">"; |
220 } | 221 } |
221 } | 222 } |
222 } | 223 } |
223 if (CanBeSafelyTreatedAsAnErrorObject(obj)) { | 224 if (CanBeSafelyTreatedAsAnErrorObject(obj)) { |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 function SetUpStackOverflowBoilerplate() { | 1281 function SetUpStackOverflowBoilerplate() { |
1281 var boilerplate = MakeRangeError('stack_overflow', []); | 1282 var boilerplate = MakeRangeError('stack_overflow', []); |
1282 | 1283 |
1283 %DefineAccessorPropertyUnchecked( | 1284 %DefineAccessorPropertyUnchecked( |
1284 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); | 1285 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); |
1285 | 1286 |
1286 return boilerplate; | 1287 return boilerplate; |
1287 } | 1288 } |
1288 | 1289 |
1289 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1290 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
OLD | NEW |