Commit dda79700 authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[ubsan] Port CodeDataContainer to the new design

Bug: v8:3770
Change-Id: I0ffdd0d9da8629977a0b82fbfdac2b4f903e39ad
Reviewed-on: https://chromium-review.googlesource.com/c/1355626Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57979}
parent 4a395137
......@@ -39,7 +39,7 @@ class WasmInstanceObject;
V(BytecodeArray, BytecodeArray) \
V(Cell, Cell*) \
V(Code, Code) \
V(CodeDataContainer, CodeDataContainer*) \
V(CodeDataContainer, CodeDataContainer) \
V(ConsString, ConsString) \
V(Context, Context) \
V(DataHandler, DataHandler*) \
......
......@@ -1571,7 +1571,7 @@ void Code::CodePrint(std::ostream& os) { // NOLINT
}
void CodeDataContainer::CodeDataContainerPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "CodeDataContainer");
PrintHeader(os, "CodeDataContainer");
os << "\n - kind_specific_flags: " << kind_specific_flags();
os << "\n";
}
......
......@@ -26,13 +26,14 @@ OBJECT_CONSTRUCTORS_IMPL(DeoptimizationData, FixedArray)
OBJECT_CONSTRUCTORS_IMPL(BytecodeArray, FixedArrayBase)
OBJECT_CONSTRUCTORS_IMPL(AbstractCode, HeapObjectPtr)
OBJECT_CONSTRUCTORS_IMPL(DependentCode, WeakFixedArray)
OBJECT_CONSTRUCTORS_IMPL(CodeDataContainer, HeapObjectPtr)
NEVER_READ_ONLY_SPACE_IMPL(AbstractCode)
CAST_ACCESSOR2(AbstractCode)
CAST_ACCESSOR2(BytecodeArray)
CAST_ACCESSOR2(Code)
CAST_ACCESSOR(CodeDataContainer)
CAST_ACCESSOR2(CodeDataContainer)
CAST_ACCESSOR2(DependentCode)
CAST_ACCESSOR2(DeoptimizationData)
CAST_ACCESSOR(SourcePositionTableWithFrameCache)
......@@ -197,18 +198,10 @@ INT_ACCESSORS(Code, handler_table_offset, kHandlerTableOffsetOffset)
ACCESSORS_CHECKED2(Code, name, type, offset, true, !Heap::InNewSpace(value))
#define CODE_ACCESSORS2(name, type, offset) \
ACCESSORS_CHECKED3(Code, name, type, offset, true, !Heap::InNewSpace(value))
// TODO(3770): Use shared SYNCHRONIZED_ACCESSORS_CHECKED2 when migrating
// CodeDataContainer*.
#define SYNCHRONIZED_CODE_ACCESSORS(name, type, offset) \
type* Code::name() const { \
type* value = type::cast(ACQUIRE_READ_FIELD(this, offset)); \
return value; \
} \
void Code::set_##name(type* value, WriteBarrierMode mode) { \
DCHECK(!Heap::InNewSpace(value)); \
RELEASE_WRITE_FIELD(this, offset, value); \
CONDITIONAL_WRITE_BARRIER(this, offset, value, mode); \
}
SYNCHRONIZED_ACCESSORS_CHECKED2(Code, name, type, offset, true, \
!Heap::InNewSpace(value))
CODE_ACCESSORS2(relocation_info, ByteArray, kRelocationInfoOffset)
CODE_ACCESSORS2(deoptimization_data, FixedArray, kDeoptimizationDataOffset)
CODE_ACCESSORS(source_position_table, Object, kSourcePositionTableOffset)
......
......@@ -89,7 +89,7 @@ class Code : public HeapObjectPtr {
inline ByteArray SourcePositionTable() const;
// [code_data_container]: A container indirection for all mutable fields.
DECL_ACCESSORS(code_data_container, CodeDataContainer)
DECL_ACCESSORS2(code_data_container, CodeDataContainer)
// [stub_key]: The major/minor key of a code stub.
inline uint32_t stub_key() const;
......@@ -462,8 +462,9 @@ class Code::OptimizedCodeIterator {
// pages within the heap, its header fields need to be immutable. There always
// is a 1-to-1 relation between {Code} and {CodeDataContainer}, the referencing
// field {Code::code_data_container} itself is immutable.
class CodeDataContainer : public HeapObject, public NeverReadOnlySpaceObject {
class CodeDataContainer : public HeapObjectPtr {
public:
NEVER_READ_ONLY_SPACE
DECL_ACCESSORS(next_code_link, Object)
DECL_INT_ACCESSORS(kind_specific_flags)
......@@ -471,7 +472,7 @@ class CodeDataContainer : public HeapObject, public NeverReadOnlySpaceObject {
// is deterministic.
inline void clear_padding();
DECL_CAST(CodeDataContainer)
DECL_CAST2(CodeDataContainer)
// Dispatched behavior.
DECL_PRINTER(CodeDataContainer)
......@@ -494,8 +495,7 @@ class CodeDataContainer : public HeapObject, public NeverReadOnlySpaceObject {
class BodyDescriptor;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(CodeDataContainer);
OBJECT_CONSTRUCTORS(CodeDataContainer, HeapObjectPtr);
};
class AbstractCode : public HeapObjectPtr {
......
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