diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index bfb019fbc74c34..1625cd66defbe3 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -55,40 +55,11 @@ steps: - "queue=runtime" artifact_paths: - "build_id/macOS/arm64/**" - - label: "Build chromium - Windows" - key: "build-chromium-windows" - timeout_in_minutes: 60 - plugins: - - https://github.com/jazzdan/skip-checkout-buildkite-plugin.git#jazzdan/windows-support: ~ - command: "cd C:\\Users\\Administrator\\chromium\\src && node replay_build_scripts/update-all-repos.mjs && node buildWindows.mjs && node replay_build_scripts/upload_build_artifacts.mjs" - env: - GOMA_SERVER_HOST: simpsonite.goma.engflow.com - GOMACTL_USE_PROXY: false - RECORD_REPLAY_BACKEND_DIR: "C:\\Users\\Administrator\\backend" - agents: - - "runtimeType=chromiumbuild" - - "os=windows" - - "queue=runtime" - artifact_paths: - - "build_id/windows/x86_64/**" - trigger: "testing-runtime-e2e" label: ":hammer: Trigger Runtime Tests" depends_on: - - "build-chromium-linux-x86_64" - - "build-chromium-mac-x86_64" - "build-chromium-mac-arm64" - - "build-chromium-windows" - - label: "Metabase Test Suite" - depends_on: "build-chromium-linux-x86_64" - if: build.branch == "master" - agents: - - "runtimeType=chromiumbuild" - - "os=linux" - - "queue=runtime" - plugins: - - thedyrt/skip-checkout#v0.1.1: ~ - - seek-oss/aws-sm#v2.3.1: - region: us-east-2 - env: - GITHUB_AUTH_SECRET: "prod/metabase-github-secret" - command: "/home/ubuntu/chromium/src/replay_build_scripts/metabase.sh" + build: + branch: "toshok/mac-arm-investigation" + env: + CHROMIUM_BUILD_ID: "${BUILDKITE_BUILD_ID}" diff --git a/DEPS b/DEPS index 653e3631f8239e..3f456337c3ba66 100644 --- a/DEPS +++ b/DEPS @@ -311,7 +311,7 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'd69328f1dd769695d727e01011c57509b77da842', + 'v8_revision': '774dd48d5de6e340baeb838f549fa435447abf65', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. diff --git a/base/files/memory_mapped_file.cc b/base/files/memory_mapped_file.cc index 132c3a98240f20..00b1f85e8c56e9 100644 --- a/base/files/memory_mapped_file.cc +++ b/base/files/memory_mapped_file.cc @@ -127,6 +127,12 @@ bool MemoryMappedFile::IsValid() const { return data_ != nullptr; } +void MemoryMappedFile::RecordReplayFakeFromData(const uint8_t* data, size_t length) { + DCHECK(!IsValid()); + data_ = const_cast(data); + length_ = length; +} + // static void MemoryMappedFile::CalculateVMAlignedBoundaries(int64_t start, size_t size, diff --git a/base/files/memory_mapped_file.h b/base/files/memory_mapped_file.h index ec7dd8db7ed612..c537accb6abbdc 100644 --- a/base/files/memory_mapped_file.h +++ b/base/files/memory_mapped_file.h @@ -112,6 +112,8 @@ class BASE_EXPORT MemoryMappedFile { // Is file_ a valid file handle that points to an open, memory mapped file? bool IsValid() const; + void RecordReplayFakeFromData(const uint8_t* data, size_t length); + private: // Given the arbitrarily aligned memory region [start, size], returns the // boundaries of the region aligned to the granularity specified by the OS, diff --git a/base/record_replay.cc b/base/record_replay.cc index 0e263592249f57..5471fdb708f7bf 100644 --- a/base/record_replay.cc +++ b/base/record_replay.cc @@ -42,7 +42,10 @@ namespace recordreplay { Macro(V8IsMainThread, (), (), bool, false) \ Macro(V8RecordReplayIsInReplayCode, \ (const char* why), (why), bool, false) \ - Macro(V8RecordReplayHadMismatch, (), (), bool, false) + Macro(V8RecordReplayHadMismatch, (), (), bool, false) \ + Macro(V8RecordReplayReadSystemFileContents, \ + (bool aRelativeToApplication, const char* aPath, size_t* aLength), \ + (aRelativeToApplication, aPath, aLength), char*, nullptr) #define ForEachV8APIVoid(Macro) \ Macro(V8RecordReplayAssertVA, \ @@ -121,6 +124,7 @@ namespace recordreplay { Macro(V8RecordReplayFinishRecording, (), ()) \ Macro(V8RecordReplayGetCurrentJSStack, \ (std::string* stackTrace), (stackTrace)) \ + Macro(V8RecordReplayPrintCurrentJSStack, (), ()) \ Macro(V8RecordReplayEnterReplayCode, (), ()) \ Macro(V8RecordReplayExitReplayCode, (), ()) @@ -409,6 +413,10 @@ void GetCurrentJSStack(std::string* stackTrace) { return V8RecordReplayGetCurrentJSStack(stackTrace); } +void PrintCurrentJSStack() { + return V8RecordReplayPrintCurrentJSStack(); +} + void BrowserEvent(const char* name, const base::DictionaryValue& info) { std::string json; base::JSONWriter::Write(info, &json); diff --git a/base/record_replay.h b/base/record_replay.h index ee4b6321f9d342..72f5aab87997fe 100644 --- a/base/record_replay.h +++ b/base/record_replay.h @@ -45,6 +45,8 @@ uintptr_t RecordReplayValue(const char* why, uintptr_t v); void RecordReplayBytes(const char* why, void* buf, size_t size); void RecordReplayString(const char* why, std::string& text); +char* ReadSystemFileContents(bool aRelativeToApplication, const char* aPath, size_t* aLength); + int CreateOrderedLock(const char* name); void OrderedLock(int lock); void OrderedUnlock(int lock); @@ -83,6 +85,7 @@ bool HasDisabledFeatures(); * Get the current JS stack, if there is any. */ void GetCurrentJSStack(std::string* stackTrace); +void PrintCurrentJSStack(); void BrowserEvent(const char* msg, const base::DictionaryValue& info); diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index aacfae69a7150a..f78c22388f6c16 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -451,9 +451,9 @@ void LayerTreeHost::WaitForProtectedSequenceCompletion() const { void LayerTreeHost::WaitForCommitCompletion(bool for_protected_sequence) const { DCHECK(IsMainThread()); - recordreplay::CommandDiagnosticTrace( - "[RUN-2110-2761] LayerTreeHost::WaitForCommitCompletion %d", - !!commit_completion_event_); + // recordreplay::CommandDiagnosticTrace( + // "[RUN-2110-2761] LayerTreeHost::WaitForCommitCompletion %d", + // !!commit_completion_event_); if (commit_completion_event_) { TRACE_EVENT0("cc", "LayerTreeHost::WaitForCommitCompletion"); diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc index 2bb407d75441e8..8d938817f515db 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc @@ -120,18 +120,7 @@ const char* GetSnapshotFileName(const V8SnapshotFileType file_type) { return nullptr; } -extern "C" bool V8RecordReplayIsARM(); - void GetV8FilePath(const char* file_name, base::FilePath* path_out) { - // The snapshot file is arch specific, record/replay its contents when we recorded - // on ARM because we will replay on x64. - if (V8RecordReplayIsARM()) { - size_t len = recordreplay::RecordReplayValue("GetV8FilePath Length", strlen(file_name)); - if (recordreplay::IsReplaying()) { - file_name = new char[len + 1]; - } - recordreplay::RecordReplayBytes("GetV8FilePath Contents", (char*)file_name, len + 1); - } #if BUILDFLAG(IS_ANDROID) // This is the path within the .apk. *path_out = @@ -148,6 +137,20 @@ void GetV8FilePath(const char* file_name, base::FilePath* path_out) { #endif } +#if BUILDFLAG(IS_MAC) && !defined(GENERATE_V8_CONTEXT_SNAPSHOT) +bool RecordReplayFakeMapV8File(const char* aPath, base::MemoryMappedFile** mmapped_file_out) { + std::unique_ptr mmapped_file( + new base::MemoryMappedFile()); + size_t length; + uint8_t* data = reinterpret_cast(recordreplay::ReadSystemFileContents(false, aPath, &length)); + if (data) { + mmapped_file->RecordReplayFakeFromData(data, length); + *mmapped_file_out = mmapped_file.release(); + return true; + } + return false; +} +#else bool MapV8File(base::File file, base::MemoryMappedFile::Region region, base::MemoryMappedFile** mmapped_file_out) { @@ -214,6 +217,7 @@ base::File OpenV8File(const char* file_name, OpenV8FileResult::MAX_VALUE); return file; } +#endif #endif // defined(V8_USE_EXTERNAL_STARTUP_DATA) @@ -402,6 +406,7 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode, #if defined(V8_USE_EXTERNAL_STARTUP_DATA) if (g_mapped_snapshot) { + fprintf(stderr, "V8Initializer::Initialize: g_mapped_snapshot is not null\n"); v8::StartupData snapshot; GetMappedFileData(g_mapped_snapshot, &snapshot); v8::V8::SetSnapshotDataBlob(&snapshot); @@ -514,12 +519,26 @@ void V8Initializer::LoadV8Snapshot(V8SnapshotFileType snapshot_file_type) { return; } +#if BUILDFLAG(IS_MAC) && !defined(GENERATE_V8_CONTEXT_SNAPSHOT) + // for mac let's fake the mmap to force it to get the data on the replay-side. + if (g_mapped_snapshot) { + return; + } + base::FilePath file_path; + GetV8FilePath(GetSnapshotFileName(snapshot_file_type), &file_path); + g_snapshot_file_type = snapshot_file_type; + if (!RecordReplayFakeMapV8File(file_path.value().c_str(), &g_mapped_snapshot)) { + LOG(FATAL) << "Error loading V8 startup snapshot file"; + } +#else base::MemoryMappedFile::Region file_region; base::File file = OpenV8File(GetSnapshotFileName(snapshot_file_type), &file_region); LoadV8SnapshotFromFile(std::move(file), &file_region, snapshot_file_type); +#endif } +#if !BUILDFLAG(IS_MAC) || defined(GENERATE_V8_CONTEXT_SNAPSHOT) // static void V8Initializer::LoadV8SnapshotFromFile( base::File snapshot_file, @@ -528,6 +547,8 @@ void V8Initializer::LoadV8SnapshotFromFile( if (g_mapped_snapshot) return; + fprintf(stderr, "V8Initializer::LoadV8SnapshotFromFile\n"); + if (!snapshot_file.IsValid()) { LOG(FATAL) << "Error loading V8 startup snapshot file"; return; @@ -545,6 +566,7 @@ void V8Initializer::LoadV8SnapshotFromFile( return; } } +#endif #if BUILDFLAG(IS_ANDROID) // static diff --git a/third_party/blink/renderer/core/url/dom_url.cc b/third_party/blink/renderer/core/url/dom_url.cc index 587ccafaebc3ff..6d23467f5dcff7 100644 --- a/third_party/blink/renderer/core/url/dom_url.cc +++ b/third_party/blink/renderer/core/url/dom_url.cc @@ -100,6 +100,7 @@ URLSearchParams* DOMURL::searchParams() { recordreplay::GetCurrentJSStack(&stack); recordreplay::Assert("[RUN-2324-2325] DOMURL::searchParams %s stack=%s", Url().GetString().Utf8().c_str(), stack.c_str()); + recordreplay::PrintCurrentJSStack(); } search_params_ = URLSearchParams::Create(Url().Query(), this); } diff --git a/tools/v8_context_snapshot/BUILD.gn b/tools/v8_context_snapshot/BUILD.gn index 7b99dfe1b61d8c..092b1b69c8f6e6 100644 --- a/tools/v8_context_snapshot/BUILD.gn +++ b/tools/v8_context_snapshot/BUILD.gn @@ -111,6 +111,7 @@ if (use_v8_context_snapshot) { "//v8", ] + defines = ["GENERATE_V8_CONTEXT_SNAPSHOT"] configs += [ "//v8:external_startup_data", ":disable_icf", diff --git a/tools/v8_context_snapshot/v8_context_snapshot.gni b/tools/v8_context_snapshot/v8_context_snapshot.gni index f6cb20f597a2d8..13ab9322f90c56 100644 --- a/tools/v8_context_snapshot/v8_context_snapshot.gni +++ b/tools/v8_context_snapshot/v8_context_snapshot.gni @@ -28,11 +28,15 @@ declare_args() { # We use a different filename for arm64 macOS builds so that the arm64 and # x64 snapshots can live side-by-side in a universal macOS app. if (is_mac) { - if (v8_target_cpu == "x64") { - v8_context_snapshot_filename = "v8_context_snapshot.x86_64.bin" - } else if (v8_target_cpu == "arm64") { - v8_context_snapshot_filename = "v8_context_snapshot.arm64.bin" - } + v8_context_snapshot_filename = "v8_context_snapshot.bin" + # we aren't build a universal app currently, and the filenames being + # different causes headaches at replay-time. + # + #if (v8_target_cpu == "x64") { + # v8_context_snapshot_filename = "v8_context_snapshot.x86_64.bin" + #} else if (v8_target_cpu == "arm64") { + # v8_context_snapshot_filename = "v8_context_snapshot.arm64.bin" + #} } else if (target_os == "android") { if (v8_current_cpu == "arm" || v8_current_cpu == "x86" || v8_current_cpu == "mipsel") {