OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 (function (global, binding, v8) { | 5 (function (global, binding, v8) { |
6 'use strict'; | 6 'use strict'; |
7 binding.testExtraShouldReturnFive = function() { | 7 binding.testExtraShouldReturnFive = function() { |
8 return 5; | 8 return 5; |
9 }; | 9 }; |
10 | 10 |
11 binding.testExtraShouldCallToRuntime = function() { | 11 binding.testExtraShouldCallToRuntime = function() { |
12 return binding.runtime(3); | 12 return binding.runtime(3); |
13 }; | 13 }; |
14 | 14 |
| 15 binding.testFunctionToString = function() { |
| 16 function foo() { return 1; } |
| 17 return foo.toString(); |
| 18 }; |
| 19 |
| 20 binding.testStackTrace = function(f) { |
| 21 return f(); |
| 22 } |
| 23 |
15 // Exercise all of the extras utils: | 24 // Exercise all of the extras utils: |
16 // - v8.createPrivateSymbol | 25 // - v8.createPrivateSymbol |
17 // - v8.simpleBind, v8.uncurryThis | 26 // - v8.simpleBind, v8.uncurryThis |
18 // - v8.InternalPackedArray | 27 // - v8.InternalPackedArray |
19 // - v8.createPromise, v8.resolvePromise, v8.rejectPromise | 28 // - v8.createPromise, v8.resolvePromise, v8.rejectPromise |
20 | 29 |
21 const Object = global.Object; | 30 const Object = global.Object; |
22 const hasOwn = v8.uncurryThis(Object.prototype.hasOwnProperty); | 31 const hasOwn = v8.uncurryThis(Object.prototype.hasOwnProperty); |
23 | 32 |
24 const Function = global.Function; | 33 const Function = global.Function; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 }, null, new v8.InternalPackedArray('x', 'x'))); | 66 }, null, new v8.InternalPackedArray('x', 'x'))); |
58 | 67 |
59 return { | 68 return { |
60 privateSymbol: v8.createPrivateSymbol('sym'), | 69 privateSymbol: v8.createPrivateSymbol('sym'), |
61 fulfilledPromise, // should be fulfilled with 1 | 70 fulfilledPromise, // should be fulfilled with 1 |
62 fulfilledPromise2, // should be fulfilled with 2 | 71 fulfilledPromise2, // should be fulfilled with 2 |
63 rejectedPromise // should be rejected with 3 | 72 rejectedPromise // should be rejected with 3 |
64 }; | 73 }; |
65 }; | 74 }; |
66 }) | 75 }) |
OLD | NEW |