Index: test/mjsunit/regress/regress-392114.js |
diff --git a/test/mjsunit/regress/regress-frame-details-null-receiver.js b/test/mjsunit/regress/regress-392114.js |
similarity index 63% |
copy from test/mjsunit/regress/regress-frame-details-null-receiver.js |
copy to test/mjsunit/regress/regress-392114.js |
index ffe5fbb84ce80c0289a5a76c0a7bc1c798383c49..69fd04ba177ede7d46054e29d8fc4bb0e8e8b7e7 100644 |
--- a/test/mjsunit/regress/regress-frame-details-null-receiver.js |
+++ b/test/mjsunit/regress/regress-392114.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2013 the V8 project authors. All rights reserved. |
+// Copyright 2014 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -28,24 +28,42 @@ |
// Flags: --expose-debug-as debug --allow-natives-syntax |
Debug = debug.Debug; |
-var listened = false; |
-function listener(event, exec_state, event_data, data) { |
- if (event == Debug.DebugEvent.Exception) { |
- for (var i = 0; i < exec_state.frameCount(); i++) { |
- print(exec_state.frame(i).receiver()); |
- print(exec_state.frame(i).func().name()); |
+function dummy(x) { |
+ return x + 100; |
+} |
+ |
+function create_closure() { |
+ return function(arg) { |
+ if (arg === true) { |
Toon Verwaest
2014/07/29 11:28:18
if (arg) { %DeoptimizeFunction(function); }
|
+ // Do something that causes a deopt. We'd like to run the newly compiled |
+ // full code for the Array statement below. Soft deopt: |
+ dummy(); |
+ } |
+ var a = Array(10); |
+ for (var i = 0; i < a.length; i++) { |
+ a[i] = i; |
} |
} |
- listened = true; |
} |
-Debug.setListener(listener); |
-Debug.setBreakOnException(); |
+var c = create_closure(); |
+c(); |
+ |
+// c CallIC state now has custom Array handler installed. |
+ |
+// Turn on the debugger. |
+Debug.setListener(function () {}); |
-assertThrows(function() { delete null['foo']; }); |
+var d = create_closure(); |
+%OptimizeFunctionOnNextCall(d); |
+// Thanks to the debugger, we recreate the full code too. We deopt and run |
+// it, stomping on the unexpected AllocationSite in the type vector slot. |
+d(true); |
-Debug.clearBreakOnException(); |
-Debug.setListener(null); |
+// CallIC in c misinterprets type vector slot contents as an AllocationSite, |
+// corrupting the heap. |
+c(); |
-assertTrue(listened); |
+// CallIC MISS - crash due to corruption. |
+dummy(); |