240f25a940
Makes it much easier to compare the output when making VM changes.
--disassemble:
;; Invocation Count Check
0x7f82b8900320 498b7c2437 movq rdi,[r12+0x37]
0x7f82b8900325 ff8783000000 incl [rdi+0x83]
0x7f82b890032b 81bf8300000030750000 cmpl [rdi+0x83],0x7530
0x7f82b8900335 7c07 jl 0x00007f82b890033e
0x7f82b8900337 41ffa6b8010000 jmp [thr+0x1b8]
--disassemble --disassemble-relative:
;; Invocation Count Check
0x0 498b7c2437 movq rdi,[r12+0x37]
0x5 ff8783000000 incl [rdi+0x83]
0xb 81bf8300000030750000 cmpl [rdi+0x83],0x7530
0x15 7c07 jl +9
0x17 41ffa6b8010000 jmp [thr+0x1b8]
Change-Id: Ie05c532f830027b928d7d1d57509eb237157a127
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106600
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
52 lines
1.4 KiB
Dart
52 lines
1.4 KiB
Dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// Verify running with --print-flow-graph produces deterministic output. This is
|
|
// useful for removing noise when tracking down the effects of compiler changes.
|
|
|
|
import 'dart:async';
|
|
import 'dart:io';
|
|
import 'snapshot_test_helper.dart';
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
int fib(int n) {
|
|
if (n <= 1) return 1;
|
|
return fib(n - 1) + fib(n - 2);
|
|
}
|
|
|
|
Future<void> main(List<String> args) async {
|
|
if (args.contains('--child')) {
|
|
print(fib(35));
|
|
return;
|
|
}
|
|
|
|
if (!Platform.script.toString().endsWith(".dart")) {
|
|
return; // Not running from source: skip for app-jit and app-aot.
|
|
}
|
|
if (Platform.executable.contains("Product")) {
|
|
return; // No flow graph printer in product mode.
|
|
}
|
|
|
|
final result1 = await runDart('GENERATE CFG 1', [
|
|
'--deterministic',
|
|
'--print-flow-graph',
|
|
Platform.script.toFilePath(),
|
|
'--child'
|
|
]);
|
|
final cfg1 = result1.processResult.stderr;
|
|
|
|
final result2 = await runDart('GENERATE CFG 2', [
|
|
'--deterministic',
|
|
'--print-flow-graph',
|
|
Platform.script.toFilePath(),
|
|
'--child'
|
|
]);
|
|
final cfg2 = result2.processResult.stderr;
|
|
|
|
Expect.isTrue(
|
|
cfg1.contains("*** BEGIN CFG"), "Printed at least one function");
|
|
Expect.stringEquals(cfg1, cfg2);
|
|
}
|