| 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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 %FunctionSetPrototype(f, new $Error()); | 1198 %FunctionSetPrototype(f, new $Error()); |
| 1199 } | 1199 } |
| 1200 %FunctionSetInstanceClassName(f, 'Error'); | 1200 %FunctionSetInstanceClassName(f, 'Error'); |
| 1201 %DefineProperty(f.prototype, 'constructor', f, DONT_ENUM); | 1201 %DefineProperty(f.prototype, 'constructor', f, DONT_ENUM); |
| 1202 %DefineProperty(f.prototype, "name", name, DONT_ENUM); | 1202 %DefineProperty(f.prototype, "name", name, DONT_ENUM); |
| 1203 %SetCode(f, function(m) { | 1203 %SetCode(f, function(m) { |
| 1204 if (%_IsConstructCall()) { | 1204 if (%_IsConstructCall()) { |
| 1205 // Define all the expected properties directly on the error | 1205 // Define all the expected properties directly on the error |
| 1206 // object. This avoids going through getters and setters defined | 1206 // object. This avoids going through getters and setters defined |
| 1207 // on prototype objects. | 1207 // on prototype objects. |
| 1208 %IgnoreAttributesAndSetProperty(this, 'stack', UNDEFINED, DONT_ENUM); | 1208 %DefineProperty(this, 'stack', UNDEFINED, DONT_ENUM); |
| 1209 if (!IS_UNDEFINED(m)) { | 1209 if (!IS_UNDEFINED(m)) { |
| 1210 %IgnoreAttributesAndSetProperty( | 1210 %DefineProperty(this, 'message', ToString(m), DONT_ENUM); |
| 1211 this, 'message', ToString(m), DONT_ENUM); | |
| 1212 } | 1211 } |
| 1213 captureStackTrace(this, f); | 1212 captureStackTrace(this, f); |
| 1214 } else { | 1213 } else { |
| 1215 return new f(m); | 1214 return new f(m); |
| 1216 } | 1215 } |
| 1217 }); | 1216 }); |
| 1218 %SetNativeFlag(f); | 1217 %SetNativeFlag(f); |
| 1219 }; | 1218 }; |
| 1220 | 1219 |
| 1221 DefineError(function Error() { }); | 1220 DefineError(function Error() { }); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 return result; | 1334 return result; |
| 1336 }; | 1335 }; |
| 1337 | 1336 |
| 1338 %DefineOrRedefineAccessorProperty( | 1337 %DefineOrRedefineAccessorProperty( |
| 1339 boilerplate, 'stack', getter, setter, DONT_ENUM); | 1338 boilerplate, 'stack', getter, setter, DONT_ENUM); |
| 1340 | 1339 |
| 1341 return boilerplate; | 1340 return boilerplate; |
| 1342 } | 1341 } |
| 1343 | 1342 |
| 1344 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1343 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
| OLD | NEW |