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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 if (IS_UNDEFINED(obj)) return 'undefined'; | 228 if (IS_UNDEFINED(obj)) return 'undefined'; |
229 if (IS_NULL(obj)) return 'null'; | 229 if (IS_NULL(obj)) return 'null'; |
230 if (IS_FUNCTION(obj)) { | 230 if (IS_FUNCTION(obj)) { |
231 var str = %_CallFunction(obj, FunctionToString); | 231 var str = %_CallFunction(obj, FunctionToString); |
232 if (str.length > 128) { | 232 if (str.length > 128) { |
233 str = %_SubString(str, 0, 111) + "...<omitted>..." + | 233 str = %_SubString(str, 0, 111) + "...<omitted>..." + |
234 %_SubString(str, str.length - 2, str.length); | 234 %_SubString(str, str.length - 2, str.length); |
235 } | 235 } |
236 return str; | 236 return str; |
237 } | 237 } |
238 if (IS_SYMBOL(obj)) return %_CallFunction(obj, SymbolToString); | 238 if (IS_SYMBOL(obj)) return %_CallFunction(obj, $symbolToString); |
239 if (IS_OBJECT(obj) | 239 if (IS_OBJECT(obj) |
240 && %GetDataProperty(obj, "toString") === DefaultObjectToString) { | 240 && %GetDataProperty(obj, "toString") === DefaultObjectToString) { |
241 var constructor = %GetDataProperty(obj, "constructor"); | 241 var constructor = %GetDataProperty(obj, "constructor"); |
242 if (typeof constructor == "function") { | 242 if (typeof constructor == "function") { |
243 var constructorName = constructor.name; | 243 var constructorName = constructor.name; |
244 if (IS_STRING(constructorName) && constructorName !== "") { | 244 if (IS_STRING(constructorName) && constructorName !== "") { |
245 return "#<" + constructorName + ">"; | 245 return "#<" + constructorName + ">"; |
246 } | 246 } |
247 } | 247 } |
248 } | 248 } |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 function SetUpStackOverflowBoilerplate() { | 1323 function SetUpStackOverflowBoilerplate() { |
1324 var boilerplate = MakeRangeError('stack_overflow', []); | 1324 var boilerplate = MakeRangeError('stack_overflow', []); |
1325 | 1325 |
1326 %DefineAccessorPropertyUnchecked( | 1326 %DefineAccessorPropertyUnchecked( |
1327 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); | 1327 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); |
1328 | 1328 |
1329 return boilerplate; | 1329 return boilerplate; |
1330 } | 1330 } |
1331 | 1331 |
1332 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1332 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
OLD | NEW |