| 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 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 %FunctionSetPrototype(f, new $Error()); | 1217 %FunctionSetPrototype(f, new $Error()); |
| 1218 } | 1218 } |
| 1219 %FunctionSetInstanceClassName(f, 'Error'); | 1219 %FunctionSetInstanceClassName(f, 'Error'); |
| 1220 %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM); | 1220 %AddNamedProperty(f.prototype, 'constructor', f, DONT_ENUM); |
| 1221 %AddNamedProperty(f.prototype, "name", name, DONT_ENUM); | 1221 %AddNamedProperty(f.prototype, "name", name, DONT_ENUM); |
| 1222 %SetCode(f, function(m) { | 1222 %SetCode(f, function(m) { |
| 1223 if (%_IsConstructCall()) { | 1223 if (%_IsConstructCall()) { |
| 1224 // Define all the expected properties directly on the error | 1224 // Define all the expected properties directly on the error |
| 1225 // object. This avoids going through getters and setters defined | 1225 // object. This avoids going through getters and setters defined |
| 1226 // on prototype objects. | 1226 // on prototype objects. |
| 1227 %AddNamedProperty(this, 'stack', UNDEFINED, DONT_ENUM); | |
| 1228 if (!IS_UNDEFINED(m)) { | 1227 if (!IS_UNDEFINED(m)) { |
| 1229 %AddNamedProperty(this, 'message', ToString(m), DONT_ENUM); | 1228 %AddNamedProperty(this, 'message', ToString(m), DONT_ENUM); |
| 1230 } | 1229 } |
| 1231 try { captureStackTrace(this, f); } catch (e) { } | 1230 try { captureStackTrace(this, f); } catch (e) { } |
| 1232 } else { | 1231 } else { |
| 1233 return new f(m); | 1232 return new f(m); |
| 1234 } | 1233 } |
| 1235 }); | 1234 }); |
| 1236 %SetNativeFlag(f); | 1235 %SetNativeFlag(f); |
| 1237 }; | 1236 }; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 function SetUpStackOverflowBoilerplate() { | 1320 function SetUpStackOverflowBoilerplate() { |
| 1322 var boilerplate = MakeRangeError('stack_overflow', []); | 1321 var boilerplate = MakeRangeError('stack_overflow', []); |
| 1323 | 1322 |
| 1324 %DefineAccessorPropertyUnchecked( | 1323 %DefineAccessorPropertyUnchecked( |
| 1325 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); | 1324 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); |
| 1326 | 1325 |
| 1327 return boilerplate; | 1326 return boilerplate; |
| 1328 } | 1327 } |
| 1329 | 1328 |
| 1330 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1329 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
| OLD | NEW |