Skip to content
37 changes: 4 additions & 33 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 6 additions & 0 deletions base/files/memory_mapped_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t*>(data);
length_ = length;
}

// static
void MemoryMappedFile::CalculateVMAlignedBoundaries(int64_t start,
size_t size,
Expand Down
2 changes: 2 additions & 0 deletions base/files/memory_mapped_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 9 additions & 1 deletion base/record_replay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down Expand Up @@ -121,6 +124,7 @@ namespace recordreplay {
Macro(V8RecordReplayFinishRecording, (), ()) \
Macro(V8RecordReplayGetCurrentJSStack, \
(std::string* stackTrace), (stackTrace)) \
Macro(V8RecordReplayPrintCurrentJSStack, (), ()) \
Macro(V8RecordReplayEnterReplayCode, (), ()) \
Macro(V8RecordReplayExitReplayCode, (), ())

Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions base/record_replay.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions cc/trees/layer_tree_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
44 changes: 33 additions & 11 deletions gin/v8_initializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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<base::MemoryMappedFile> mmapped_file(
new base::MemoryMappedFile());
size_t length;
uint8_t* data = reinterpret_cast<uint8_t*>(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) {
Expand Down Expand Up @@ -214,6 +217,7 @@ base::File OpenV8File(const char* file_name,
OpenV8FileResult::MAX_VALUE);
return file;
}
#endif

#endif // defined(V8_USE_EXTERNAL_STARTUP_DATA)

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -545,6 +566,7 @@ void V8Initializer::LoadV8SnapshotFromFile(
return;
}
}
#endif

#if BUILDFLAG(IS_ANDROID)
// static
Expand Down
1 change: 1 addition & 0 deletions third_party/blink/renderer/core/url/dom_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions tools/v8_context_snapshot/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ if (use_v8_context_snapshot) {
"//v8",
]

defines = ["GENERATE_V8_CONTEXT_SNAPSHOT"]
configs += [
"//v8:external_startup_data",
":disable_icf",
Expand Down
14 changes: 9 additions & 5 deletions tools/v8_context_snapshot/v8_context_snapshot.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down