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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 if (IS_FUNCTION(obj)) { | 241 if (IS_FUNCTION(obj)) { |
242 var str = %_CallFunction(obj, FunctionToString); | 242 var str = %_CallFunction(obj, FunctionToString); |
243 if (str.length > 128) { | 243 if (str.length > 128) { |
244 str = %_SubString(str, 0, 111) + "...<omitted>..." + | 244 str = %_SubString(str, 0, 111) + "...<omitted>..." + |
245 %_SubString(str, str.length - 2, str.length); | 245 %_SubString(str, str.length - 2, str.length); |
246 } | 246 } |
247 return str; | 247 return str; |
248 } | 248 } |
249 if (IS_SYMBOL(obj)) return %_CallFunction(obj, $symbolToString); | 249 if (IS_SYMBOL(obj)) return %_CallFunction(obj, $symbolToString); |
250 if (IS_OBJECT(obj) | 250 if (IS_OBJECT(obj) |
251 && %GetDataProperty(obj, "toString") === DefaultObjectToString) { | 251 && %GetDataProperty(obj, "toString") === ObjectToString) { |
252 var constructor = %GetDataProperty(obj, "constructor"); | 252 var constructor = %GetDataProperty(obj, "constructor"); |
253 if (typeof constructor == "function") { | 253 if (typeof constructor == "function") { |
254 var constructorName = constructor.name; | 254 var constructorName = constructor.name; |
255 if (IS_STRING(constructorName) && constructorName !== "") { | 255 if (IS_STRING(constructorName) && constructorName !== "") { |
256 return "#<" + constructorName + ">"; | 256 return "#<" + constructorName + ">"; |
257 } | 257 } |
258 } | 258 } |
259 } | 259 } |
260 if (CanBeSafelyTreatedAsAnErrorObject(obj)) { | 260 if (CanBeSafelyTreatedAsAnErrorObject(obj)) { |
261 return %_CallFunction(obj, ErrorToString); | 261 return %_CallFunction(obj, ErrorToString); |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 function SetUpStackOverflowBoilerplate() { | 1281 function SetUpStackOverflowBoilerplate() { |
1282 var boilerplate = MakeRangeError('stack_overflow', []); | 1282 var boilerplate = MakeRangeError('stack_overflow', []); |
1283 | 1283 |
1284 %DefineAccessorPropertyUnchecked( | 1284 %DefineAccessorPropertyUnchecked( |
1285 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); | 1285 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); |
1286 | 1286 |
1287 return boilerplate; | 1287 return boilerplate; |
1288 } | 1288 } |
1289 | 1289 |
1290 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1290 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
OLD | NEW |