[cleanup] Remove extra AcquireLoads in methods

A handful of methods were loading the same member twice in the same
method.

Bug: v8:7790
Change-Id: I20a1a95ed9dae2ff75bfdbf4c571d26ad02b1f94
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2454717
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70440}
This commit is contained in:
Santiago Aboy Solanes 2020-10-07 10:29:11 +01:00 committed by Commit Bot
parent e09beb98a4
commit 242a498382
3 changed files with 27 additions and 19 deletions

View File

@ -565,9 +565,10 @@ void ObjectStatsCollectorImpl::RecordVirtualFunctionTemplateInfoDetails(
FunctionTemplateInfo fti) {
// named_property_handler and indexed_property_handler are recorded as
// INTERCEPTOR_INFO_TYPE.
if (!fti.call_code(kAcquireLoad).IsUndefined(isolate())) {
HeapObject call_code = fti.call_code(kAcquireLoad);
if (!call_code.IsUndefined(isolate())) {
RecordSimpleVirtualObjectStats(
fti, CallHandlerInfo::cast(fti.call_code(kAcquireLoad)),
fti, CallHandlerInfo::cast(call_code),
ObjectStats::FUNCTION_TEMPLATE_INFO_ENTRIES_TYPE);
}
if (!fti.GetInstanceCallHandler().IsUndefined(isolate())) {

View File

@ -126,9 +126,9 @@ void CallOptimization::AnalyzePossibleApiFunction(Isolate* isolate,
isolate);
// Require a C++ callback.
if (info->call_code(kAcquireLoad).IsUndefined(isolate)) return;
api_call_info_ =
handle(CallHandlerInfo::cast(info->call_code(kAcquireLoad)), isolate);
HeapObject call_code = info->call_code(kAcquireLoad);
if (call_code.IsUndefined(isolate)) return;
api_call_info_ = handle(CallHandlerInfo::cast(call_code), isolate);
if (!info->signature().IsUndefined(isolate)) {
expected_receiver_type_ =

View File

@ -394,9 +394,10 @@ inline bool Code::can_have_weak_objects() const {
inline void Code::set_can_have_weak_objects(bool value) {
DCHECK(CodeKindIsOptimizedJSFunction(kind()));
int32_t previous = code_data_container(kAcquireLoad).kind_specific_flags();
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t previous = container.kind_specific_flags();
int32_t updated = CanHaveWeakObjectsField::update(previous, value);
code_data_container(kAcquireLoad).set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated);
}
inline bool Code::is_promise_rejection() const {
@ -407,9 +408,10 @@ inline bool Code::is_promise_rejection() const {
inline void Code::set_is_promise_rejection(bool value) {
DCHECK(kind() == CodeKind::BUILTIN);
int32_t previous = code_data_container(kAcquireLoad).kind_specific_flags();
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t previous = container.kind_specific_flags();
int32_t updated = IsPromiseRejectionField::update(previous, value);
code_data_container(kAcquireLoad).set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated);
}
inline bool Code::is_exception_caught() const {
@ -420,9 +422,10 @@ inline bool Code::is_exception_caught() const {
inline void Code::set_is_exception_caught(bool value) {
DCHECK(kind() == CodeKind::BUILTIN);
int32_t previous = code_data_container(kAcquireLoad).kind_specific_flags();
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t previous = container.kind_specific_flags();
int32_t updated = IsExceptionCaughtField::update(previous, value);
code_data_container(kAcquireLoad).set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated);
}
inline bool Code::is_off_heap_trampoline() const {
@ -477,9 +480,10 @@ bool Code::marked_for_deoptimization() const {
void Code::set_marked_for_deoptimization(bool flag) {
DCHECK(CodeKindCanDeoptimize(kind()));
DCHECK_IMPLIES(flag, AllowDeoptimization::IsAllowed(GetIsolate()));
int32_t previous = code_data_container(kAcquireLoad).kind_specific_flags();
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t previous = container.kind_specific_flags();
int32_t updated = MarkedForDeoptimizationField::update(previous, flag);
code_data_container(kAcquireLoad).set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated);
}
int Code::deoptimization_count() const {
@ -492,12 +496,13 @@ int Code::deoptimization_count() const {
void Code::increment_deoptimization_count() {
DCHECK(CodeKindCanDeoptimize(kind()));
int32_t flags = code_data_container(kAcquireLoad).kind_specific_flags();
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t flags = container.kind_specific_flags();
int32_t count = DeoptCountField::decode(flags);
DCHECK_GE(count, 0);
CHECK_LE(count + 1, DeoptCountField::kMax);
int32_t updated = DeoptCountField::update(flags, count + 1);
code_data_container(kAcquireLoad).set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated);
}
bool Code::embedded_objects_cleared() const {
@ -509,9 +514,10 @@ bool Code::embedded_objects_cleared() const {
void Code::set_embedded_objects_cleared(bool flag) {
DCHECK(CodeKindIsOptimizedJSFunction(kind()));
DCHECK_IMPLIES(flag, marked_for_deoptimization());
int32_t previous = code_data_container(kAcquireLoad).kind_specific_flags();
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t previous = container.kind_specific_flags();
int32_t updated = EmbeddedObjectsClearedField::update(previous, flag);
code_data_container(kAcquireLoad).set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated);
}
bool Code::deopt_already_counted() const {
@ -523,9 +529,10 @@ bool Code::deopt_already_counted() const {
void Code::set_deopt_already_counted(bool flag) {
DCHECK(CodeKindCanDeoptimize(kind()));
DCHECK_IMPLIES(flag, AllowDeoptimization::IsAllowed(GetIsolate()));
int32_t previous = code_data_container(kAcquireLoad).kind_specific_flags();
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t previous = container.kind_specific_flags();
int32_t updated = DeoptAlreadyCountedField::update(previous, flag);
code_data_container(kAcquireLoad).set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated);
}
bool Code::is_optimized_code() const {