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 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 %AddProperty(f.prototype, "name", name, DONT_ENUM); | 1182 %AddProperty(f.prototype, "name", name, DONT_ENUM); |
1183 %SetCode(f, function(m) { | 1183 %SetCode(f, function(m) { |
1184 if (%_IsConstructCall()) { | 1184 if (%_IsConstructCall()) { |
1185 // Define all the expected properties directly on the error | 1185 // Define all the expected properties directly on the error |
1186 // object. This avoids going through getters and setters defined | 1186 // object. This avoids going through getters and setters defined |
1187 // on prototype objects. | 1187 // on prototype objects. |
1188 %AddProperty(this, 'stack', UNDEFINED, DONT_ENUM); | 1188 %AddProperty(this, 'stack', UNDEFINED, DONT_ENUM); |
1189 if (!IS_UNDEFINED(m)) { | 1189 if (!IS_UNDEFINED(m)) { |
1190 %AddProperty(this, 'message', ToString(m), DONT_ENUM); | 1190 %AddProperty(this, 'message', ToString(m), DONT_ENUM); |
1191 } | 1191 } |
1192 captureStackTrace(this, f); | 1192 try { captureStackTrace(this, f); } catch (e) { } |
1193 } else { | 1193 } else { |
1194 return new f(m); | 1194 return new f(m); |
1195 } | 1195 } |
1196 }); | 1196 }); |
1197 %SetNativeFlag(f); | 1197 %SetNativeFlag(f); |
1198 }; | 1198 }; |
1199 | 1199 |
1200 DefineError(function Error() { }); | 1200 DefineError(function Error() { }); |
1201 DefineError(function TypeError() { }); | 1201 DefineError(function TypeError() { }); |
1202 DefineError(function RangeError() { }); | 1202 DefineError(function RangeError() { }); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 function SetUpStackOverflowBoilerplate() { | 1282 function SetUpStackOverflowBoilerplate() { |
1283 var boilerplate = MakeRangeError('stack_overflow', []); | 1283 var boilerplate = MakeRangeError('stack_overflow', []); |
1284 | 1284 |
1285 %DefineAccessorPropertyUnchecked( | 1285 %DefineAccessorPropertyUnchecked( |
1286 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); | 1286 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); |
1287 | 1287 |
1288 return boilerplate; | 1288 return boilerplate; |
1289 } | 1289 } |
1290 | 1290 |
1291 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1291 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
OLD | NEW |