Fix MSVC error in PointerWithPayload::SetPayload().

In a DCHECK inside SetPayload(), MSVC gives a C4806 warning. Use the
right types to avoid this.

Also add pointer-with-payload.h to BUILD.gn.

Change-Id: I10a415250e7d2f06dab7a10bff48eef5890bb723
Reviewed-on: https://chromium-review.googlesource.com/c/1297991
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57003}
This commit is contained in:
Lei Zhang 2018-10-25 07:16:38 -07:00 committed by Commit Bot
parent 39b8169c22
commit a66fddb397
2 changed files with 4 additions and 3 deletions

View File

@ -2355,6 +2355,7 @@ v8_source_set("v8_base") {
"src/pending-compilation-error-handler.h",
"src/perf-jit.cc",
"src/perf-jit.h",
"src/pointer-with-payload.h",
"src/profiler/allocation-tracker.cc",
"src/profiler/allocation-tracker.h",
"src/profiler/circular-queue-inl.h",

View File

@ -88,9 +88,9 @@ class PointerWithPayload {
}
V8_INLINE void SetPayload(PayloadType new_payload) {
DCHECK_EQ(static_cast<PayloadType>(new_payload & kPayloadMask),
new_payload);
pointer_ = (pointer_ & kPointerMask) | static_cast<uintptr_t>(new_payload);
uintptr_t new_payload_ptr = static_cast<uintptr_t>(new_payload);
DCHECK_EQ(new_payload_ptr & kPayloadMask, new_payload_ptr);
pointer_ = (pointer_ & kPointerMask) | new_payload_ptr;
DCHECK_EQ(GetPayload(), new_payload);
}