Commit 692d4b4b authored by Benjamin Kramer's avatar Benjamin Kramer Committed by V8 LUCI CQ

Fix C++20 incompatiblities

- std::memory_order is no longer an enum, remove the double
  qualification. P0439R0.
- `icu::StringPiece(nullptr, 0)` is now ambiguous due to char8_t no
  longer being equal to char. Use the default constructor. P0482R6.
- WasmGlobal is aggregate initialized, remove the default ctor. It's
  move-only anyways because some of its members are. P1008R1.
- Remove stray `inline` keyword Clang warns about.

Change-Id: I63dca25350a4e560779dc637c3bf637a385dd0c8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3472497
Auto-Submit: Benjamin Kramer <kramerb@google.com>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79230}
parent dec62c2d
......@@ -279,7 +279,7 @@ bool Isolate::CurrentEmbeddedBlobIsBinaryEmbedded() {
// embedded blob may change (e.g. in tests or mksnapshot). If the blob is
// binary-embedded, it is immortal immovable.
const uint8_t* code =
current_embedded_blob_code_.load(std::memory_order::memory_order_relaxed);
current_embedded_blob_code_.load(std::memory_order_relaxed);
if (code == nullptr) return false;
return code == DefaultEmbeddedBlobCode();
}
......@@ -356,26 +356,22 @@ uint32_t Isolate::embedded_blob_data_size() const {
// static
const uint8_t* Isolate::CurrentEmbeddedBlobCode() {
return current_embedded_blob_code_.load(
std::memory_order::memory_order_relaxed);
return current_embedded_blob_code_.load(std::memory_order_relaxed);
}
// static
uint32_t Isolate::CurrentEmbeddedBlobCodeSize() {
return current_embedded_blob_code_size_.load(
std::memory_order::memory_order_relaxed);
return current_embedded_blob_code_size_.load(std::memory_order_relaxed);
}
// static
const uint8_t* Isolate::CurrentEmbeddedBlobData() {
return current_embedded_blob_data_.load(
std::memory_order::memory_order_relaxed);
return current_embedded_blob_data_.load(std::memory_order_relaxed);
}
// static
uint32_t Isolate::CurrentEmbeddedBlobDataSize() {
return current_embedded_blob_data_size_.load(
std::memory_order::memory_order_relaxed);
return current_embedded_blob_data_size_.load(std::memory_order_relaxed);
}
// static
......
......@@ -182,7 +182,7 @@ class Handle final : public HandleBase {
};
template <typename T>
inline std::ostream& operator<<(std::ostream& os, Handle<T> handle);
std::ostream& operator<<(std::ostream& os, Handle<T> handle);
// ----------------------------------------------------------------------------
// A stack-allocated class that governs a number of local handles.
......
......@@ -226,14 +226,14 @@ icu::StringPiece ToICUStringPiece(Isolate* isolate, Handle<String> string,
DisallowGarbageCollection no_gc;
const String::FlatContent& flat = string->GetFlatContent(no_gc);
if (!flat.IsOneByte()) return icu::StringPiece(nullptr, 0);
if (!flat.IsOneByte()) return icu::StringPiece();
int32_t length = string->length();
DCHECK_LT(offset, length);
const char* char_buffer =
reinterpret_cast<const char*>(flat.ToOneByteVector().begin());
if (!String::IsAscii(char_buffer, length)) {
return icu::StringPiece(nullptr, 0);
return icu::StringPiece();
}
return icu::StringPiece(char_buffer + offset, length - offset);
......
......@@ -43,7 +43,7 @@ MetadataLock::MetadataLock() {
abort();
}
while (spinlock_.test_and_set(std::memory_order::memory_order_acquire)) {
while (spinlock_.test_and_set(std::memory_order_acquire)) {
}
}
......@@ -52,7 +52,7 @@ MetadataLock::~MetadataLock() {
abort();
}
spinlock_.clear(std::memory_order::memory_order_release);
spinlock_.clear(std::memory_order_release);
}
} // namespace trap_handler
......
......@@ -1690,13 +1690,12 @@ void NativeModule::SetWireBytes(base::OwnedVector<const uint8_t> wire_bytes) {
void NativeModule::UpdateCPUDuration(size_t cpu_duration, ExecutionTier tier) {
if (tier == WasmCompilationUnit::GetBaselineExecutionTier(this->module())) {
if (!compilation_state_->baseline_compilation_finished()) {
baseline_compilation_cpu_duration_.fetch_add(
cpu_duration, std::memory_order::memory_order_relaxed);
baseline_compilation_cpu_duration_.fetch_add(cpu_duration,
std::memory_order_relaxed);
}
} else if (tier == ExecutionTier::kTurbofan) {
if (!compilation_state_->top_tier_compilation_finished()) {
tier_up_cpu_duration_.fetch_add(cpu_duration,
std::memory_order::memory_order_relaxed);
tier_up_cpu_duration_.fetch_add(cpu_duration, std::memory_order_relaxed);
}
}
}
......
......@@ -785,8 +785,7 @@ class V8_EXPORT_PRIVATE NativeModule final {
void UpdateCPUDuration(size_t cpu_duration, ExecutionTier tier);
void AddLiftoffBailout() {
liftoff_bailout_count_.fetch_add(1,
std::memory_order::memory_order_relaxed);
liftoff_bailout_count_.fetch_add(1, std::memory_order_relaxed);
}
WasmCode* Lookup(Address) const;
......
......@@ -424,8 +424,6 @@ class V8_EXPORT_PRIVATE WasmModuleBuilder : public ZoneObject {
};
struct WasmGlobal {
MOVE_ONLY_NO_DEFAULT_CONSTRUCTOR(WasmGlobal);
ValueType type;
bool mutability;
WasmInitExpr init;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment