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 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 var holder = this; | 1144 var holder = this; |
1145 while (holder) { | 1145 while (holder) { |
1146 var formatted_stack_trace = | 1146 var formatted_stack_trace = |
1147 GET_PRIVATE(holder, formatted_stack_trace_symbol); | 1147 GET_PRIVATE(holder, formatted_stack_trace_symbol); |
1148 if (IS_UNDEFINED(formatted_stack_trace)) { | 1148 if (IS_UNDEFINED(formatted_stack_trace)) { |
1149 // No formatted stack trace available. | 1149 // No formatted stack trace available. |
1150 var stack_trace = GET_PRIVATE(holder, stack_trace_symbol); | 1150 var stack_trace = GET_PRIVATE(holder, stack_trace_symbol); |
1151 if (IS_UNDEFINED(stack_trace)) { | 1151 if (IS_UNDEFINED(stack_trace)) { |
1152 // Neither formatted nor structured stack trace available. | 1152 // Neither formatted nor structured stack trace available. |
1153 // Look further up the prototype chain. | 1153 // Look further up the prototype chain. |
1154 holder = %GetPrototype(holder); | 1154 holder = %_GetPrototype(holder); |
1155 continue; | 1155 continue; |
1156 } | 1156 } |
1157 formatted_stack_trace = FormatStackTrace(holder, stack_trace); | 1157 formatted_stack_trace = FormatStackTrace(holder, stack_trace); |
1158 SET_PRIVATE(holder, stack_trace_symbol, UNDEFINED); | 1158 SET_PRIVATE(holder, stack_trace_symbol, UNDEFINED); |
1159 SET_PRIVATE(holder, formatted_stack_trace_symbol, formatted_stack_trace); | 1159 SET_PRIVATE(holder, formatted_stack_trace_symbol, formatted_stack_trace); |
1160 } | 1160 } |
1161 return formatted_stack_trace; | 1161 return formatted_stack_trace; |
1162 } | 1162 } |
1163 return UNDEFINED; | 1163 return UNDEFINED; |
1164 }; | 1164 }; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 | 1248 |
1249 // Global list of error objects visited during ErrorToString. This is | 1249 // Global list of error objects visited during ErrorToString. This is |
1250 // used to detect cycles in error toString formatting. | 1250 // used to detect cycles in error toString formatting. |
1251 var visited_errors = new InternalArray(); | 1251 var visited_errors = new InternalArray(); |
1252 var cyclic_error_marker = new $Object(); | 1252 var cyclic_error_marker = new $Object(); |
1253 | 1253 |
1254 function GetPropertyWithoutInvokingMonkeyGetters(error, name) { | 1254 function GetPropertyWithoutInvokingMonkeyGetters(error, name) { |
1255 var current = error; | 1255 var current = error; |
1256 // Climb the prototype chain until we find the holder. | 1256 // Climb the prototype chain until we find the holder. |
1257 while (current && !%HasOwnProperty(current, name)) { | 1257 while (current && !%HasOwnProperty(current, name)) { |
1258 current = %GetPrototype(current); | 1258 current = %_GetPrototype(current); |
1259 } | 1259 } |
1260 if (IS_NULL(current)) return UNDEFINED; | 1260 if (IS_NULL(current)) return UNDEFINED; |
1261 if (!IS_OBJECT(current)) return error[name]; | 1261 if (!IS_OBJECT(current)) return error[name]; |
1262 // If the property is an accessor on one of the predefined errors that can be | 1262 // If the property is an accessor on one of the predefined errors that can be |
1263 // generated statically by the compiler, don't touch it. This is to address | 1263 // generated statically by the compiler, don't touch it. This is to address |
1264 // http://code.google.com/p/chromium/issues/detail?id=69187 | 1264 // http://code.google.com/p/chromium/issues/detail?id=69187 |
1265 var desc = %GetOwnProperty(current, name); | 1265 var desc = %GetOwnProperty(current, name); |
1266 if (desc && desc[IS_ACCESSOR_INDEX]) { | 1266 if (desc && desc[IS_ACCESSOR_INDEX]) { |
1267 var isName = name === "name"; | 1267 var isName = name === "name"; |
1268 if (current === $ReferenceError.prototype) | 1268 if (current === $ReferenceError.prototype) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 function SetUpStackOverflowBoilerplate() { | 1316 function SetUpStackOverflowBoilerplate() { |
1317 var boilerplate = MakeRangeError('stack_overflow', []); | 1317 var boilerplate = MakeRangeError('stack_overflow', []); |
1318 | 1318 |
1319 %DefineAccessorPropertyUnchecked( | 1319 %DefineAccessorPropertyUnchecked( |
1320 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); | 1320 boilerplate, 'stack', StackTraceGetter, StackTraceSetter, DONT_ENUM); |
1321 | 1321 |
1322 return boilerplate; | 1322 return boilerplate; |
1323 } | 1323 } |
1324 | 1324 |
1325 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1325 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
OLD | NEW |