Chromium Code Reviews

Side by Side Diff: test/cctest/interpreter/generate-bytecode-expectations.cc

Issue 1742723003: [Interpreter] Silence runtime errors in generate-bytecode-expectations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <cstring> 5 #include <cstring>
6 #include <fstream> 6 #include <fstream>
7 #include <vector> 7 #include <vector>
8 8
9 #include "test/cctest/interpreter/bytecode-expectations-printer.h" 9 #include "test/cctest/interpreter/bytecode-expectations-printer.h"
10 10
(...skipping 466 matching lines...)
477 } 477 }
478 } 478 }
479 std::ostream& output_stream = 479 std::ostream& output_stream =
480 options.write_to_stdout() ? std::cout : output_file_handle; 480 options.write_to_stdout() ? std::cout : output_file_handle;
481 481
482 GenerateExpectationsFile(output_stream, snippet_list, platform, options); 482 GenerateExpectationsFile(output_stream, snippet_list, platform, options);
483 483
484 return true; 484 return true;
485 } 485 }
486 486
487 void PrintMessage(v8::Local<v8::Message> message, v8::Local<v8::Value>) {
488 std::cerr << "INFO: " << *v8::String::Utf8Value(message->Get()) << '\n';
489 }
490
491 void DiscardMessage(v8::Local<v8::Message>, v8::Local<v8::Value>) {}
492
487 void PrintUsage(const char* exec_path) { 493 void PrintUsage(const char* exec_path) {
488 std::cerr 494 std::cerr
489 << "\nUsage: " << exec_path 495 << "\nUsage: " << exec_path
490 << " [OPTIONS]... [INPUT FILES]...\n\n" 496 << " [OPTIONS]... [INPUT FILES]...\n\n"
491 "Options:\n" 497 "Options:\n"
492 " --help Print this help message.\n" 498 " --help Print this help message.\n"
493 " --verbose Emit messages about the progress of the tool.\n" 499 " --verbose Emit messages about the progress of the tool.\n"
494 " --raw-js Read raw JavaScript, instead of the output format.\n" 500 " --raw-js Read raw JavaScript, instead of the output format.\n"
495 " --stdin Read from standard input instead of file.\n" 501 " --stdin Read from standard input instead of file.\n"
496 " --rebaseline Rebaseline input snippet file.\n" 502 " --rebaseline Rebaseline input snippet file.\n"
(...skipping 24 matching lines...)
521 527
522 int main(int argc, char** argv) { 528 int main(int argc, char** argv) {
523 ProgramOptions options = ProgramOptions::FromCommandLine(argc, argv); 529 ProgramOptions options = ProgramOptions::FromCommandLine(argc, argv);
524 530
525 if (!options.Validate() || options.print_help()) { 531 if (!options.Validate() || options.print_help()) {
526 PrintUsage(argv[0]); 532 PrintUsage(argv[0]);
527 return options.print_help() ? 0 : 1; 533 return options.print_help() ? 0 : 1;
528 } 534 }
529 535
530 V8InitializationScope platform(argv[0]); 536 V8InitializationScope platform(argv[0]);
537 platform.isolate()->AddMessageListener(
538 options.rebaseline() && !options.verbose() ? PrintMessage
rmcilroy 2016/02/26 16:57:58 Could you pull the "options.rebaseline() && !optio
Stefano Sanfilippo 2016/02/26 17:01:06 Done.
539 : DiscardMessage);
531 540
532 std::vector<std::string> snippet_list; 541 std::vector<std::string> snippet_list;
533 542
534 if (options.read_from_stdin()) { 543 if (options.read_from_stdin()) {
535 // Rebaseline will never get here, so we will always take the 544 // Rebaseline will never get here, so we will always take the
536 // GenerateExpectationsFile at the end of this function. 545 // GenerateExpectationsFile at the end of this function.
537 DCHECK(!options.rebaseline()); 546 DCHECK(!options.rebaseline());
538 ExtractSnippets(&snippet_list, std::cin, options.read_raw_js_snippet()); 547 ExtractSnippets(&snippet_list, std::cin, options.read_raw_js_snippet());
539 } else { 548 } else {
540 for (const std::string& input_filename : options.input_filenames()) { 549 for (const std::string& input_filename : options.input_filenames()) {
(...skipping 26 matching lines...)
567 } 576 }
568 } 577 }
569 578
570 if (!options.rebaseline()) { 579 if (!options.rebaseline()) {
571 if (!WriteExpectationsFile(snippet_list, platform, options, 580 if (!WriteExpectationsFile(snippet_list, platform, options,
572 options.output_filename())) { 581 options.output_filename())) {
573 return 3; 582 return 3;
574 } 583 }
575 } 584 }
576 } 585 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine