| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 assertEquals(3, wf3); | 278 assertEquals(3, wf3); |
| 279 assertEquals(6, wfx.a); | 279 assertEquals(6, wfx.a); |
| 280 assertEquals(7, wgx.aa); | 280 assertEquals(7, wgx.aa); |
| 281 assertEquals(4, wh4.q); | 281 assertEquals(4, wh4.q); |
| 282 | 282 |
| 283 | 283 |
| 284 // An identity-preserving membrane. Adapted from: | 284 // An identity-preserving membrane. Adapted from: |
| 285 // http://wiki.ecmascript.org/doku.php?id=harmony:proxies#an_identity-preserving
_membrane | 285 // http://wiki.ecmascript.org/doku.php?id=harmony:proxies#an_identity-preserving
_membrane |
| 286 | 286 |
| 287 function createMembrane(wetTarget) { | 287 function createMembrane(wetTarget) { |
| 288 var wet2dry = WeakMap(); | 288 var wet2dry = new WeakMap(); |
| 289 var dry2wet = WeakMap(); | 289 var dry2wet = new WeakMap(); |
| 290 | 290 |
| 291 function asDry(obj) { | 291 function asDry(obj) { |
| 292 registerObject(obj) | 292 registerObject(obj) |
| 293 print("asDry enter", str(obj)) | 293 print("asDry enter", str(obj)) |
| 294 try { | 294 try { |
| 295 var x = asDry2(obj); | 295 var x = asDry2(obj); |
| 296 registerObject(x, "dry"); | 296 registerObject(x, "dry"); |
| 297 print("asDry exit", str(obj), "as", str(x)); | 297 print("asDry exit", str(obj), "as", str(x)); |
| 298 return x; | 298 return x; |
| 299 } catch(e) { | 299 } catch(e) { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 assertThrows(function() { w[1] }, Error) | 503 assertThrows(function() { w[1] }, Error) |
| 504 assertThrows(function() { w.c }, Error) | 504 assertThrows(function() { w.c }, Error) |
| 505 assertThrows(function() { wb.bb }, Error) | 505 assertThrows(function() { wb.bb }, Error) |
| 506 assertEquals(3, wr.a) | 506 assertEquals(3, wr.a) |
| 507 assertThrows(function() { wf(4) }, Error) | 507 assertThrows(function() { wf(4) }, Error) |
| 508 assertEquals(6, wfx.a) | 508 assertEquals(6, wfx.a) |
| 509 assertEquals(7, wgx.aa) | 509 assertEquals(7, wgx.aa) |
| 510 assertThrows(function() { wh4.q }, Error) | 510 assertThrows(function() { wh4.q }, Error) |
| 511 assertThrows(function() { ws5.x }, Error) | 511 assertThrows(function() { ws5.x }, Error) |
| 512 assertThrows(function() { ws5x.y }, Error) | 512 assertThrows(function() { ws5x.y }, Error) |
| OLD | NEW |