| 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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 | 755 |
| 756 function GetStackTraceLine(recv, fun, pos, isGlobal) { | 756 function GetStackTraceLine(recv, fun, pos, isGlobal) { |
| 757 return new CallSite(recv, fun, pos).toString(); | 757 return new CallSite(recv, fun, pos).toString(); |
| 758 } | 758 } |
| 759 | 759 |
| 760 // ---------------------------------------------------------------------------- | 760 // ---------------------------------------------------------------------------- |
| 761 // Error implementation | 761 // Error implementation |
| 762 | 762 |
| 763 // Defines accessors for a property that is calculated the first time | 763 // Defines accessors for a property that is calculated the first time |
| 764 // the property is read. | 764 // the property is read. |
| 765 function DefineOneShotAccessor(obj, name, value_factory) { | 765 function DefineOneShotAccessor(obj, name, fun) { |
| 766 // Note that the accessors consistently operate on 'obj', not 'this'. | 766 // Note that the accessors consistently operate on 'obj', not 'this'. |
| 767 // Since the object may occur in someone else's prototype chain we | 767 // Since the object may occur in someone else's prototype chain we |
| 768 // can't rely on 'this' being the same as 'obj'. | 768 // can't rely on 'this' being the same as 'obj'. |
| 769 var value; | 769 var value; |
| 770 var value_factory = fun; |
| 770 var getter = function() { | 771 var getter = function() { |
| 771 if (value_factory == null) { | 772 if (value_factory == null) { |
| 772 return value; | 773 return value; |
| 773 } | 774 } |
| 774 value = value_factory(obj); | 775 value = value_factory(obj); |
| 775 value_factory = null; | 776 value_factory = null; |
| 776 return value; | 777 return value; |
| 777 }; | 778 }; |
| 778 var setter = function(v) { | 779 var setter = function(v) { |
| 779 value_factory = null; | 780 value_factory = null; |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 throw e; | 1259 throw e; |
| 1259 } | 1260 } |
| 1260 } | 1261 } |
| 1261 | 1262 |
| 1262 | 1263 |
| 1263 InstallFunctions($Error.prototype, DONT_ENUM, ['toString', ErrorToString]); | 1264 InstallFunctions($Error.prototype, DONT_ENUM, ['toString', ErrorToString]); |
| 1264 | 1265 |
| 1265 // Boilerplate for exceptions for stack overflows. Used from | 1266 // Boilerplate for exceptions for stack overflows. Used from |
| 1266 // Isolate::StackOverflow(). | 1267 // Isolate::StackOverflow(). |
| 1267 var kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 1268 var kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
| OLD | NEW |