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 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 %FunctionSetInstanceClassName(ErrorPrototype, 'Error'); | 1214 %FunctionSetInstanceClassName(ErrorPrototype, 'Error'); |
1215 %FunctionSetPrototype(f, new ErrorPrototype()); | 1215 %FunctionSetPrototype(f, new ErrorPrototype()); |
1216 } else { | 1216 } else { |
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 try { captureStackTrace(this, f); } catch (e) { } |
1224 // Define all the expected properties directly on the error | 1225 // Define all the expected properties directly on the error |
1225 // object. This avoids going through getters and setters defined | 1226 // object. This avoids going through getters and setters defined |
1226 // on prototype objects. | 1227 // on prototype objects. |
1227 if (!IS_UNDEFINED(m)) { | 1228 if (!IS_UNDEFINED(m)) { |
1228 %AddNamedProperty(this, 'message', ToString(m), DONT_ENUM); | 1229 %AddNamedProperty(this, 'message', ToString(m), DONT_ENUM); |
1229 } | 1230 } |
1230 try { captureStackTrace(this, f); } catch (e) { } | |
1231 } else { | 1231 } else { |
1232 return new f(m); | 1232 return new f(m); |
1233 } | 1233 } |
1234 }); | 1234 }); |
1235 %SetNativeFlag(f); | 1235 %SetNativeFlag(f); |
1236 }; | 1236 }; |
1237 | 1237 |
1238 DefineError(function Error() { }); | 1238 DefineError(function Error() { }); |
1239 DefineError(function TypeError() { }); | 1239 DefineError(function TypeError() { }); |
1240 DefineError(function RangeError() { }); | 1240 DefineError(function RangeError() { }); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 function SetUpStackOverflowBoilerplate() { | 1320 function SetUpStackOverflowBoilerplate() { |
1321 var boilerplate = MakeRangeError('stack_overflow', []); | 1321 var boilerplate = MakeRangeError('stack_overflow', []); |
1322 | 1322 |
1323 %DefineAccessorPropertyUnchecked( | 1323 %DefineAccessorPropertyUnchecked( |
1324 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); | 1324 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); |
1325 | 1325 |
1326 return boilerplate; | 1326 return boilerplate; |
1327 } | 1327 } |
1328 | 1328 |
1329 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1329 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
OLD | NEW |