| OLD | NEW |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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 load('../base.js'); | 5 load('../base.js'); |
| 6 | 6 |
| 7 load('debugger.js'); | 7 load('debugger.js'); |
| 8 load('runtime.js'); |
| 8 | 9 |
| 9 var success = true; | 10 let success = true; |
| 11 let lastId = 0; |
| 12 let prevMessage = null; |
| 10 | 13 |
| 11 function PrintResult(name, result) { | 14 function PrintResult(name, result) { |
| 12 print(name + '-Inspector(Score): ' + result); | 15 print(name + '-Inspector(Score): ' + result); |
| 13 } | 16 } |
| 14 | 17 |
| 15 function PrintStep(name) {} | 18 function PrintStep(name) {} |
| 16 | 19 |
| 17 function PrintError(name, error) { | 20 function PrintError(name, error) { |
| 18 PrintResult(name, error); | 21 PrintResult(name, error); |
| 19 success = false; | 22 success = false; |
| 20 } | 23 } |
| 21 | 24 |
| 22 | 25 |
| 23 BenchmarkSuite.config.doWarmup = undefined; | 26 BenchmarkSuite.config.doWarmup = undefined; |
| 24 BenchmarkSuite.config.doDeterministic = undefined; | 27 BenchmarkSuite.config.doDeterministic = undefined; |
| 25 | 28 |
| 26 BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, | 29 BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, |
| 27 NotifyError: PrintError, | 30 NotifyError: PrintError, |
| 28 NotifyStep: PrintStep }); | 31 NotifyStep: PrintStep }); |
| 32 |
| 33 function receive(message) { |
| 34 prevMessage = JSON.parse(message); |
| 35 } |
| 36 |
| 37 function SendMessage(method, params) { |
| 38 let obj = {id: ++lastId, method: method}; |
| 39 if (params) { |
| 40 obj.params = params; |
| 41 } |
| 42 send(JSON.stringify(obj)); |
| 43 if (prevMessage && prevMessage.id == lastId) { |
| 44 return prevMessage; |
| 45 } |
| 46 return null; |
| 47 } |
| OLD | NEW |