From 8cc862ed79e989040b105a257f7c55a813589e84 Mon Sep 17 00:00:00 2001 From: Georg Neis Date: Tue, 23 Feb 2021 18:28:28 +0100 Subject: [PATCH] [compiler] Remove obsolete methods from BytecodeArrayRef Bug: v8:7790 Change-Id: Iae4374e352aea0169d4fe1eba5d825c16efe3940 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2715198 Auto-Submit: Georg Neis Reviewed-by: Santiago Aboy Solanes Commit-Queue: Georg Neis Cr-Commit-Position: refs/heads/master@{#72999} --- src/compiler/heap-refs.h | 15 ++-- src/compiler/js-heap-broker.cc | 69 +------------------ .../serializer-for-background-compilation.cc | 1 - 3 files changed, 5 insertions(+), 80 deletions(-) diff --git a/src/compiler/heap-refs.h b/src/compiler/heap-refs.h index 01fc338d4d..e41bb6d748 100644 --- a/src/compiler/heap-refs.h +++ b/src/compiler/heap-refs.h @@ -805,26 +805,19 @@ class BytecodeArrayRef : public FixedArrayBaseRef { Handle object() const; + // NOTE: Concurrent reads of the actual bytecodes as well as the constant pool + // (both immutable) do not go through BytecodeArrayRef but are performed + // directly through the handle by BytecodeArrayAccessor. + int register_count() const; int parameter_count() const; interpreter::Register incoming_new_target_or_generator_register() const; - // Bytecode access methods. - uint8_t get(int index) const; - Address GetFirstBytecodeAddress() const; - Handle SourcePositionTable() const; - // Constant pool access. - Handle GetConstantAtIndex(int index) const; - bool IsConstantAtIndexSmi(int index) const; - Smi GetConstantAtIndexAsSmi(int index) const; - // Exception handler table. Address handler_table_address() const; int handler_table_size() const; - - void SerializeForCompilation(); }; class JSArrayRef : public JSObjectRef { diff --git a/src/compiler/js-heap-broker.cc b/src/compiler/js-heap-broker.cc index daed2e2206..0d428995a1 100644 --- a/src/compiler/js-heap-broker.cc +++ b/src/compiler/js-heap-broker.cc @@ -1725,51 +1725,18 @@ class BytecodeArrayData : public FixedArrayBaseData { return incoming_new_target_or_generator_register_; } - Handle GetConstantAtIndex(int index, Isolate* isolate) const { - return constant_pool_[index]->object(); - } - - bool IsConstantAtIndexSmi(int index) const { - return constant_pool_[index]->is_smi(); - } - - Smi GetConstantAtIndexAsSmi(int index) const { - return *(Handle::cast(constant_pool_[index]->object())); - } - - void SerializeForCompilation(JSHeapBroker* broker) { - if (is_serialized_for_compilation_) return; - - // Convenience cast: object() is already a canonical persistent handle. - Handle bytecodes = Handle::cast(object()); - - DCHECK(constant_pool_.empty()); - Handle constant_pool(bytecodes->constant_pool(), - broker->isolate()); - constant_pool_.reserve(constant_pool->length()); - for (int i = 0; i < constant_pool->length(); i++) { - constant_pool_.push_back(broker->GetOrCreateData(constant_pool->get(i))); - } - - is_serialized_for_compilation_ = true; - } - BytecodeArrayData(JSHeapBroker* broker, ObjectData** storage, Handle 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()) {} + object->incoming_new_target_or_generator_register()) {} 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 constant_pool_; }; class JSArrayData : public JSObjectData { @@ -3353,40 +3320,6 @@ Float64 FixedDoubleArrayRef::get(int i) const { } } -uint8_t BytecodeArrayRef::get(int index) const { return object()->get(index); } - -Address BytecodeArrayRef::GetFirstBytecodeAddress() const { - return object()->GetFirstBytecodeAddress(); -} - -Handle BytecodeArrayRef::GetConstantAtIndex(int index) const { - if (data_->should_access_heap()) { - return broker()->CanonicalPersistentHandle( - object()->constant_pool().get(index)); - } - return data()->AsBytecodeArray()->GetConstantAtIndex(index, - broker()->isolate()); -} - -bool BytecodeArrayRef::IsConstantAtIndexSmi(int index) const { - if (data_->should_access_heap()) { - return object()->constant_pool().get(index).IsSmi(); - } - return data()->AsBytecodeArray()->IsConstantAtIndexSmi(index); -} - -Smi BytecodeArrayRef::GetConstantAtIndexAsSmi(int index) const { - if (data_->should_access_heap()) { - return Smi::cast(object()->constant_pool().get(index)); - } - return data()->AsBytecodeArray()->GetConstantAtIndexAsSmi(index); -} - -void BytecodeArrayRef::SerializeForCompilation() { - if (data_->should_access_heap()) return; - data()->AsBytecodeArray()->SerializeForCompilation(broker()); -} - Handle BytecodeArrayRef::SourcePositionTable() const { return broker()->CanonicalPersistentHandle(object()->SourcePositionTable()); } diff --git a/src/compiler/serializer-for-background-compilation.cc b/src/compiler/serializer-for-background-compilation.cc index 5943429f81..5be9a7d705 100644 --- a/src/compiler/serializer-for-background-compilation.cc +++ b/src/compiler/serializer-for-background-compilation.cc @@ -1267,7 +1267,6 @@ Handle SerializerForBackgroundCompilation::bytecode_array() void SerializerForBackgroundCompilation::TraverseBytecode() { bytecode_analysis_.emplace(bytecode_array(), zone(), osr_offset(), false); - BytecodeArrayRef(broker(), bytecode_array()).SerializeForCompilation(); BytecodeArrayIterator iterator(bytecode_array()); HandlerRangeMatcher try_start_matcher(iterator, bytecode_array());