OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var thrower = { [Symbol.toPrimitive]: () => FAIL }; | 5 var thrower = { [Symbol.toPrimitive]: () => FAIL }; |
6 | 6 |
7 // Tests that a native conversion function is included in the | 7 // Tests that a native conversion function is included in the |
8 // stack trace. | 8 // stack trace. |
9 function testTraceNativeConversion(nativeFunc) { | 9 function testTraceNativeConversion(nativeFunc) { |
10 var nativeFuncName = nativeFunc.name; | 10 var nativeFuncName = nativeFunc.name; |
(...skipping 29 matching lines...) Expand all Loading... |
40 // This occurs, e.g., for Date.prototype.getYear, which uses a different code | 40 // This occurs, e.g., for Date.prototype.getYear, which uses a different code |
41 // path and never hits the Generate_DatePrototype_GetField builtin. | 41 // path and never hits the Generate_DatePrototype_GetField builtin. |
42 testBuiltinInStackTrace("Date.prototype.getDate.call('')", "at String.getDate"); | 42 testBuiltinInStackTrace("Date.prototype.getDate.call('')", "at String.getDate"); |
43 testBuiltinInStackTrace("Date.prototype.getUTCDate.call('')", | 43 testBuiltinInStackTrace("Date.prototype.getUTCDate.call('')", |
44 "at String.getUTCDate"); | 44 "at String.getUTCDate"); |
45 testBuiltinInStackTrace("Date.prototype.getTime.call('')", "at String.getTime"); | 45 testBuiltinInStackTrace("Date.prototype.getTime.call('')", "at String.getTime"); |
46 | 46 |
47 // C++ builtins. | 47 // C++ builtins. |
48 testBuiltinInStackTrace("Boolean.prototype.toString.call(thrower);", | 48 testBuiltinInStackTrace("Boolean.prototype.toString.call(thrower);", |
49 "at Object.toString"); | 49 "at Object.toString"); |
| 50 |
| 51 // Constructor builtins. |
50 testBuiltinInStackTrace("new Date(thrower);", "at new Date"); | 52 testBuiltinInStackTrace("new Date(thrower);", "at new Date"); |
| 53 |
| 54 // Ensure we correctly pick up the receiver's string tag. |
| 55 testBuiltinInStackTrace("Math.max(thrower);", "at Math.max"); |
| 56 testBuiltinInStackTrace("Math.min(thrower);", "at Math.min"); |
| 57 testBuiltinInStackTrace("Math.acos(thrower);", "at Math.acos"); |
| 58 testBuiltinInStackTrace("Math.asin(thrower);", "at Math.asin"); |
| 59 testBuiltinInStackTrace("Math.fround(thrower);", "at Math.fround"); |
| 60 testBuiltinInStackTrace("Math.imul(thrower);", "at Math.imul"); |
| 61 |
| 62 // As above, but function passed as an argument and then called. |
| 63 testBuiltinInStackTrace("((f, x) => f(x))(Math.max, thrower);", "at max"); |
| 64 testBuiltinInStackTrace("((f, x) => f(x))(Math.min, thrower);", "at min"); |
| 65 testBuiltinInStackTrace("((f, x) => f(x))(Math.acos, thrower);", "at acos"); |
| 66 testBuiltinInStackTrace("((f, x) => f(x))(Math.asin, thrower);", "at asin"); |
| 67 testBuiltinInStackTrace("((f, x) => f(x))(Math.fround, thrower);", "at fround"); |
| 68 testBuiltinInStackTrace("((f, x) => f(x))(Math.imul, thrower);", "at imul"); |
OLD | NEW |