Commit 3d32fbc1 authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[in-place weak refs] Cleanup: rename CSA functions

See https://chromium-review.googlesource.com/1219025 for the corresponding
MaybeObject renaming.

BUG=v8:7308

Change-Id: Ib454fd53d12f110da289e1d3e1e12411b016e557
Reviewed-on: https://chromium-review.googlesource.com/c/1267937Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56443}
parent 3e43ded9
...@@ -86,7 +86,7 @@ void LazyBuiltinsAssembler::MaybeTailCallOptimizedCodeSlot( ...@@ -86,7 +86,7 @@ void LazyBuiltinsAssembler::MaybeTailCallOptimizedCodeSlot(
{ {
// Optimized code slot is a weak reference. // Optimized code slot is a weak reference.
TNode<Code> optimized_code = TNode<Code> optimized_code =
CAST(ToWeakHeapObject(maybe_optimized_code_entry, &fallthrough)); CAST(GetHeapObjectAssumeWeak(maybe_optimized_code_entry, &fallthrough));
// Check if the optimized code is marked for deopt. If it is, call the // Check if the optimized code is marked for deopt. If it is, call the
// runtime to clear it. // runtime to clear it.
......
...@@ -1140,7 +1140,7 @@ TF_BUILTIN(CreateObjectWithoutProperties, ObjectBuiltinsAssembler) { ...@@ -1140,7 +1140,7 @@ TF_BUILTIN(CreateObjectWithoutProperties, ObjectBuiltinsAssembler) {
TNode<MaybeObject> maybe_map = LoadMaybeWeakObjectField( TNode<MaybeObject> maybe_map = LoadMaybeWeakObjectField(
prototype_info, PrototypeInfo::kObjectCreateMapOffset); prototype_info, PrototypeInfo::kObjectCreateMapOffset);
GotoIf(IsStrongReferenceTo(maybe_map, UndefinedConstant()), &call_runtime); GotoIf(IsStrongReferenceTo(maybe_map, UndefinedConstant()), &call_runtime);
map.Bind(ToWeakHeapObject(maybe_map, &call_runtime)); map.Bind(GetHeapObjectAssumeWeak(maybe_map, &call_runtime));
Goto(&instantiate_map); Goto(&instantiate_map);
} }
...@@ -1236,7 +1236,7 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) { ...@@ -1236,7 +1236,7 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) {
prototype_info, PrototypeInfo::kObjectCreateMapOffset); prototype_info, PrototypeInfo::kObjectCreateMapOffset);
GotoIf(IsStrongReferenceTo(maybe_map, UndefinedConstant()), GotoIf(IsStrongReferenceTo(maybe_map, UndefinedConstant()),
&call_runtime); &call_runtime);
map.Bind(ToWeakHeapObject(maybe_map, &call_runtime)); map.Bind(GetHeapObjectAssumeWeak(maybe_map, &call_runtime));
Goto(&instantiate_map); Goto(&instantiate_map);
} }
......
...@@ -1394,14 +1394,14 @@ Node* CodeStubAssembler::LoadBufferObject(Node* buffer, int offset, ...@@ -1394,14 +1394,14 @@ Node* CodeStubAssembler::LoadBufferObject(Node* buffer, int offset,
Node* CodeStubAssembler::LoadObjectField(SloppyTNode<HeapObject> object, Node* CodeStubAssembler::LoadObjectField(SloppyTNode<HeapObject> object,
int offset, MachineType rep) { int offset, MachineType rep) {
CSA_ASSERT(this, IsStrongHeapObject(object)); CSA_ASSERT(this, IsStrong(object));
return Load(rep, object, IntPtrConstant(offset - kHeapObjectTag)); return Load(rep, object, IntPtrConstant(offset - kHeapObjectTag));
} }
Node* CodeStubAssembler::LoadObjectField(SloppyTNode<HeapObject> object, Node* CodeStubAssembler::LoadObjectField(SloppyTNode<HeapObject> object,
SloppyTNode<IntPtrT> offset, SloppyTNode<IntPtrT> offset,
MachineType rep) { MachineType rep) {
CSA_ASSERT(this, IsStrongHeapObject(object)); CSA_ASSERT(this, IsStrong(object));
return Load(rep, object, IntPtrSub(offset, IntPtrConstant(kHeapObjectTag))); return Load(rep, object, IntPtrSub(offset, IntPtrConstant(kHeapObjectTag)));
} }
...@@ -1858,49 +1858,46 @@ void CodeStubAssembler::DispatchMaybeObject(TNode<MaybeObject> maybe_object, ...@@ -1858,49 +1858,46 @@ void CodeStubAssembler::DispatchMaybeObject(TNode<MaybeObject> maybe_object,
Goto(if_strong); Goto(if_strong);
} }
TNode<BoolT> CodeStubAssembler::IsStrongHeapObject(TNode<MaybeObject> value) { TNode<BoolT> CodeStubAssembler::IsStrong(TNode<MaybeObject> value) {
return WordEqual(WordAnd(BitcastMaybeObjectToWord(value), return WordEqual(WordAnd(BitcastMaybeObjectToWord(value),
IntPtrConstant(kHeapObjectTagMask)), IntPtrConstant(kHeapObjectTagMask)),
IntPtrConstant(kHeapObjectTag)); IntPtrConstant(kHeapObjectTag));
} }
TNode<HeapObject> CodeStubAssembler::ToStrongHeapObject( TNode<HeapObject> CodeStubAssembler::GetHeapObjectIfStrong(
TNode<MaybeObject> value, Label* if_not_strong) { TNode<MaybeObject> value, Label* if_not_strong) {
GotoIfNot(IsStrongHeapObject(value), if_not_strong); GotoIfNot(IsStrong(value), if_not_strong);
return CAST(value); return CAST(value);
} }
TNode<BoolT> CodeStubAssembler::IsWeakOrClearedHeapObject( TNode<BoolT> CodeStubAssembler::IsWeakOrCleared(TNode<MaybeObject> value) {
TNode<MaybeObject> value) {
return WordEqual(WordAnd(BitcastMaybeObjectToWord(value), return WordEqual(WordAnd(BitcastMaybeObjectToWord(value),
IntPtrConstant(kHeapObjectTagMask)), IntPtrConstant(kHeapObjectTagMask)),
IntPtrConstant(kWeakHeapObjectTag)); IntPtrConstant(kWeakHeapObjectTag));
} }
TNode<BoolT> CodeStubAssembler::IsClearedWeakHeapObject( TNode<BoolT> CodeStubAssembler::IsCleared(TNode<MaybeObject> value) {
TNode<MaybeObject> value) {
return WordEqual(BitcastMaybeObjectToWord(value), return WordEqual(BitcastMaybeObjectToWord(value),
IntPtrConstant(kClearedWeakHeapObject)); IntPtrConstant(kClearedWeakHeapObject));
} }
TNode<BoolT> CodeStubAssembler::IsNotClearedWeakHeapObject( TNode<BoolT> CodeStubAssembler::IsNotCleared(TNode<MaybeObject> value) {
TNode<MaybeObject> value) {
return WordNotEqual(BitcastMaybeObjectToWord(value), return WordNotEqual(BitcastMaybeObjectToWord(value),
IntPtrConstant(kClearedWeakHeapObject)); IntPtrConstant(kClearedWeakHeapObject));
} }
TNode<HeapObject> CodeStubAssembler::ToWeakHeapObject( TNode<HeapObject> CodeStubAssembler::GetHeapObjectAssumeWeak(
TNode<MaybeObject> value) { TNode<MaybeObject> value) {
CSA_ASSERT(this, IsWeakOrClearedHeapObject(value)); CSA_ASSERT(this, IsWeakOrCleared(value));
CSA_ASSERT(this, IsNotClearedWeakHeapObject(value)); CSA_ASSERT(this, IsNotCleared(value));
return UncheckedCast<HeapObject>(BitcastWordToTagged(WordAnd( return UncheckedCast<HeapObject>(BitcastWordToTagged(WordAnd(
BitcastMaybeObjectToWord(value), IntPtrConstant(~kWeakHeapObjectMask)))); BitcastMaybeObjectToWord(value), IntPtrConstant(~kWeakHeapObjectMask))));
} }
TNode<HeapObject> CodeStubAssembler::ToWeakHeapObject(TNode<MaybeObject> value, TNode<HeapObject> CodeStubAssembler::GetHeapObjectAssumeWeak(
Label* if_cleared) { TNode<MaybeObject> value, Label* if_cleared) {
GotoIf(IsClearedWeakHeapObject(value), if_cleared); GotoIf(IsCleared(value), if_cleared);
return ToWeakHeapObject(value); return GetHeapObjectAssumeWeak(value);
} }
TNode<BoolT> CodeStubAssembler::IsWeakReferenceTo(TNode<MaybeObject> object, TNode<BoolT> CodeStubAssembler::IsWeakReferenceTo(TNode<MaybeObject> object,
......
...@@ -960,22 +960,22 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -960,22 +960,22 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Label* if_cleared, Label* if_weak, Label* if_strong, Label* if_cleared, Label* if_weak, Label* if_strong,
TVariable<Object>* extracted); TVariable<Object>* extracted);
// See MaybeObject for semantics of these functions. // See MaybeObject for semantics of these functions.
TNode<BoolT> IsStrongHeapObject(TNode<MaybeObject> value); TNode<BoolT> IsStrong(TNode<MaybeObject> value);
// This variant is for overzealous checking. // This variant is for overzealous checking.
TNode<BoolT> IsStrongHeapObject(TNode<Object> value) { TNode<BoolT> IsStrong(TNode<Object> value) {
return IsStrongHeapObject(ReinterpretCast<MaybeObject>(value)); return IsStrong(ReinterpretCast<MaybeObject>(value));
} }
TNode<HeapObject> ToStrongHeapObject(TNode<MaybeObject> value, TNode<HeapObject> GetHeapObjectIfStrong(TNode<MaybeObject> value,
Label* if_not_strong); Label* if_not_strong);
TNode<BoolT> IsWeakOrClearedHeapObject(TNode<MaybeObject> value); TNode<BoolT> IsWeakOrCleared(TNode<MaybeObject> value);
TNode<BoolT> IsClearedWeakHeapObject(TNode<MaybeObject> value); TNode<BoolT> IsCleared(TNode<MaybeObject> value);
TNode<BoolT> IsNotClearedWeakHeapObject(TNode<MaybeObject> value); TNode<BoolT> IsNotCleared(TNode<MaybeObject> value);
// Removes the weak bit + asserts it was set. // Removes the weak bit + asserts it was set.
TNode<HeapObject> ToWeakHeapObject(TNode<MaybeObject> value); TNode<HeapObject> GetHeapObjectAssumeWeak(TNode<MaybeObject> value);
TNode<HeapObject> ToWeakHeapObject(TNode<MaybeObject> value, TNode<HeapObject> GetHeapObjectAssumeWeak(TNode<MaybeObject> value,
Label* if_cleared); Label* if_cleared);
TNode<BoolT> IsWeakReferenceTo(TNode<MaybeObject> object, TNode<BoolT> IsWeakReferenceTo(TNode<MaybeObject> object,
......
This diff is collapsed.
...@@ -740,7 +740,7 @@ TNode<Map> KeyedStoreGenericAssembler::FindCandidateStoreICTransitionMapHandler( ...@@ -740,7 +740,7 @@ TNode<Map> KeyedStoreGenericAssembler::FindCandidateStoreICTransitionMapHandler(
const int kKeyToTargetOffset = (TransitionArray::kEntryTargetIndex - const int kKeyToTargetOffset = (TransitionArray::kEntryTargetIndex -
TransitionArray::kEntryKeyIndex) * TransitionArray::kEntryKeyIndex) *
kPointerSize; kPointerSize;
var_transition_map = CAST(ToWeakHeapObject( var_transition_map = CAST(GetHeapObjectAssumeWeak(
LoadArrayElement(transitions, WeakFixedArray::kHeaderSize, LoadArrayElement(transitions, WeakFixedArray::kHeaderSize,
var_name_index.value(), kKeyToTargetOffset))); var_name_index.value(), kKeyToTargetOffset)));
Goto(&found_handler_candidate); Goto(&found_handler_candidate);
......
...@@ -744,12 +744,12 @@ void InterpreterAssembler::CollectCallableFeedback(Node* target, Node* context, ...@@ -744,12 +744,12 @@ void InterpreterAssembler::CollectCallableFeedback(Node* target, Node* context,
feedback, feedback,
HeapConstant(FeedbackVector::UninitializedSentinel(isolate()))); HeapConstant(FeedbackVector::UninitializedSentinel(isolate())));
GotoIf(is_uninitialized, &initialize); GotoIf(is_uninitialized, &initialize);
CSA_ASSERT(this, IsWeakOrClearedHeapObject(feedback)); CSA_ASSERT(this, IsWeakOrCleared(feedback));
// If the weak reference is cleared, we have a new chance to become // If the weak reference is cleared, we have a new chance to become
// monomorphic. // monomorphic.
Comment("check if weak reference is cleared"); Comment("check if weak reference is cleared");
Branch(IsClearedWeakHeapObject(feedback), &initialize, &mark_megamorphic); Branch(IsCleared(feedback), &initialize, &mark_megamorphic);
BIND(&initialize); BIND(&initialize);
{ {
...@@ -948,12 +948,12 @@ Node* InterpreterAssembler::Construct(Node* target, Node* context, ...@@ -948,12 +948,12 @@ Node* InterpreterAssembler::Construct(Node* target, Node* context,
GotoIf(is_megamorphic, &construct); GotoIf(is_megamorphic, &construct);
Comment("check if weak reference"); Comment("check if weak reference");
GotoIfNot(IsWeakOrClearedHeapObject(feedback), &check_allocation_site); GotoIfNot(IsWeakOrCleared(feedback), &check_allocation_site);
// If the weak reference is cleared, we have a new chance to become // If the weak reference is cleared, we have a new chance to become
// monomorphic. // monomorphic.
Comment("check if weak reference is cleared"); Comment("check if weak reference is cleared");
Branch(IsClearedWeakHeapObject(feedback), &initialize, &mark_megamorphic); Branch(IsCleared(feedback), &initialize, &mark_megamorphic);
BIND(&check_allocation_site); BIND(&check_allocation_site);
{ {
...@@ -1127,12 +1127,12 @@ Node* InterpreterAssembler::ConstructWithSpread(Node* target, Node* context, ...@@ -1127,12 +1127,12 @@ Node* InterpreterAssembler::ConstructWithSpread(Node* target, Node* context,
GotoIf(is_megamorphic, &construct); GotoIf(is_megamorphic, &construct);
Comment("check if weak reference"); Comment("check if weak reference");
GotoIfNot(IsWeakOrClearedHeapObject(feedback), &check_initialized); GotoIfNot(IsWeakOrCleared(feedback), &check_initialized);
// If the weak reference is cleared, we have a new chance to become // If the weak reference is cleared, we have a new chance to become
// monomorphic. // monomorphic.
Comment("check if weak reference is cleared"); Comment("check if weak reference is cleared");
Branch(IsClearedWeakHeapObject(feedback), &initialize, &mark_megamorphic); Branch(IsCleared(feedback), &initialize, &mark_megamorphic);
BIND(&check_initialized); BIND(&check_initialized);
{ {
......
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