| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 return result; | 183 return result; |
| 184 } | 184 } |
| 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_OBJECT(obj) && %GetDataProperty(obj, "toString") === ObjectToString) { | 194 if (IS_OBJECT(obj) && %GetDataProperty(obj, "toString") === ObjectToString) { |
| 194 var constructor = obj.constructor; | 195 var constructor = obj.constructor; |
| 195 if (typeof constructor == "function") { | 196 if (typeof constructor == "function") { |
| 196 var constructorName = constructor.name; | 197 var constructorName = constructor.name; |
| 197 if (IS_STRING(constructorName) && constructorName !== "") { | 198 if (IS_STRING(constructorName) && constructorName !== "") { |
| 198 return "#<" + constructorName + ">"; | 199 return "#<" + constructorName + ">"; |
| 199 } | 200 } |
| 200 } | 201 } |
| 201 } | 202 } |
| 202 if (IsNativeErrorObject(obj)) return %_CallFunction(obj, ErrorToString); | 203 if (IsNativeErrorObject(obj)) return %_CallFunction(obj, ErrorToString); |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 %DefineOrRedefineDataProperty(this, 'stack', v, NONE); | 1266 %DefineOrRedefineDataProperty(this, 'stack', v, NONE); |
| 1266 } | 1267 } |
| 1267 | 1268 |
| 1268 %DefineOrRedefineAccessorProperty( | 1269 %DefineOrRedefineAccessorProperty( |
| 1269 boilerplate, 'stack', getter, setter, DONT_ENUM); | 1270 boilerplate, 'stack', getter, setter, DONT_ENUM); |
| 1270 | 1271 |
| 1271 return boilerplate; | 1272 return boilerplate; |
| 1272 } | 1273 } |
| 1273 | 1274 |
| 1274 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1275 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
| OLD | NEW |