Commit 45c67da2 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

Revert "[compiler] Access the heap for BytecodeArray int/Register members"

This reverts commit f16d3abf.

Reason for revert: register_count() is read from the heap on the
background thread. This is only safe when FLAG_local_heaps is enabled
(set to true) but this isn't the case on tip-of-tree.

Original change's description:
> [compiler] Access the heap for BytecodeArray int/Register members
>
> We can create a new macro to skip the xxxData classes and read directly
> from the heap.
>
> Bug: v8:7790
> Change-Id: I8de9ba0aee78c74d4c3113eb6bc4870a314de552
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2362687
> Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
> Reviewed-by: Georg Neis <neis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#69471}

TBR=neis@chromium.org,solanes@chromium.org

Bug: v8:7790
Change-Id: I35bdd44721ce1e9d2f46df7cf5d1f413e22d9acf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2372602Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69547}
parent 32e18710
...@@ -1567,6 +1567,12 @@ void FixedDoubleArrayData::SerializeContents(JSHeapBroker* broker) { ...@@ -1567,6 +1567,12 @@ void FixedDoubleArrayData::SerializeContents(JSHeapBroker* broker) {
class BytecodeArrayData : public FixedArrayBaseData { class BytecodeArrayData : public FixedArrayBaseData {
public: public:
int register_count() const { return register_count_; }
int parameter_count() const { return parameter_count_; }
interpreter::Register incoming_new_target_or_generator_register() const {
return incoming_new_target_or_generator_register_;
}
Handle<Object> GetConstantAtIndex(int index, Isolate* isolate) const { Handle<Object> GetConstantAtIndex(int index, Isolate* isolate) const {
return constant_pool_[index]->object(); return constant_pool_[index]->object();
} }
...@@ -1599,9 +1605,17 @@ class BytecodeArrayData : public FixedArrayBaseData { ...@@ -1599,9 +1605,17 @@ class BytecodeArrayData : public FixedArrayBaseData {
BytecodeArrayData(JSHeapBroker* broker, ObjectData** storage, BytecodeArrayData(JSHeapBroker* broker, ObjectData** storage,
Handle<BytecodeArray> object) Handle<BytecodeArray> object)
: FixedArrayBaseData(broker, storage, object), : FixedArrayBaseData(broker, storage, object),
register_count_(object->register_count()),
parameter_count_(object->parameter_count()),
incoming_new_target_or_generator_register_(
object->incoming_new_target_or_generator_register()),
constant_pool_(broker->zone()) {} constant_pool_(broker->zone()) {}
private: private:
int const register_count_;
int const parameter_count_;
interpreter::Register const incoming_new_target_or_generator_register_;
bool is_serialized_for_compilation_ = false; bool is_serialized_for_compilation_ = false;
ZoneVector<ObjectData*> constant_pool_; ZoneVector<ObjectData*> constant_pool_;
}; };
...@@ -3251,10 +3265,6 @@ Handle<Object> JSHeapBroker::GetRootHandle(Object object) { ...@@ -3251,10 +3265,6 @@ Handle<Object> JSHeapBroker::GetRootHandle(Object object) {
return Handle<Object>(isolate()->root_handle(root_index).location()); return Handle<Object>(isolate()->root_handle(root_index).location());
} }
// Accessors for direct heap reads.
#define DIRECT_HEAP_ACCESSOR_C(holder, result, name) \
result holder##Ref::name() const { return object()->name(); }
#define IF_ACCESS_FROM_HEAP_C(name) \ #define IF_ACCESS_FROM_HEAP_C(name) \
if (data_->should_access_heap()) { \ if (data_->should_access_heap()) { \
CHECK(broker()->mode() == JSHeapBroker::kDisabled || \ CHECK(broker()->mode() == JSHeapBroker::kDisabled || \
...@@ -3314,9 +3324,9 @@ BIMODAL_ACCESSOR_C(AllocationSite, bool, PointsToLiteral) ...@@ -3314,9 +3324,9 @@ BIMODAL_ACCESSOR_C(AllocationSite, bool, PointsToLiteral)
BIMODAL_ACCESSOR_C(AllocationSite, ElementsKind, GetElementsKind) BIMODAL_ACCESSOR_C(AllocationSite, ElementsKind, GetElementsKind)
BIMODAL_ACCESSOR_C(AllocationSite, AllocationType, GetAllocationType) BIMODAL_ACCESSOR_C(AllocationSite, AllocationType, GetAllocationType)
DIRECT_HEAP_ACCESSOR_C(BytecodeArray, int, register_count) BIMODAL_ACCESSOR_C(BytecodeArray, int, register_count)
DIRECT_HEAP_ACCESSOR_C(BytecodeArray, int, parameter_count) BIMODAL_ACCESSOR_C(BytecodeArray, int, parameter_count)
DIRECT_HEAP_ACCESSOR_C(BytecodeArray, interpreter::Register, BIMODAL_ACCESSOR_C(BytecodeArray, interpreter::Register,
incoming_new_target_or_generator_register) incoming_new_target_or_generator_register)
BIMODAL_ACCESSOR(Cell, Object, value) BIMODAL_ACCESSOR(Cell, Object, value)
......
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