Commit 923ba7da authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[CSA] Type HasInstanceType and helpers

Bug: v8:7310
Change-Id: I328fd1b9ebff405f827f7ef810ab1e8459582fca
Reviewed-on: https://chromium-review.googlesource.com/941203Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51643}
parent 36ddd075
......@@ -489,7 +489,7 @@ Node* ArrayBuiltinsAssembler::FindProcessor(Node* k_value, Node* k) {
throw_detached(this, Label::kDeferred);
GotoIf(TaggedIsSmi(receiver_), &throw_not_typed_array);
GotoIfNot(HasInstanceType(receiver_, JS_TYPED_ARRAY_TYPE),
GotoIfNot(HasInstanceType(CAST(receiver_), JS_TYPED_ARRAY_TYPE),
&throw_not_typed_array);
o_ = receiver_;
......@@ -2962,7 +2962,7 @@ TF_BUILTIN(ArrayIsArray, CodeStubAssembler) {
Label call_runtime(this), return_true(this), return_false(this);
GotoIf(TaggedIsSmi(object), &return_false);
TNode<Word32T> instance_type = LoadInstanceType(CAST(object));
TNode<Int32T> instance_type = LoadInstanceType(CAST(object));
GotoIf(InstanceTypeEqual(instance_type, JS_ARRAY_TYPE), &return_true);
......
......@@ -1363,8 +1363,8 @@ TNode<Int32T> CodeStubAssembler::LoadInstanceType(
return LoadMapInstanceType(LoadMap(object));
}
Node* CodeStubAssembler::HasInstanceType(Node* object,
InstanceType instance_type) {
TNode<BoolT> CodeStubAssembler::HasInstanceType(SloppyTNode<HeapObject> object,
InstanceType instance_type) {
return InstanceTypeEqual(LoadInstanceType(object), instance_type);
}
......@@ -1399,18 +1399,19 @@ TNode<BoolT> CodeStubAssembler::HasInitialFastElementsKindMap(
return WordEqual(initial_jsarray_element_map, map);
}
Node* CodeStubAssembler::DoesntHaveInstanceType(Node* object,
InstanceType instance_type) {
TNode<BoolT> CodeStubAssembler::DoesntHaveInstanceType(
SloppyTNode<HeapObject> object, InstanceType instance_type) {
return Word32NotEqual(LoadInstanceType(object), Int32Constant(instance_type));
}
Node* CodeStubAssembler::TaggedDoesntHaveInstanceType(Node* any_tagged,
InstanceType type) {
TNode<BoolT> CodeStubAssembler::TaggedDoesntHaveInstanceType(
SloppyTNode<HeapObject> any_tagged, InstanceType type) {
/* return Phi <TaggedIsSmi(val), DoesntHaveInstanceType(val, type)> */
Node* tagged_is_smi = TaggedIsSmi(any_tagged);
return Select(tagged_is_smi, [=]() { return tagged_is_smi; },
[=]() { return DoesntHaveInstanceType(any_tagged, type); },
MachineRepresentation::kBit);
TNode<BoolT> tagged_is_smi = TaggedIsSmi(any_tagged);
return Select<BoolT>(
tagged_is_smi, [=]() { return tagged_is_smi; },
[=]() { return DoesntHaveInstanceType(any_tagged, type); },
MachineRepresentation::kBit);
}
TNode<HeapObject> CodeStubAssembler::LoadFastProperties(
......@@ -4310,7 +4311,8 @@ void CodeStubAssembler::ThrowTypeError(Node* context,
Unreachable();
}
Node* CodeStubAssembler::InstanceTypeEqual(Node* instance_type, int type) {
TNode<BoolT> CodeStubAssembler::InstanceTypeEqual(
SloppyTNode<Int32T> instance_type, int type) {
return Word32Equal(instance_type, Int32Constant(type));
}
......
......@@ -508,7 +508,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// Load the instance type of an HeapObject.
TNode<Int32T> LoadInstanceType(SloppyTNode<HeapObject> object);
// Compare the instance the type of the object against the provided one.
Node* HasInstanceType(Node* object, InstanceType type);
TNode<BoolT> HasInstanceType(SloppyTNode<HeapObject> object,
InstanceType type);
// Determines whether Array Iterator's prototype has changed.
TNode<BoolT> HasInitialArrayIteratorPrototypeMap(
TNode<Context> native_context);
......@@ -518,8 +519,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// Determines whether an array's elements map has changed.
TNode<BoolT> HasInitialFastElementsKindMap(TNode<Context> native_context,
TNode<JSArray> jsarray);
Node* DoesntHaveInstanceType(Node* object, InstanceType type);
Node* TaggedDoesntHaveInstanceType(Node* any_tagged, InstanceType type);
TNode<BoolT> DoesntHaveInstanceType(SloppyTNode<HeapObject> object,
InstanceType type);
TNode<BoolT> TaggedDoesntHaveInstanceType(SloppyTNode<HeapObject> any_tagged,
InstanceType type);
// Load the properties backing store of a JSObject.
TNode<HeapObject> LoadSlowProperties(SloppyTNode<JSObject> object);
TNode<HeapObject> LoadFastProperties(SloppyTNode<JSObject> object);
......@@ -1091,7 +1094,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
// Type checks.
// Check whether the map is for an object with special properties, such as a
// JSProxy or an object with interceptors.
Node* InstanceTypeEqual(Node* instance_type, int type);
TNode<BoolT> InstanceTypeEqual(SloppyTNode<Int32T> instance_type, int type);
Node* IsAccessorInfo(Node* object);
Node* IsAccessorPair(Node* object);
Node* IsAllocationSite(Node* object);
......
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