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

Unified Diff: test/mjsunit/stack-traces-overflow.js

Issue 11275186: Collect stack trace on stack overflow. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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
« src/isolate.cc ('K') | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/stack-traces-overflow.js
diff --git a/test/mjsunit/regress/regress-117794.js b/test/mjsunit/stack-traces-overflow.js
similarity index 60%
copy from test/mjsunit/regress/regress-117794.js
copy to test/mjsunit/stack-traces-overflow.js
index 5e11b40035f0d37dcffd4d9eb09debcd785f307d..e56cb119281bc2e3afb2786fd5745923da03bb05 100644
--- a/test/mjsunit/regress/regress-117794.js
+++ b/test/mjsunit/stack-traces-overflow.js
@@ -25,33 +25,63 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Loads specialized to be from the global object should not omit the
-// smi check on the receiver. The code below should not crash.
+function rec1(a) { rec1(a+1); }
+function rec2(a) { rec3(a+1); }
+function rec3(a) { rec2(a+1); }
-print = function() {}
-
-function constructor() {};
+// Test stack trace getter and setter.
+try {
+ rec1(0);
+} catch (e) {
+ assertTrue(e.stack.indexOf("rec1") > 0);
+ e.stack = "123";
+ assertEquals("123", e.stack);
+}
-function assertHasOwnProperties(object, limit) {
- for (var i = 0; i < limit; i++) { }
+// Test setter w/o calling the getter.
+try {
+ rec2(0);
+} catch (e) {
+ assertTrue(e.stack.indexOf("rec2") > 0);
+ assertTrue(e.stack.indexOf("rec3") > 0);
+ e.stack = "123";
+ assertEquals("123", e.stack);
}
+// Test getter to make sure setter does not affect the boilerplate.
try {
- Object.keys();
-} catch(exc2) {
- print(exc2.stack);
+ rec1(0);
+} catch (e) {
+ assertTrue(e.stack.indexOf("rec1") > 0);
+ assertInstanceof(e, RangeError);
+}
+
+
+// Check setting/getting stack property on the prototype chain.
+function testErrorPrototype(prototype) {
+ var object = {};
+ object.__proto__ = prototype;
+ object.stack = "123";
+ assertEquals("123", prototype.stack);
+ assertEquals("123", object.stack);
}
-var x1 = new Object();
+try {
+ rec1(0);
+} catch (e) {
+ e.stack;
+ testErrorPrototype(e);
+}
try {
- new Function("A Man Called Horse", x1.d);
-} catch(exc3) {
- print(exc3.stack);
+ rec1(0);
+} catch (e) {
+ testErrorPrototype(e);
}
try {
- (-(true)).toPrecision(0x30, 'lib1-f1');
-} catch(exc1) {
- print(exc1.stack);
+ throw new Error();
+} catch (e) {
+ testErrorPrototype(e);
}
+
« src/isolate.cc ('K') | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698