Commit d4452d2e authored by Mythri A's avatar Mythri A Committed by Commit Bot

[ic] Add fast path for StaInArrayLiteral with no feedback

We could use StorePropertyInLiteral builtin to handle StaInArrayLiteral
when there is no feedback vector.

Change-Id: I38cae322cc1901582e570f996c6ffd270501245f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1862559Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64379}
parent 6f265b7c
...@@ -3397,7 +3397,7 @@ void AccessorAssembler::KeyedStoreIC(const StoreICParameters* p) { ...@@ -3397,7 +3397,7 @@ void AccessorAssembler::KeyedStoreIC(const StoreICParameters* p) {
} }
void AccessorAssembler::StoreInArrayLiteralIC(const StoreICParameters* p) { void AccessorAssembler::StoreInArrayLiteralIC(const StoreICParameters* p) {
Label miss(this, Label::kDeferred); Label miss(this, Label::kDeferred), no_feedback(this, Label::kDeferred);
{ {
TVARIABLE(MaybeObject, var_handler); TVARIABLE(MaybeObject, var_handler);
...@@ -3408,7 +3408,7 @@ void AccessorAssembler::StoreInArrayLiteralIC(const StoreICParameters* p) { ...@@ -3408,7 +3408,7 @@ void AccessorAssembler::StoreInArrayLiteralIC(const StoreICParameters* p) {
TNode<Map> array_map = LoadReceiverMap(p->receiver()); TNode<Map> array_map = LoadReceiverMap(p->receiver());
GotoIf(IsDeprecatedMap(array_map), &miss); GotoIf(IsDeprecatedMap(array_map), &miss);
GotoIf(IsUndefined(p->vector()), &miss); GotoIf(IsUndefined(p->vector()), &no_feedback);
TNode<MaybeObject> feedback = TNode<MaybeObject> feedback =
TryMonomorphicCase(p->slot(), CAST(p->vector()), array_map, &if_handler, TryMonomorphicCase(p->slot(), CAST(p->vector()), array_map, &if_handler,
...@@ -3485,6 +3485,13 @@ void AccessorAssembler::StoreInArrayLiteralIC(const StoreICParameters* p) { ...@@ -3485,6 +3485,13 @@ void AccessorAssembler::StoreInArrayLiteralIC(const StoreICParameters* p) {
} }
} }
BIND(&no_feedback);
{
Comment("StoreInArrayLiteralIC_NoFeedback");
TailCallBuiltin(Builtins::kSetPropertyInLiteral, p->context(),
p->receiver(), p->name(), p->value());
}
BIND(&miss); BIND(&miss);
{ {
Comment("StoreInArrayLiteralIC_miss"); Comment("StoreInArrayLiteralIC_miss");
......
...@@ -340,6 +340,7 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity( ...@@ -340,6 +340,7 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
{ {
TNode<IntPtrT> offset = TNode<IntPtrT> offset =
ElementOffsetFromIndex(index, PACKED_ELEMENTS, kHeaderSize); ElementOffsetFromIndex(index, PACKED_ELEMENTS, kHeaderSize);
if (!IsStoreInLiteral()) {
// Check if we're about to overwrite the hole. We can safely do that // Check if we're about to overwrite the hole. We can safely do that
// only if there can be no setters on the prototype chain. // only if there can be no setters on the prototype chain.
// If we know that we're storing beyond the previous array length, we // If we know that we're storing beyond the previous array length, we
...@@ -349,12 +350,14 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity( ...@@ -349,12 +350,14 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
if (update_length == kDontChangeLength) { if (update_length == kDontChangeLength) {
TNode<Object> element = TNode<Object> element =
CAST(Load(MachineType::AnyTagged(), elements, offset)); CAST(Load(MachineType::AnyTagged(), elements, offset));
GotoIf(TaggedNotEqual(element, TheHoleConstant()), &hole_check_passed); GotoIf(TaggedNotEqual(element, TheHoleConstant()),
&hole_check_passed);
} }
BranchIfPrototypesHaveNonFastElements(receiver_map, slow, BranchIfPrototypesHaveNonFastElements(receiver_map, slow,
&hole_check_passed); &hole_check_passed);
BIND(&hole_check_passed); BIND(&hole_check_passed);
} }
}
// Check if the value we're storing matches the elements_kind. Smis // Check if the value we're storing matches the elements_kind. Smis
// can always be stored. // can always be stored.
...@@ -443,6 +446,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity( ...@@ -443,6 +446,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
{ {
TNode<IntPtrT> offset = TNode<IntPtrT> offset =
ElementOffsetFromIndex(index, PACKED_DOUBLE_ELEMENTS, kHeaderSize); ElementOffsetFromIndex(index, PACKED_DOUBLE_ELEMENTS, kHeaderSize);
if (!IsStoreInLiteral()) {
// Check if we're about to overwrite the hole. We can safely do that
// Check if we're about to overwrite the hole. We can safely do that // Check if we're about to overwrite the hole. We can safely do that
// only if there can be no setters on the prototype chain. // only if there can be no setters on the prototype chain.
{ {
...@@ -460,6 +465,7 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity( ...@@ -460,6 +465,7 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
&hole_check_passed); &hole_check_passed);
BIND(&hole_check_passed); BIND(&hole_check_passed);
} }
}
// Try to store the value as a double. // Try to store the value as a double.
{ {
...@@ -541,13 +547,15 @@ void KeyedStoreGenericAssembler::EmitGenericElementStore( ...@@ -541,13 +547,15 @@ void KeyedStoreGenericAssembler::EmitGenericElementStore(
} }
BIND(&if_out_of_bounds); BIND(&if_out_of_bounds);
{ if (!IsStoreInLiteral()) {
// Integer indexed out-of-bounds accesses to typed arrays are simply // Integer indexed out-of-bounds accesses to typed arrays are simply
// ignored, since we never look up integer indexed properties on the // ignored, since we never look up integer indexed properties on the
// prototypes of typed arrays. For all other types, we may need to // prototypes of typed arrays. For all other types, we may need to
// grow the backing store. // grow the backing store.
GotoIfNot(InstanceTypeEqual(instance_type, JS_TYPED_ARRAY_TYPE), &if_grow); GotoIfNot(InstanceTypeEqual(instance_type, JS_TYPED_ARRAY_TYPE), &if_grow);
Return(value); Return(value);
} else {
Goto(&if_grow);
} }
BIND(&if_increment_length_by_one); BIND(&if_increment_length_by_one);
......
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