Index: test/mjsunit/regress/regress-2829.js |
diff --git a/test/mjsunit/regress/regress-2717.js b/test/mjsunit/regress/regress-2829.js |
similarity index 75% |
copy from test/mjsunit/regress/regress-2717.js |
copy to test/mjsunit/regress/regress-2829.js |
index 4f8f7915b1c43e48235e7bd6bcb79f89957223cf..a046ae0395af59fb8f85bf762d1b43ef3e355405 100644 |
--- a/test/mjsunit/regress/regress-2717.js |
+++ b/test/mjsunit/regress/regress-2829.js |
@@ -25,27 +25,29 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Test re-initializing existing field which is already being tracked as |
-// having double representation. |
-(function() { |
- function test1(a) { |
- return { x: 1.5, x: a }; |
- }; |
+// Flags: --harmony-collections |
- assertEquals({}, test1({}).x); |
-})(); |
+(function test1() { |
+ var wm1 = new WeakMap(); |
+ wm1.set(Object.prototype, 23); |
+ assertTrue(wm1.has(Object.prototype)); |
+ Object.freeze(Object.prototype); |
-// Test initializing new field which follows an existing transition to a |
-// map that tracks it as having double representation. |
-(function() { |
- function test1(a) { |
- return { y: a }; |
- }; |
+ var wm2 = new WeakMap(); |
+ var o = {}; |
+ wm2.set(o, 42); |
+ assertEquals(42, wm2.get(o)); |
+})(); |
- function test2(a) { |
- return { y: a }; |
- }; |
+(function test2() { |
+ var wm1 = new WeakMap(); |
+ var o1 = {}; |
+ wm1.set(o1, 23); |
+ assertTrue(wm1.has(o1)); |
+ Object.freeze(o1); |
- assertEquals(1.5, test1(1.5).y); |
- assertEquals({}, test2({}).y); |
+ var wm2 = new WeakMap(); |
+ var o2 = Object.create(o1); |
+ wm2.set(o2, 42); |
+ assertEquals(42, wm2.get(o2)); |
})(); |