blob: bb86ef32fc385e9bcd13de6052cd4d60e4bda158 [file] [log] [blame]
Ben Murdochc5610432016-08-08 18:44:38 +01001// Copyright 2016 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Flags: --nostress-opt
6
7Error.prepareStackTrace = function(exception, frames) {
8 return frames[0].getEvalOrigin();
9}
10
11var source = "new Error()";
12var eval_origin;
13var geval = eval;
14var log = [];
15
16(function() {
17 log.push([geval(source).stack, "17:13"]);
18 log.push([geval(source).stack, "18:13"]);
19 // log.push([geval(source).stack, "19:13"]); TODO(4921).
20})();
21
22(function() {
23 log.push([eval(source).stack, "23:13"]);
24 log.push([eval(source).stack, "24:13"]);
25 // log.push([eval(source).stack, "25:13"]); TODO(4921).
26})();
27
28log.push([eval(source).stack, "28:11"]);
29log.push([eval(source).stack, "29:11"]);
30// log.push([eval(source).stack, "30:11"]); TODO(4921).
31
32Error.prepareStackTrace = undefined;
33
34for (var item of log) {
35 var stacktraceline = item[0];
36 var expectation = item[1];
37 var re = new RegExp(`:${expectation}\\)$`);
38 assertTrue(re.test(stacktraceline));
39}