#include <algorithm>
#include <cstring>
#include <fstream>
#include <memory>
#include <sstream>
#include <vector>
#include "include/libplatform/libplatform.h"
#include "include/v8-array-buffer.h"
#include "include/v8-context.h"
#include "include/v8-initialization.h"
#include "include/v8-local-handle.h"
#include "include/v8-message.h"
#include "src/base/logging.h"
#include "src/interpreter/interpreter.h"
#include "test/unittests/interpreter/bytecode-expectations-printer.h"
#ifdef V8_OS_POSIX
#include <dirent.h>
#elif V8_OS_WIN
#include <windows.h>
#endif
BytecodeExpectationsPrinter;
#define REPORT_ERROR(MESSAGE) …
namespace {
const char* kGoldenFilesPath = …;
class ProgramOptions final { … };
class V8_NODISCARD V8InitializationScope final { … };
bool ParseBoolean(const char* string) { … }
const char* BooleanToString(bool value) { … }
bool CollectGoldenFiles(std::vector<std::string>* golden_file_list,
const char* directory_path) { … }
ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) { … }
bool ProgramOptions::Validate() const { … }
void ProgramOptions::UpdateFromHeader(std::istream* stream) { … }
void ProgramOptions::PrintHeader(std::ostream* stream) const { … }
V8InitializationScope::V8InitializationScope(const char* exec_path)
: … { … }
V8InitializationScope::~V8InitializationScope() { … }
std::string ReadRawJSSnippet(std::istream* stream) { … }
bool ReadNextSnippet(std::istream* stream, std::string* string_out) { … }
std::string UnescapeString(const std::string& escaped_string) { … }
void ExtractSnippets(std::vector<std::string>* snippet_list,
std::istream* body_stream, bool read_raw_js_snippet) { … }
void GenerateExpectationsFile(std::ostream* stream,
const std::vector<std::string>& snippet_list,
const V8InitializationScope& platform,
const ProgramOptions& options) { … }
bool WriteExpectationsFile(const std::vector<std::string>& snippet_list,
const V8InitializationScope& platform,
const ProgramOptions& options,
const std::string& output_filename) { … }
std::string WriteExpectationsToString(
const std::vector<std::string>& snippet_list,
const V8InitializationScope& platform, const ProgramOptions& options) { … }
void PrintMessage(v8::Local<v8::Message> message, v8::Local<v8::Value>) { … }
void DiscardMessage(v8::Local<v8::Message>, v8::Local<v8::Value>) { … }
void PrintUsage(const char* exec_path) { … }
}
bool CheckBaselineExpectations(const std::string& input_filename,
const std::vector<std::string>& snippet_list,
const V8InitializationScope& platform,
const ProgramOptions& options) { … }
int main(int argc, char** argv) { … }