Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Unified Diff: test/mjsunit/regress/regress-refreeze-same-map.js

Issue 2915863004: [runtime] PreventExtensionsWithTransition: before adding the new (Closed)
Patch Set: [runtime] fix memory leak in PreventExtensionsWithTransition Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/harmony/private.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-refreeze-same-map.js
diff --git a/test/mjsunit/regress/regress-refreeze-same-map.js b/test/mjsunit/regress/regress-refreeze-same-map.js
new file mode 100644
index 0000000000000000000000000000000000000000..19cdb502a126901f4c8082d8114edd9510ae0926
--- /dev/null
+++ b/test/mjsunit/regress/regress-refreeze-same-map.js
@@ -0,0 +1,40 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+// precondition
+assertTrue(%HaveSameMap(Object.freeze({}), Object.freeze({})));
+assertTrue(%HaveSameMap(Object.freeze({a: 1}), Object.freeze({a: 1})));
+assertTrue(%HaveSameMap(Object.freeze([]), Object.freeze([])));
+assertTrue(%HaveSameMap(Object.freeze([1,2]), Object.freeze([1,2])));
+
+assertTrue(%HaveSameMap(Object.seal({}), Object.seal({})));
+assertTrue(%HaveSameMap(Object.seal({a: 1}), Object.seal({a: 1})));
+assertTrue(%HaveSameMap(Object.seal([]), Object.seal([])));
+assertTrue(%HaveSameMap(Object.seal([1,2]), Object.seal([1,2])));
+
+// refreezing an already frozen obj does not keep adding transitions
+assertTrue(%HaveSameMap(Object.freeze({}), Object.freeze( Object.freeze({}) )));
+assertTrue(%HaveSameMap(Object.freeze({a: 1}), Object.freeze( Object.freeze({a: 1}) )));
+assertTrue(%HaveSameMap(Object.freeze([]), Object.freeze( Object.freeze([]) )));
+assertTrue(%HaveSameMap(Object.freeze([1,2]), Object.freeze( Object.freeze([1,2]) )));
+
+// resealing a sealed object is idempotent
+assertTrue(%HaveSameMap(Object.seal({}), Object.seal( Object.seal({}) )));
+assertTrue(%HaveSameMap(Object.seal({a: 1}), Object.seal( Object.seal({a: 1}) )));
+assertTrue(%HaveSameMap(Object.seal([]), Object.seal( Object.seal([]) )));
+assertTrue(%HaveSameMap(Object.seal([1,2]), Object.seal( Object.seal([1,2]) )));
+
+// sealing a frozen object is idempotent
+assertTrue(%HaveSameMap(Object.freeze({}), Object.seal( Object.freeze({}) )));
+assertTrue(%HaveSameMap(Object.freeze({a: 1}), Object.seal( Object.freeze({a: 1}) )));
+assertTrue(%HaveSameMap(Object.freeze([]), Object.seal( Object.freeze([]) )));
+assertTrue(%HaveSameMap(Object.freeze([1,2]), Object.seal( Object.freeze([1,2]) )));
+
+// freezing a sealed empty is idempotent
+assertTrue(%HaveSameMap(Object.freeze(Object.seal({})), Object.seal({})));
+
+// sealing a unextensible empty object is idempotent
+assertTrue(%HaveSameMap(Object.seal(Object.preventExtensions({})), Object.preventExtensions({})));
« no previous file with comments | « test/mjsunit/harmony/private.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698