Commit 3bd88999 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[torque] disable warning for mis-alignment beyond kTaggedSize

Since our allocations don't guarantee more than kTaggedSize alignment,
it doesn't make sense to warn about mis-alignment beyond that.

Bug: v8:8863 v8:7793
Change-Id: Ia1c2dd25efdb2c1084968ab4ffe8de25b8654cdb
Reviewed-on: https://chromium-review.googlesource.com/c/1486251Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59833}
parent 67f70038
......@@ -3,6 +3,8 @@
// found in the LICENSE file.
#include "src/torque/declaration-visitor.h"
#include "src/globals.h"
#include "src/torque/ast.h"
namespace v8 {
......@@ -603,11 +605,12 @@ void DeclarationVisitor::FinalizeClassFieldsAndMethods(
std::string machine_type;
std::tie(field_size, size_string, machine_type) =
field.GetFieldSizeInformation();
size_t aligned_offset = class_offset & ~(field_size - 1);
if (class_offset != aligned_offset) {
// Our allocations don't support alignments beyond kTaggedSize.
size_t alignment = std::min(size_t{kTaggedSize}, field_size);
if (class_offset % alignment != 0) {
ReportError("field ", field_expression.name_and_type.name,
" is not aligned to its size (", aligned_offset, " vs ",
class_offset, " for field size ", field_size, ")");
" at offset ", class_offset, " is not ", alignment,
"-byte aligned.");
}
class_offset += field_size;
}
......
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