Commit f16d3abf authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[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: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69471}
parent 1d3e274d
......@@ -1567,12 +1567,6 @@ void FixedDoubleArrayData::SerializeContents(JSHeapBroker* broker) {
class BytecodeArrayData : public FixedArrayBaseData {
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 {
return constant_pool_[index]->object();
}
......@@ -1605,17 +1599,9 @@ class BytecodeArrayData : public FixedArrayBaseData {
BytecodeArrayData(JSHeapBroker* broker, ObjectData** storage,
Handle<BytecodeArray> 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()) {}
private:
int const register_count_;
int const parameter_count_;
interpreter::Register const incoming_new_target_or_generator_register_;
bool is_serialized_for_compilation_ = false;
ZoneVector<ObjectData*> constant_pool_;
};
......@@ -3265,6 +3251,10 @@ Handle<Object> JSHeapBroker::GetRootHandle(Object object) {
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(holder, name) \
if (data_->should_access_heap()) { \
CHECK(broker()->mode() == JSHeapBroker::kDisabled || \
......@@ -3324,10 +3314,10 @@ BIMODAL_ACCESSOR_C(AllocationSite, bool, PointsToLiteral)
BIMODAL_ACCESSOR_C(AllocationSite, ElementsKind, GetElementsKind)
BIMODAL_ACCESSOR_C(AllocationSite, AllocationType, GetAllocationType)
BIMODAL_ACCESSOR_C(BytecodeArray, int, register_count)
BIMODAL_ACCESSOR_C(BytecodeArray, int, parameter_count)
BIMODAL_ACCESSOR_C(BytecodeArray, interpreter::Register,
incoming_new_target_or_generator_register)
DIRECT_HEAP_ACCESSOR_C(BytecodeArray, int, register_count)
DIRECT_HEAP_ACCESSOR_C(BytecodeArray, int, parameter_count)
DIRECT_HEAP_ACCESSOR_C(BytecodeArray, interpreter::Register,
incoming_new_target_or_generator_register)
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