[compiler] Also make PrepareInstall deterministic
Like https://crrev.com/c/3283074; iterating the unordered set is not deterministic, so sort compile deps before iterating if --predictable is set. Bug: v8:12465,v8:12397 Change-Id: Ia0cc299b197e9c84f4fd3fbc70d592656cf4bd43 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3310911 Auto-Submit: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/main@{#78249}
This commit is contained in:
parent
eaaaf9c98e
commit
e947712e2c
@ -1140,16 +1140,7 @@ V8_INLINE void TraceInvalidCompilationDependency(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CompilationDependencies::Commit(Handle<Code> code) {
|
bool CompilationDependencies::Commit(Handle<Code> code) {
|
||||||
for (auto dep : dependencies_) {
|
if (!PrepareInstall()) return false;
|
||||||
if (!dep->IsValid()) {
|
|
||||||
if (FLAG_trace_compilation_dependencies) {
|
|
||||||
TraceInvalidCompilationDependency(dep);
|
|
||||||
}
|
|
||||||
dependencies_.clear();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
dep->PrepareInstall();
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
PendingDependencies pending_deps(zone_);
|
PendingDependencies pending_deps(zone_);
|
||||||
@ -1200,6 +1191,44 @@ bool CompilationDependencies::Commit(Handle<Code> code) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CompilationDependencies::PrepareInstall() {
|
||||||
|
if (V8_UNLIKELY(FLAG_predictable)) {
|
||||||
|
return PrepareInstallPredictable();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto dep : dependencies_) {
|
||||||
|
if (!dep->IsValid()) {
|
||||||
|
if (FLAG_trace_compilation_dependencies) {
|
||||||
|
TraceInvalidCompilationDependency(dep);
|
||||||
|
}
|
||||||
|
dependencies_.clear();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
dep->PrepareInstall();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CompilationDependencies::PrepareInstallPredictable() {
|
||||||
|
CHECK(FLAG_predictable);
|
||||||
|
|
||||||
|
std::vector<const CompilationDependency*> deps(dependencies_.begin(),
|
||||||
|
dependencies_.end());
|
||||||
|
std::sort(deps.begin(), deps.end());
|
||||||
|
|
||||||
|
for (auto dep : deps) {
|
||||||
|
if (!dep->IsValid()) {
|
||||||
|
if (FLAG_trace_compilation_dependencies) {
|
||||||
|
TraceInvalidCompilationDependency(dep);
|
||||||
|
}
|
||||||
|
dependencies_.clear();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
dep->PrepareInstall();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// This function expects to never see a JSProxy.
|
// This function expects to never see a JSProxy.
|
||||||
|
@ -168,6 +168,9 @@ class V8_EXPORT_PRIVATE CompilationDependencies : public ZoneObject {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool PrepareInstall();
|
||||||
|
bool PrepareInstallPredictable();
|
||||||
|
|
||||||
using CompilationDependencySet =
|
using CompilationDependencySet =
|
||||||
ZoneUnorderedSet<const CompilationDependency*, CompilationDependencyHash,
|
ZoneUnorderedSet<const CompilationDependency*, CompilationDependencyHash,
|
||||||
CompilationDependencyEqual>;
|
CompilationDependencyEqual>;
|
||||||
|
Loading…
Reference in New Issue
Block a user