Commit 00f6e1db authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[csa] refactor EnsureArrayPushable to take map as argument

Change-Id: I371804f47264344651bad7f328f114d1cc71cd24
Reviewed-on: https://chromium-review.googlesource.com/980539Reviewed-by: 's avatarDaniel Clifford <danno@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52294}
parent 1cf0fc80
......@@ -151,7 +151,7 @@ Node* ArrayBuiltinsAssembler::FindProcessor(Node* k_value, Node* k) {
BIND(&fast);
{
GotoIf(SmiNotEqual(LoadJSArrayLength(a()), to_.value()), &runtime);
kind = EnsureArrayPushable(a(), &runtime);
kind = EnsureArrayPushable(LoadMap(a()), &runtime);
GotoIf(IsElementsKindGreaterThan(kind, HOLEY_SMI_ELEMENTS),
&object_push_pre);
......@@ -1026,7 +1026,7 @@ TF_BUILTIN(ArrayPrototypePush, CodeStubAssembler) {
{
array_receiver = CAST(receiver);
arg_index = IntPtrConstant(0);
kind = EnsureArrayPushable(array_receiver, &runtime);
kind = EnsureArrayPushable(LoadMap(array_receiver), &runtime);
GotoIf(IsElementsKindGreaterThan(kind, HOLEY_SMI_ELEMENTS),
&object_push_pre);
......
......@@ -2187,11 +2187,11 @@ void CodeStubAssembler::EnsureArrayLengthWritable(Node* map, Label* bailout) {
GotoIf(IsSetSmi(details, PropertyDetails::kAttributesReadOnlyMask), bailout);
}
Node* CodeStubAssembler::EnsureArrayPushable(Node* receiver, Label* bailout) {
TNode<Int32T> CodeStubAssembler::EnsureArrayPushable(TNode<Map> map,
Label* bailout) {
// Disallow pushing onto prototypes. It might be the JSArray prototype.
// Disallow pushing onto non-extensible objects.
Comment("Disallow pushing onto prototypes");
Node* map = LoadMap(receiver);
Node* bit_field2 = LoadMapBitField2(map);
int mask = Map::IsPrototypeMapBit::kMask | Map::IsExtensibleBit::kMask;
Node* test = Word32And(bit_field2, Int32Constant(mask));
......@@ -2205,8 +2205,8 @@ Node* CodeStubAssembler::EnsureArrayPushable(Node* receiver, Label* bailout) {
EnsureArrayLengthWritable(map, bailout);
Node* kind = DecodeWord32<Map::ElementsKindBits>(bit_field2);
return kind;
TNode<Uint32T> kind = DecodeWord32<Map::ElementsKindBits>(bit_field2);
return Signed(kind);
}
void CodeStubAssembler::PossiblyGrowElementsCapacity(
......
......@@ -741,12 +741,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
void EnsureArrayLengthWritable(Node* map, Label* bailout);
// EnsureArrayPushable verifies that receiver is:
// EnsureArrayPushable verifies that receiver with this map is:
// 1. Is not a prototype.
// 2. Is not a dictionary.
// 3. Has a writeable length property.
// It returns ElementsKind as a node for further division into cases.
Node* EnsureArrayPushable(Node* receiver, Label* bailout);
TNode<Int32T> EnsureArrayPushable(TNode<Map> map, Label* bailout);
void TryStoreArrayElement(ElementsKind kind, ParameterMode mode,
Label* bailout, Node* elements, Node* index,
......
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