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; ...@@ -39,7 +39,7 @@ class WasmInstanceObject;
V(BytecodeArray, BytecodeArray) \ V(BytecodeArray, BytecodeArray) \
V(Cell, Cell*) \ V(Cell, Cell*) \
V(Code, Code) \ V(Code, Code) \
V(CodeDataContainer, CodeDataContainer*) \ V(CodeDataContainer, CodeDataContainer) \
V(ConsString, ConsString) \ V(ConsString, ConsString) \
V(Context, Context) \ V(Context, Context) \
V(DataHandler, DataHandler*) \ V(DataHandler, DataHandler*) \
......
...@@ -1571,7 +1571,7 @@ void Code::CodePrint(std::ostream& os) { // NOLINT ...@@ -1571,7 +1571,7 @@ void Code::CodePrint(std::ostream& os) { // NOLINT
} }
void CodeDataContainer::CodeDataContainerPrint(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 - kind_specific_flags: " << kind_specific_flags();
os << "\n"; os << "\n";
} }
......
...@@ -26,13 +26,14 @@ OBJECT_CONSTRUCTORS_IMPL(DeoptimizationData, FixedArray) ...@@ -26,13 +26,14 @@ OBJECT_CONSTRUCTORS_IMPL(DeoptimizationData, FixedArray)
OBJECT_CONSTRUCTORS_IMPL(BytecodeArray, FixedArrayBase) OBJECT_CONSTRUCTORS_IMPL(BytecodeArray, FixedArrayBase)
OBJECT_CONSTRUCTORS_IMPL(AbstractCode, HeapObjectPtr) OBJECT_CONSTRUCTORS_IMPL(AbstractCode, HeapObjectPtr)
OBJECT_CONSTRUCTORS_IMPL(DependentCode, WeakFixedArray) OBJECT_CONSTRUCTORS_IMPL(DependentCode, WeakFixedArray)
OBJECT_CONSTRUCTORS_IMPL(CodeDataContainer, HeapObjectPtr)
NEVER_READ_ONLY_SPACE_IMPL(AbstractCode) NEVER_READ_ONLY_SPACE_IMPL(AbstractCode)
CAST_ACCESSOR2(AbstractCode) CAST_ACCESSOR2(AbstractCode)
CAST_ACCESSOR2(BytecodeArray) CAST_ACCESSOR2(BytecodeArray)
CAST_ACCESSOR2(Code) CAST_ACCESSOR2(Code)
CAST_ACCESSOR(CodeDataContainer) CAST_ACCESSOR2(CodeDataContainer)
CAST_ACCESSOR2(DependentCode) CAST_ACCESSOR2(DependentCode)
CAST_ACCESSOR2(DeoptimizationData) CAST_ACCESSOR2(DeoptimizationData)
CAST_ACCESSOR(SourcePositionTableWithFrameCache) CAST_ACCESSOR(SourcePositionTableWithFrameCache)
...@@ -197,18 +198,10 @@ INT_ACCESSORS(Code, handler_table_offset, kHandlerTableOffsetOffset) ...@@ -197,18 +198,10 @@ INT_ACCESSORS(Code, handler_table_offset, kHandlerTableOffsetOffset)
ACCESSORS_CHECKED2(Code, name, type, offset, true, !Heap::InNewSpace(value)) ACCESSORS_CHECKED2(Code, name, type, offset, true, !Heap::InNewSpace(value))
#define CODE_ACCESSORS2(name, type, offset) \ #define CODE_ACCESSORS2(name, type, offset) \
ACCESSORS_CHECKED3(Code, name, type, offset, true, !Heap::InNewSpace(value)) ACCESSORS_CHECKED3(Code, name, type, offset, true, !Heap::InNewSpace(value))
// TODO(3770): Use shared SYNCHRONIZED_ACCESSORS_CHECKED2 when migrating #define SYNCHRONIZED_CODE_ACCESSORS(name, type, offset) \
// CodeDataContainer*. SYNCHRONIZED_ACCESSORS_CHECKED2(Code, name, type, offset, true, \
#define SYNCHRONIZED_CODE_ACCESSORS(name, type, offset) \ !Heap::InNewSpace(value))
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); \
}
CODE_ACCESSORS2(relocation_info, ByteArray, kRelocationInfoOffset) CODE_ACCESSORS2(relocation_info, ByteArray, kRelocationInfoOffset)
CODE_ACCESSORS2(deoptimization_data, FixedArray, kDeoptimizationDataOffset) CODE_ACCESSORS2(deoptimization_data, FixedArray, kDeoptimizationDataOffset)
CODE_ACCESSORS(source_position_table, Object, kSourcePositionTableOffset) CODE_ACCESSORS(source_position_table, Object, kSourcePositionTableOffset)
......
...@@ -89,7 +89,7 @@ class Code : public HeapObjectPtr { ...@@ -89,7 +89,7 @@ class Code : public HeapObjectPtr {
inline ByteArray SourcePositionTable() const; inline ByteArray SourcePositionTable() const;
// [code_data_container]: A container indirection for all mutable fields. // [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. // [stub_key]: The major/minor key of a code stub.
inline uint32_t stub_key() const; inline uint32_t stub_key() const;
...@@ -462,8 +462,9 @@ class Code::OptimizedCodeIterator { ...@@ -462,8 +462,9 @@ class Code::OptimizedCodeIterator {
// pages within the heap, its header fields need to be immutable. There always // 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 // is a 1-to-1 relation between {Code} and {CodeDataContainer}, the referencing
// field {Code::code_data_container} itself is immutable. // field {Code::code_data_container} itself is immutable.
class CodeDataContainer : public HeapObject, public NeverReadOnlySpaceObject { class CodeDataContainer : public HeapObjectPtr {
public: public:
NEVER_READ_ONLY_SPACE
DECL_ACCESSORS(next_code_link, Object) DECL_ACCESSORS(next_code_link, Object)
DECL_INT_ACCESSORS(kind_specific_flags) DECL_INT_ACCESSORS(kind_specific_flags)
...@@ -471,7 +472,7 @@ class CodeDataContainer : public HeapObject, public NeverReadOnlySpaceObject { ...@@ -471,7 +472,7 @@ class CodeDataContainer : public HeapObject, public NeverReadOnlySpaceObject {
// is deterministic. // is deterministic.
inline void clear_padding(); inline void clear_padding();
DECL_CAST(CodeDataContainer) DECL_CAST2(CodeDataContainer)
// Dispatched behavior. // Dispatched behavior.
DECL_PRINTER(CodeDataContainer) DECL_PRINTER(CodeDataContainer)
...@@ -494,8 +495,7 @@ class CodeDataContainer : public HeapObject, public NeverReadOnlySpaceObject { ...@@ -494,8 +495,7 @@ class CodeDataContainer : public HeapObject, public NeverReadOnlySpaceObject {
class BodyDescriptor; class BodyDescriptor;
private: OBJECT_CONSTRUCTORS(CodeDataContainer, HeapObjectPtr);
DISALLOW_IMPLICIT_CONSTRUCTORS(CodeDataContainer);
}; };
class AbstractCode : public 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