Chromium Code Reviews| 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 // This is intended for permanent JS behavior changes for mocking out | 5 // This is intended for permanent JS behavior changes for mocking out |
| 6 // non-deterministic behavior. For temporary suppressions, please refer to | 6 // non-deterministic behavior. For temporary suppressions, please refer to |
| 7 // v8_suppressions.js. | 7 // v8_suppressions.js. |
| 8 // This file is loaded before each correctness test cases and won't get | 8 // This file is loaded before each correctness test cases and won't get |
| 9 // minimized. | 9 // minimized. |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 }, | 48 }, |
| 49 } | 49 } |
| 50 | 50 |
| 51 Date = new Proxy(Date, handler); | 51 Date = new Proxy(Date, handler); |
| 52 })(); | 52 })(); |
| 53 | 53 |
| 54 // Mock stack traces. | 54 // Mock stack traces. |
| 55 Error.prepareStackTrace = function (error, structuredStackTrace) { | 55 Error.prepareStackTrace = function (error, structuredStackTrace) { |
| 56 return ""; | 56 return ""; |
| 57 }; | 57 }; |
| 58 Object.freeze(Error) | |
|
Yang
2017/01/27 08:35:48
I think using Object.defineProperty to make prepar
| |
| 58 | 59 |
| 59 // Mock buffer access in float typed arrays because of varying NaN patterns. | 60 // Mock buffer access in float typed arrays because of varying NaN patterns. |
| 60 // Note, for now we just use noop forwarding proxies, because they already | 61 // Note, for now we just use noop forwarding proxies, because they already |
| 61 // turn off optimizations. | 62 // turn off optimizations. |
| 62 function __MockTypedArray(arrayType) { | 63 function __MockTypedArray(arrayType) { |
| 63 var array_creation_handler = { | 64 var array_creation_handler = { |
| 64 construct: function(target, args) { | 65 construct: function(target, args) { |
| 65 return new Proxy(new arrayType(args), {}); | 66 return new Proxy(new arrayType(args), {}); |
| 66 }, | 67 }, |
| 67 }; | 68 }; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 87 } | 88 } |
| 88 this.getMessage = function(){ | 89 this.getMessage = function(){ |
| 89 index = (index + 1) % 10; | 90 index = (index + 1) % 10; |
| 90 return workerMessages[index]; | 91 return workerMessages[index]; |
| 91 } | 92 } |
| 92 this.postMessage = function(msg){ | 93 this.postMessage = function(msg){ |
| 93 __PrettyPrint(msg); | 94 __PrettyPrint(msg); |
| 94 } | 95 } |
| 95 }; | 96 }; |
| 96 })(); | 97 })(); |
| OLD | NEW |