OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 | 186 |
187 function NoSideEffectToString(obj) { | 187 function NoSideEffectToString(obj) { |
188 if (IS_STRING(obj)) return obj; | 188 if (IS_STRING(obj)) return obj; |
189 if (IS_NUMBER(obj)) return %_NumberToString(obj); | 189 if (IS_NUMBER(obj)) return %_NumberToString(obj); |
190 if (IS_BOOLEAN(obj)) return x ? 'true' : 'false'; | 190 if (IS_BOOLEAN(obj)) return x ? 'true' : 'false'; |
191 if (IS_UNDEFINED(obj)) return 'undefined'; | 191 if (IS_UNDEFINED(obj)) return 'undefined'; |
192 if (IS_NULL(obj)) return 'null'; | 192 if (IS_NULL(obj)) return 'null'; |
193 if (IS_FUNCTION(obj)) return %_CallFunction(obj, FunctionToString); | 193 if (IS_FUNCTION(obj)) return %_CallFunction(obj, FunctionToString); |
194 if (IS_OBJECT(obj) && %GetDataProperty(obj, "toString") === ObjectToString) { | 194 if (IS_OBJECT(obj) && %GetDataProperty(obj, "toString") === ObjectToString) { |
195 var constructor = obj.constructor; | 195 var constructor = %GetDataProperty(obj, "constructor"); |
196 if (typeof constructor == "function") { | 196 if (typeof constructor == "function") { |
197 var constructorName = constructor.name; | 197 var constructorName = constructor.name; |
198 if (IS_STRING(constructorName) && constructorName !== "") { | 198 if (IS_STRING(constructorName) && constructorName !== "") { |
199 return "#<" + constructorName + ">"; | 199 return "#<" + constructorName + ">"; |
200 } | 200 } |
201 } | 201 } |
202 } | 202 } |
203 if (IsNativeErrorObject(obj)) return %_CallFunction(obj, ErrorToString); | 203 if (IsNativeErrorObject(obj)) return %_CallFunction(obj, ErrorToString); |
204 return %_CallFunction(obj, ObjectToString); | 204 return %_CallFunction(obj, ObjectToString); |
205 } | 205 } |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 %SetOverflowedStackTrace(this, void 0); | 1293 %SetOverflowedStackTrace(this, void 0); |
1294 } | 1294 } |
1295 | 1295 |
1296 %DefineOrRedefineAccessorProperty( | 1296 %DefineOrRedefineAccessorProperty( |
1297 boilerplate, 'stack', getter, setter, DONT_ENUM); | 1297 boilerplate, 'stack', getter, setter, DONT_ENUM); |
1298 | 1298 |
1299 return boilerplate; | 1299 return boilerplate; |
1300 } | 1300 } |
1301 | 1301 |
1302 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1302 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
OLD | NEW |