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

[in-place weak refs] Cleanup: Add types to CSA::LoadFeedbackVectorSlot callsites.

Bug: v8:7308

Change-Id: I967e036dc584f585dddda0eef480389a33e45bdf
Reviewed-on: https://chromium-review.googlesource.com/1046649Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53103}
parent 09d4ba01
...@@ -308,8 +308,8 @@ Node* ConstructorBuiltinsAssembler::EmitCreateRegExpLiteral( ...@@ -308,8 +308,8 @@ Node* ConstructorBuiltinsAssembler::EmitCreateRegExpLiteral(
Label call_runtime(this, Label::kDeferred), end(this); Label call_runtime(this, Label::kDeferred), end(this);
VARIABLE(result, MachineRepresentation::kTagged); VARIABLE(result, MachineRepresentation::kTagged);
Node* literal_site = TNode<Object> literal_site = ToObject(
LoadFeedbackVectorSlot(feedback_vector, slot, 0, INTPTR_PARAMETERS); LoadFeedbackVectorSlot(feedback_vector, slot, 0, INTPTR_PARAMETERS));
GotoIf(NotHasBoilerplate(literal_site), &call_runtime); GotoIf(NotHasBoilerplate(literal_site), &call_runtime);
{ {
Node* boilerplate = literal_site; Node* boilerplate = literal_site;
...@@ -353,17 +353,19 @@ Node* ConstructorBuiltinsAssembler::EmitCreateShallowArrayLiteral( ...@@ -353,17 +353,19 @@ Node* ConstructorBuiltinsAssembler::EmitCreateShallowArrayLiteral(
return_result(this); return_result(this);
VARIABLE(result, MachineRepresentation::kTagged); VARIABLE(result, MachineRepresentation::kTagged);
Node* allocation_site = TNode<Object> allocation_site = ToObject(
LoadFeedbackVectorSlot(feedback_vector, slot, 0, INTPTR_PARAMETERS); LoadFeedbackVectorSlot(feedback_vector, slot, 0, INTPTR_PARAMETERS));
GotoIf(NotHasBoilerplate(allocation_site), call_runtime); GotoIf(NotHasBoilerplate(allocation_site), call_runtime);
Node* boilerplate = LoadAllocationSiteBoilerplate(allocation_site); Node* boilerplate = LoadAllocationSiteBoilerplate(allocation_site);
allocation_site =
allocation_site_mode == TRACK_ALLOCATION_SITE ? allocation_site : nullptr;
CSA_ASSERT(this, IsJSArrayMap(LoadMap(boilerplate))); CSA_ASSERT(this, IsJSArrayMap(LoadMap(boilerplate)));
ParameterMode mode = OptimalParameterMode(); ParameterMode mode = OptimalParameterMode();
return CloneFastJSArray(context, boilerplate, mode, allocation_site); if (allocation_site_mode == TRACK_ALLOCATION_SITE) {
return CloneFastJSArray(context, boilerplate, mode, allocation_site);
} else {
return CloneFastJSArray(context, boilerplate, mode);
}
} }
TF_BUILTIN(CreateShallowArrayLiteral, ConstructorBuiltinsAssembler) { TF_BUILTIN(CreateShallowArrayLiteral, ConstructorBuiltinsAssembler) {
...@@ -390,8 +392,9 @@ Node* ConstructorBuiltinsAssembler::EmitCreateEmptyArrayLiteral( ...@@ -390,8 +392,9 @@ Node* ConstructorBuiltinsAssembler::EmitCreateEmptyArrayLiteral(
Node* feedback_vector, Node* slot, Node* context) { Node* feedback_vector, Node* slot, Node* context) {
// Array literals always have a valid AllocationSite to properly track // Array literals always have a valid AllocationSite to properly track
// elements transitions. // elements transitions.
VARIABLE(allocation_site, MachineRepresentation::kTagged, TVARIABLE(Object, allocation_site,
LoadFeedbackVectorSlot(feedback_vector, slot, 0, INTPTR_PARAMETERS)); ToObject(LoadFeedbackVectorSlot(feedback_vector, slot, 0,
INTPTR_PARAMETERS)));
Label create_empty_array(this), Label create_empty_array(this),
initialize_allocation_site(this, Label::kDeferred), done(this); initialize_allocation_site(this, Label::kDeferred), done(this);
...@@ -401,15 +404,15 @@ Node* ConstructorBuiltinsAssembler::EmitCreateEmptyArrayLiteral( ...@@ -401,15 +404,15 @@ Node* ConstructorBuiltinsAssembler::EmitCreateEmptyArrayLiteral(
// TODO(cbruni): create the AllocationSite in CSA. // TODO(cbruni): create the AllocationSite in CSA.
BIND(&initialize_allocation_site); BIND(&initialize_allocation_site);
{ {
allocation_site.Bind( allocation_site =
CreateAllocationSiteInFeedbackVector(feedback_vector, SmiTag(slot))); CreateAllocationSiteInFeedbackVector(feedback_vector, SmiTag(slot));
Goto(&create_empty_array); Goto(&create_empty_array);
} }
BIND(&create_empty_array); BIND(&create_empty_array);
CSA_ASSERT(this, IsAllocationSite(allocation_site.value())); CSA_ASSERT(this, IsAllocationSite(CAST(allocation_site.value())));
Node* kind = SmiToInt32(CAST( Node* kind = SmiToInt32(CAST(
LoadObjectField(allocation_site.value(), LoadObjectField(CAST(allocation_site.value()),
AllocationSite::kTransitionInfoOrBoilerplateOffset))); AllocationSite::kTransitionInfoOrBoilerplateOffset)));
CSA_ASSERT(this, IsFastElementsKind(kind)); CSA_ASSERT(this, IsFastElementsKind(kind));
Node* native_context = LoadNativeContext(context); Node* native_context = LoadNativeContext(context);
...@@ -437,8 +440,8 @@ TF_BUILTIN(CreateEmptyArrayLiteral, ConstructorBuiltinsAssembler) { ...@@ -437,8 +440,8 @@ TF_BUILTIN(CreateEmptyArrayLiteral, ConstructorBuiltinsAssembler) {
Node* ConstructorBuiltinsAssembler::EmitCreateShallowObjectLiteral( Node* ConstructorBuiltinsAssembler::EmitCreateShallowObjectLiteral(
Node* feedback_vector, Node* slot, Label* call_runtime) { Node* feedback_vector, Node* slot, Label* call_runtime) {
Node* allocation_site = TNode<Object> allocation_site = ToObject(
LoadFeedbackVectorSlot(feedback_vector, slot, 0, INTPTR_PARAMETERS); LoadFeedbackVectorSlot(feedback_vector, slot, 0, INTPTR_PARAMETERS));
GotoIf(NotHasBoilerplate(allocation_site), call_runtime); GotoIf(NotHasBoilerplate(allocation_site), call_runtime);
Node* boilerplate = LoadAllocationSiteBoilerplate(allocation_site); Node* boilerplate = LoadAllocationSiteBoilerplate(allocation_site);
......
...@@ -8349,8 +8349,9 @@ void CodeStubAssembler::UpdateFeedback(Node* feedback, Node* feedback_vector, ...@@ -8349,8 +8349,9 @@ void CodeStubAssembler::UpdateFeedback(Node* feedback, Node* feedback_vector,
// This method is used for binary op and compare feedback. These // This method is used for binary op and compare feedback. These
// vector nodes are initialized with a smi 0, so we can simply OR // vector nodes are initialized with a smi 0, so we can simply OR
// our new feedback in place. // our new feedback in place.
Node* previous_feedback = LoadFeedbackVectorSlot(feedback_vector, slot_id); TNode<Smi> previous_feedback =
Node* combined_feedback = SmiOr(previous_feedback, feedback); CAST(ToObject(LoadFeedbackVectorSlot(feedback_vector, slot_id)));
TNode<Smi> combined_feedback = SmiOr(previous_feedback, feedback);
Label end(this); Label end(this);
GotoIf(SmiEqual(previous_feedback, combined_feedback), &end); GotoIf(SmiEqual(previous_feedback, combined_feedback), &end);
...@@ -9082,7 +9083,7 @@ Node* CodeStubAssembler::PageFromAddress(Node* address) { ...@@ -9082,7 +9083,7 @@ Node* CodeStubAssembler::PageFromAddress(Node* address) {
return WordAnd(address, IntPtrConstant(~Page::kPageAlignmentMask)); return WordAnd(address, IntPtrConstant(~Page::kPageAlignmentMask));
} }
Node* CodeStubAssembler::CreateAllocationSiteInFeedbackVector( TNode<AllocationSite> CodeStubAssembler::CreateAllocationSiteInFeedbackVector(
Node* feedback_vector, Node* slot) { Node* feedback_vector, Node* slot) {
Node* size = IntPtrConstant(AllocationSite::kSize); Node* size = IntPtrConstant(AllocationSite::kSize);
Node* site = Allocate(size, CodeStubAssembler::kPretenured); Node* site = Allocate(size, CodeStubAssembler::kPretenured);
...@@ -9124,7 +9125,7 @@ Node* CodeStubAssembler::CreateAllocationSiteInFeedbackVector( ...@@ -9124,7 +9125,7 @@ Node* CodeStubAssembler::CreateAllocationSiteInFeedbackVector(
StoreFeedbackVectorSlot(feedback_vector, slot, site, UPDATE_WRITE_BARRIER, 0, StoreFeedbackVectorSlot(feedback_vector, slot, site, UPDATE_WRITE_BARRIER, 0,
SMI_PARAMETERS); SMI_PARAMETERS);
return site; return CAST(site);
} }
Node* CodeStubAssembler::CreateWeakCellInFeedbackVector(Node* feedback_vector, Node* CodeStubAssembler::CreateWeakCellInFeedbackVector(Node* feedback_vector,
......
...@@ -2114,7 +2114,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -2114,7 +2114,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Node* value); Node* value);
// Create a new AllocationSite and install it into a feedback vector. // Create a new AllocationSite and install it into a feedback vector.
Node* CreateAllocationSiteInFeedbackVector(Node* feedback_vector, Node* slot); TNode<AllocationSite> CreateAllocationSiteInFeedbackVector(
Node* feedback_vector, Node* slot);
enum class IndexAdvanceMode { kPre, kPost }; enum class IndexAdvanceMode { kPre, kPost };
......
...@@ -2763,10 +2763,10 @@ void AccessorAssembler::KeyedLoadICPolymorphicName(const LoadICParameters* p) { ...@@ -2763,10 +2763,10 @@ void AccessorAssembler::KeyedLoadICPolymorphicName(const LoadICParameters* p) {
vector, slot, 0, SMI_PARAMETERS)))); vector, slot, 0, SMI_PARAMETERS))));
// Check if we have a matching handler for the {receiver_map}. // Check if we have a matching handler for the {receiver_map}.
Node* array = TNode<WeakFixedArray> array = CAST(ToObject(
LoadFeedbackVectorSlot(vector, slot, kPointerSize, SMI_PARAMETERS); LoadFeedbackVectorSlot(vector, slot, kPointerSize, SMI_PARAMETERS)));
HandlePolymorphicCase(receiver_map, CAST(array), &if_handler, &var_handler, HandlePolymorphicCase(receiver_map, array, &if_handler, &var_handler, &miss,
&miss, 1); 1);
BIND(&if_handler); BIND(&if_handler);
{ {
...@@ -3030,10 +3030,10 @@ void AccessorAssembler::KeyedStoreIC(const StoreICParameters* p) { ...@@ -3030,10 +3030,10 @@ void AccessorAssembler::KeyedStoreIC(const StoreICParameters* p) {
GotoIfNot(WordEqual(feedback, p->name), &miss); GotoIfNot(WordEqual(feedback, p->name), &miss);
// If the name comparison succeeded, we know we have a feedback vector // If the name comparison succeeded, we know we have a feedback vector
// with at least one map/handler pair. // with at least one map/handler pair.
Node* array = LoadFeedbackVectorSlot(p->vector, p->slot, kPointerSize, TNode<WeakFixedArray> array = CAST(ToObject(LoadFeedbackVectorSlot(
SMI_PARAMETERS); p->vector, p->slot, kPointerSize, SMI_PARAMETERS)));
HandlePolymorphicCase(receiver_map, CAST(array), &if_handler, HandlePolymorphicCase(receiver_map, array, &if_handler, &var_handler,
&var_handler, &miss, 1); &miss, 1);
} }
} }
BIND(&miss); BIND(&miss);
...@@ -3151,7 +3151,8 @@ void AccessorAssembler::GenerateLoadIC_Noninlined() { ...@@ -3151,7 +3151,8 @@ void AccessorAssembler::GenerateLoadIC_Noninlined() {
Label if_handler(this, &var_handler), miss(this, Label::kDeferred); Label if_handler(this, &var_handler), miss(this, Label::kDeferred);
Node* receiver_map = LoadReceiverMap(receiver); Node* receiver_map = LoadReceiverMap(receiver);
Node* feedback = LoadFeedbackVectorSlot(vector, slot, 0, SMI_PARAMETERS); TNode<Object> feedback =
ToObject(LoadFeedbackVectorSlot(vector, slot, 0, SMI_PARAMETERS));
LoadICParameters p(context, receiver, name, slot, vector); LoadICParameters p(context, receiver, name, slot, vector);
LoadIC_Noninlined(&p, receiver_map, feedback, &var_handler, &if_handler, LoadIC_Noninlined(&p, receiver_map, feedback, &var_handler, &if_handler,
......
...@@ -703,8 +703,8 @@ void InterpreterAssembler::CallEpilogue() { ...@@ -703,8 +703,8 @@ void InterpreterAssembler::CallEpilogue() {
void InterpreterAssembler::IncrementCallCount(Node* feedback_vector, void InterpreterAssembler::IncrementCallCount(Node* feedback_vector,
Node* slot_id) { Node* slot_id) {
Comment("increment call count"); Comment("increment call count");
Node* call_count = TNode<Smi> call_count = CAST(
LoadFeedbackVectorSlot(feedback_vector, slot_id, kPointerSize); ToObject(LoadFeedbackVectorSlot(feedback_vector, slot_id, kPointerSize)));
// The lowest {FeedbackNexus::CallCountField::kShift} bits of the call // The lowest {FeedbackNexus::CallCountField::kShift} bits of the call
// count are used as flags. To increment the call count by 1 we hence // count are used as flags. To increment the call count by 1 we hence
// have to increment by 1 << {FeedbackNexus::CallCountField::kShift}. // have to increment by 1 << {FeedbackNexus::CallCountField::kShift}.
...@@ -721,7 +721,8 @@ void InterpreterAssembler::CollectCallableFeedback(Node* target, Node* context, ...@@ -721,7 +721,8 @@ void InterpreterAssembler::CollectCallableFeedback(Node* target, Node* context,
Label extra_checks(this, Label::kDeferred), done(this); Label extra_checks(this, Label::kDeferred), done(this);
// Check if we have monomorphic {target} feedback already. // Check if we have monomorphic {target} feedback already.
Node* feedback_element = LoadFeedbackVectorSlot(feedback_vector, slot_id); TNode<HeapObject> feedback_element =
ToStrongHeapObject(LoadFeedbackVectorSlot(feedback_vector, slot_id));
Node* feedback_value = LoadWeakCellValueUnchecked(feedback_element); Node* feedback_value = LoadWeakCellValueUnchecked(feedback_element);
Comment("check if monomorphic"); Comment("check if monomorphic");
Node* is_monomorphic = WordEqual(target, feedback_value); Node* is_monomorphic = WordEqual(target, feedback_value);
...@@ -929,7 +930,8 @@ Node* InterpreterAssembler::Construct(Node* target, Node* context, ...@@ -929,7 +930,8 @@ Node* InterpreterAssembler::Construct(Node* target, Node* context,
IncrementCallCount(feedback_vector, slot_id); IncrementCallCount(feedback_vector, slot_id);
// Check if we have monomorphic {new_target} feedback already. // Check if we have monomorphic {new_target} feedback already.
Node* feedback_element = LoadFeedbackVectorSlot(feedback_vector, slot_id); TNode<HeapObject> feedback_element =
CAST(ToObject(LoadFeedbackVectorSlot(feedback_vector, slot_id)));
Node* feedback_value = LoadWeakCellValueUnchecked(feedback_element); Node* feedback_value = LoadWeakCellValueUnchecked(feedback_element);
Branch(WordEqual(new_target, feedback_value), &construct, &extra_checks); Branch(WordEqual(new_target, feedback_value), &construct, &extra_checks);
...@@ -1108,7 +1110,8 @@ Node* InterpreterAssembler::ConstructWithSpread(Node* target, Node* context, ...@@ -1108,7 +1110,8 @@ Node* InterpreterAssembler::ConstructWithSpread(Node* target, Node* context,
IncrementCallCount(feedback_vector, slot_id); IncrementCallCount(feedback_vector, slot_id);
// Check if we have monomorphic {new_target} feedback already. // Check if we have monomorphic {new_target} feedback already.
Node* feedback_element = LoadFeedbackVectorSlot(feedback_vector, slot_id); TNode<HeapObject> feedback_element =
CAST(ToObject(LoadFeedbackVectorSlot(feedback_vector, slot_id)));
Node* feedback_value = LoadWeakCellValueUnchecked(feedback_element); Node* feedback_value = LoadWeakCellValueUnchecked(feedback_element);
Branch(WordEqual(new_target, feedback_value), &construct, &extra_checks); Branch(WordEqual(new_target, feedback_value), &construct, &extra_checks);
......
...@@ -2447,8 +2447,8 @@ IGNITION_HANDLER(CreateEmptyObjectLiteral, InterpreterAssembler) { ...@@ -2447,8 +2447,8 @@ IGNITION_HANDLER(CreateEmptyObjectLiteral, InterpreterAssembler) {
IGNITION_HANDLER(GetTemplateObject, InterpreterAssembler) { IGNITION_HANDLER(GetTemplateObject, InterpreterAssembler) {
Node* feedback_vector = LoadFeedbackVector(); Node* feedback_vector = LoadFeedbackVector();
Node* slot = BytecodeOperandIdx(1); Node* slot = BytecodeOperandIdx(1);
Node* cached_value = TNode<Object> cached_value = ToObject(
LoadFeedbackVectorSlot(feedback_vector, slot, 0, INTPTR_PARAMETERS); LoadFeedbackVectorSlot(feedback_vector, slot, 0, INTPTR_PARAMETERS));
Label call_runtime(this, Label::kDeferred); Label call_runtime(this, Label::kDeferred);
GotoIf(WordEqual(cached_value, SmiConstant(0)), &call_runtime); GotoIf(WordEqual(cached_value, SmiConstant(0)), &call_runtime);
...@@ -2478,7 +2478,8 @@ IGNITION_HANDLER(CreateClosure, InterpreterAssembler) { ...@@ -2478,7 +2478,8 @@ IGNITION_HANDLER(CreateClosure, InterpreterAssembler) {
Node* context = GetContext(); Node* context = GetContext();
Node* slot = BytecodeOperandIdx(1); Node* slot = BytecodeOperandIdx(1);
Node* feedback_vector = LoadFeedbackVector(); Node* feedback_vector = LoadFeedbackVector();
Node* feedback_cell = LoadFeedbackVectorSlot(feedback_vector, slot); TNode<Object> feedback_cell =
ToObject(LoadFeedbackVectorSlot(feedback_vector, slot));
Label if_fast(this), if_slow(this, Label::kDeferred); Label if_fast(this), if_slow(this, Label::kDeferred);
Branch(IsSetWord32<CreateClosureFlags::FastNewClosureBit>(flags), &if_fast, Branch(IsSetWord32<CreateClosureFlags::FastNewClosureBit>(flags), &if_fast,
......
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