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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 %SetProperty($Error.prototype, 'message', '', DONT_ENUM); | 1233 %SetProperty($Error.prototype, 'message', '', DONT_ENUM); |
1234 | 1234 |
1235 // Global list of error objects visited during ErrorToString. This is | 1235 // Global list of error objects visited during ErrorToString. This is |
1236 // used to detect cycles in error toString formatting. | 1236 // used to detect cycles in error toString formatting. |
1237 var visited_errors = new InternalArray(); | 1237 var visited_errors = new InternalArray(); |
1238 var cyclic_error_marker = new $Object(); | 1238 var cyclic_error_marker = new $Object(); |
1239 | 1239 |
1240 function GetPropertyWithoutInvokingMonkeyGetters(error, name) { | 1240 function GetPropertyWithoutInvokingMonkeyGetters(error, name) { |
1241 var current = error; | 1241 var current = error; |
1242 // Climb the prototype chain until we find the holder. | 1242 // Climb the prototype chain until we find the holder. |
1243 while (current && !%HasLocalProperty(current, name)) { | 1243 while (current && !%HasOwnProperty(current, name)) { |
1244 current = %GetPrototype(current); | 1244 current = %GetPrototype(current); |
1245 } | 1245 } |
1246 if (IS_NULL(current)) return UNDEFINED; | 1246 if (IS_NULL(current)) return UNDEFINED; |
1247 if (!IS_OBJECT(current)) return error[name]; | 1247 if (!IS_OBJECT(current)) return error[name]; |
1248 // If the property is an accessor on one of the predefined errors that can be | 1248 // If the property is an accessor on one of the predefined errors that can be |
1249 // generated statically by the compiler, don't touch it. This is to address | 1249 // generated statically by the compiler, don't touch it. This is to address |
1250 // http://code.google.com/p/chromium/issues/detail?id=69187 | 1250 // http://code.google.com/p/chromium/issues/detail?id=69187 |
1251 var desc = %GetOwnProperty(current, name); | 1251 var desc = %GetOwnProperty(current, name); |
1252 if (desc && desc[IS_ACCESSOR_INDEX]) { | 1252 if (desc && desc[IS_ACCESSOR_INDEX]) { |
1253 var isName = name === "name"; | 1253 var isName = name === "name"; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 return result; | 1334 return result; |
1335 }; | 1335 }; |
1336 | 1336 |
1337 %DefineOrRedefineAccessorProperty( | 1337 %DefineOrRedefineAccessorProperty( |
1338 boilerplate, 'stack', getter, setter, DONT_ENUM); | 1338 boilerplate, 'stack', getter, setter, DONT_ENUM); |
1339 | 1339 |
1340 return boilerplate; | 1340 return boilerplate; |
1341 } | 1341 } |
1342 | 1342 |
1343 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); | 1343 var kStackOverflowBoilerplate = SetUpStackOverflowBoilerplate(); |
OLD | NEW |