Index: test/mjsunit/compiler/escape-analysis-deopt-4.js |
diff --git a/test/mjsunit/regress/regress-299979.js b/test/mjsunit/compiler/escape-analysis-deopt-4.js |
similarity index 72% |
copy from test/mjsunit/regress/regress-299979.js |
copy to test/mjsunit/compiler/escape-analysis-deopt-4.js |
index 0afbcb35717f4c60f62d8cd8442ab164ec93246b..c80765706c589794b0ca7270a36baf847af548c8 100644 |
--- a/test/mjsunit/regress/regress-299979.js |
+++ b/test/mjsunit/compiler/escape-analysis-deopt-4.js |
@@ -25,10 +25,33 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+// Flags: --allow-natives-syntax --turbo-escape |
-(function(){ |
+// Test deoptimization with captured objects in local variables. |
+(function testDeoptLocal() { |
"use strict"; |
- var list = Object.freeze([1, 2, 3]); |
- assertThrows(function() { list.unshift(4); }, TypeError); |
- assertThrows(function() { list.shift(); }, TypeError); |
+ function constructor1() { |
+ this.x=1; |
+ this.y=2; |
+ this.z=3; |
+ } |
+ function constructor2(x) { |
+ this.a=x; |
+ this.b=4; |
+ } |
+ function func() { |
+ var o1 = new constructor1(); |
+ var o2 = new constructor2(o1); |
+ o1.x = o1; |
+ %DeoptimizeNow(); |
+ assertEquals(o1, o1.x); |
+ assertEquals(2, o1.y); |
+ assertEquals(3, o1.z); |
+ assertEquals(o1, o2.a); |
+ assertEquals(4, o2.b); |
+ } |
+ func(); |
+ func(); |
+ %OptimizeFunctionOnNextCall(func); |
+ func(); |
})(); |