| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 | 73 |
| 74 function SetDelete(key) { | 74 function SetDelete(key) { |
| 75 if (!IS_SET(this)) { | 75 if (!IS_SET(this)) { |
| 76 throw MakeTypeError('incompatible_method_receiver', | 76 throw MakeTypeError('incompatible_method_receiver', |
| 77 ['Set.prototype.delete', this]); | 77 ['Set.prototype.delete', this]); |
| 78 } | 78 } |
| 79 if (IS_UNDEFINED(key)) { | 79 if (IS_UNDEFINED(key)) { |
| 80 key = undefined_sentinel; | 80 key = undefined_sentinel; |
| 81 } | 81 } |
| 82 return %SetDelete(this, key); | 82 if (%SetHas(this, key)) { |
| 83 %SetDelete(this, key); |
| 84 return true; |
| 85 } else { |
| 86 return false; |
| 87 } |
| 83 } | 88 } |
| 84 | 89 |
| 85 | 90 |
| 86 function MapConstructor() { | 91 function MapConstructor() { |
| 87 if (%_IsConstructCall()) { | 92 if (%_IsConstructCall()) { |
| 88 %MapInitialize(this); | 93 %MapInitialize(this); |
| 89 } else { | 94 } else { |
| 90 return new $Map(); | 95 return new $Map(); |
| 91 } | 96 } |
| 92 } | 97 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 %SetProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM); | 246 %SetProperty($WeakMap.prototype, "constructor", $WeakMap, DONT_ENUM); |
| 242 | 247 |
| 243 // Set up the non-enumerable functions on the WeakMap prototype object. | 248 // Set up the non-enumerable functions on the WeakMap prototype object. |
| 244 InstallFunctions($WeakMap.prototype, DONT_ENUM, $Array( | 249 InstallFunctions($WeakMap.prototype, DONT_ENUM, $Array( |
| 245 "get", WeakMapGet, | 250 "get", WeakMapGet, |
| 246 "set", WeakMapSet, | 251 "set", WeakMapSet, |
| 247 "has", WeakMapHas, | 252 "has", WeakMapHas, |
| 248 "delete", WeakMapDelete | 253 "delete", WeakMapDelete |
| 249 )); | 254 )); |
| 250 })(); | 255 })(); |
| OLD | NEW |