[cleanup] Use more CSA InstanceTypeEqual

Bug: v8:6921
Change-Id: I28a42a320a575e396db4e79c2d4a505c15d0784c
Reviewed-on: https://chromium-review.googlesource.com/718536
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48768}
This commit is contained in:
Camillo Bruni 2017-10-20 03:01:54 +02:00 committed by Commit Bot
parent 6c8ed9cf84
commit 7a18e9af69
8 changed files with 28 additions and 36 deletions

View File

@ -747,9 +747,9 @@ class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler {
Label runtime(this, Label::kDeferred), done(this);
Node* const original_map = LoadMap(o());
GotoIf(Word32NotEqual(LoadMapInstanceType(original_map),
Int32Constant(JS_ARRAY_TYPE)),
&runtime);
GotoIfNot(
InstanceTypeEqual(LoadMapInstanceType(original_map), JS_ARRAY_TYPE),
&runtime);
GotoIfNot(IsPrototypeInitialArrayPrototype(context(), original_map),
&runtime);
@ -2253,8 +2253,8 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
BIND(&if_isfastarray);
{
CSA_ASSERT(this, Word32Equal(LoadMapInstanceType(array_map),
Int32Constant(JS_ARRAY_TYPE)));
CSA_ASSERT(
this, InstanceTypeEqual(LoadMapInstanceType(array_map), JS_ARRAY_TYPE));
Node* length = LoadJSArrayLength(array);

View File

@ -30,9 +30,8 @@ TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
{
Node* instance_type = LoadMapInstanceType(receiver_map);
GotoIfNot(
Word32Or(
Word32Equal(instance_type, Int32Constant(JS_FUNCTION_TYPE)),
Word32Equal(instance_type, Int32Constant(JS_BOUND_FUNCTION_TYPE))),
Word32Or(InstanceTypeEqual(instance_type, JS_FUNCTION_TYPE),
InstanceTypeEqual(instance_type, JS_BOUND_FUNCTION_TYPE)),
&slow);
}

View File

@ -727,8 +727,8 @@ void TypedArrayBuiltinsAssembler::GenerateTypedArrayPrototypeIterationMethod(
Node* map = LoadMap(receiver);
Node* instance_type = LoadMapInstanceType(map);
GotoIf(Word32NotEqual(instance_type, Int32Constant(JS_TYPED_ARRAY_TYPE)),
&throw_bad_receiver);
GotoIfNot(InstanceTypeEqual(instance_type, JS_TYPED_ARRAY_TYPE),
&throw_bad_receiver);
// Check if the {receiver}'s JSArrayBuffer was neutered.
Node* receiver_buffer =

View File

@ -1632,8 +1632,7 @@ void AccessorAssembler::GenericElementLoad(Node* receiver, Node* receiver_map,
slow);
Node* elements = LoadElements(receiver);
Node* elements_kind = LoadMapElementsKind(receiver_map);
Node* is_jsarray_condition =
Word32Equal(instance_type, Int32Constant(JS_ARRAY_TYPE));
Node* is_jsarray_condition = InstanceTypeEqual(instance_type, JS_ARRAY_TYPE);
VARIABLE(var_double_value, MachineRepresentation::kFloat64);
Label rebox_double(this, &var_double_value);
@ -1777,8 +1776,8 @@ void AccessorAssembler::GenericPropertyLoad(Node* receiver, Node* receiver_map,
BIND(&loop);
{
// Bailout if it can be an integer indexed exotic case.
GotoIf(Word32Equal(var_holder_instance_type.value(),
Int32Constant(JS_TYPED_ARRAY_TYPE)),
GotoIf(InstanceTypeEqual(var_holder_instance_type.value(),
JS_TYPED_ARRAY_TYPE),
slow);
Node* proto = LoadMapPrototype(var_holder_map.value());
GotoIf(WordEqual(proto, NullConstant()), &return_undefined);
@ -1810,7 +1809,7 @@ void AccessorAssembler::GenericPropertyLoad(Node* receiver, Node* receiver_map,
BIND(&special_receiver);
{
// TODO(jkummerow): Consider supporting JSModuleNamespace.
GotoIfNot(Word32Equal(instance_type, Int32Constant(JS_PROXY_TYPE)), slow);
GotoIfNot(InstanceTypeEqual(instance_type, JS_PROXY_TYPE), slow);
direct_exit.ReturnCallStub(
Builtins::CallableFor(isolate(), Builtins::kProxyGetProperty),
@ -2076,7 +2075,7 @@ void AccessorAssembler::LoadIC_Noninlined(const LoadICParameters* p,
}
void AccessorAssembler::LoadIC_Uninitialized(const LoadICParameters* p) {
Label miss(this);
Label miss(this, Label::kDeferred);
Node* receiver = p->receiver;
GotoIf(TaggedIsSmi(receiver), &miss);
Node* receiver_map = LoadMap(receiver);
@ -2090,9 +2089,9 @@ void AccessorAssembler::LoadIC_Uninitialized(const LoadICParameters* p) {
{
// Special case for Function.prototype load, because it's very common
// for ICs that are only executed once (MyFunc.prototype.foo = ...).
Label not_function_prototype(this);
GotoIf(Word32NotEqual(instance_type, Int32Constant(JS_FUNCTION_TYPE)),
&not_function_prototype);
Label not_function_prototype(this, Label::kDeferred);
GotoIfNot(InstanceTypeEqual(instance_type, JS_FUNCTION_TYPE),
&not_function_prototype);
GotoIfNot(IsPrototypeString(p->name), &not_function_prototype);
// if (!(has_prototype_slot() && !has_non_instance_prototype())) use generic

View File

@ -133,8 +133,7 @@ Node* BinaryOpAssembler::Generate_AddWithFeedback(Node* context, Node* lhs,
// No checks on rhs are done yet. We just know lhs is not a number or Smi.
Label if_lhsisoddball(this), if_lhsisnotoddball(this);
Node* lhs_instance_type = LoadInstanceType(lhs);
Node* lhs_is_oddball =
Word32Equal(lhs_instance_type, Int32Constant(ODDBALL_TYPE));
Node* lhs_is_oddball = InstanceTypeEqual(lhs_instance_type, ODDBALL_TYPE);
Branch(lhs_is_oddball, &if_lhsisoddball, &if_lhsisnotoddball);
BIND(&if_lhsisoddball);
@ -184,8 +183,7 @@ Node* BinaryOpAssembler::Generate_AddWithFeedback(Node* context, Node* lhs,
// Check if rhs is an oddball. At this point we know lhs is either a
// Smi or number or oddball and rhs is not a number or Smi.
Node* rhs_instance_type = LoadInstanceType(rhs);
Node* rhs_is_oddball =
Word32Equal(rhs_instance_type, Int32Constant(ODDBALL_TYPE));
Node* rhs_is_oddball = InstanceTypeEqual(rhs_instance_type, ODDBALL_TYPE);
GotoIf(rhs_is_oddball, &call_with_oddball_feedback);
Branch(IsBigIntInstanceType(rhs_instance_type), &bigint,
&call_with_any_feedback);
@ -323,8 +321,7 @@ Node* BinaryOpAssembler::Generate_BinaryOperationWithFeedback(
Label if_left_bigint(this), if_left_oddball(this);
Node* lhs_instance_type = LoadInstanceType(lhs);
GotoIf(IsBigIntInstanceType(lhs_instance_type), &if_left_bigint);
Node* lhs_is_oddball =
Word32Equal(lhs_instance_type, Int32Constant(ODDBALL_TYPE));
Node* lhs_is_oddball = InstanceTypeEqual(lhs_instance_type, ODDBALL_TYPE);
Branch(lhs_is_oddball, &if_left_oddball, &call_with_any_feedback);
BIND(&if_left_oddball);
@ -363,8 +360,7 @@ Node* BinaryOpAssembler::Generate_BinaryOperationWithFeedback(
// Smi or number or oddball and rhs is not a number or Smi.
Node* rhs_instance_type = LoadInstanceType(rhs);
GotoIf(IsBigIntInstanceType(rhs_instance_type), &if_bigint);
Node* rhs_is_oddball =
Word32Equal(rhs_instance_type, Int32Constant(ODDBALL_TYPE));
Node* rhs_is_oddball = InstanceTypeEqual(rhs_instance_type, ODDBALL_TYPE);
GotoIfNot(rhs_is_oddball, &call_with_any_feedback);
var_type_feedback.Bind(

View File

@ -236,8 +236,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
Node* intptr_index, Node* value, Node* context, Label* slow,
UpdateLength update_length) {
if (update_length != kDontChangeLength) {
CSA_ASSERT(this, Word32Equal(LoadMapInstanceType(receiver_map),
Int32Constant(JS_ARRAY_TYPE)));
CSA_ASSERT(this, InstanceTypeEqual(LoadMapInstanceType(receiver_map),
JS_ARRAY_TYPE));
// Check if the length property is writable. The fast check is only
// supported for fast properties.
GotoIf(IsDictionaryMap(receiver_map), slow);
@ -437,7 +437,7 @@ void KeyedStoreGenericAssembler::EmitGenericElementStore(
BIND(&if_fast);
Label if_array(this);
GotoIf(Word32Equal(instance_type, Int32Constant(JS_ARRAY_TYPE)), &if_array);
GotoIf(InstanceTypeEqual(instance_type, JS_ARRAY_TYPE), &if_array);
{
Node* capacity = SmiUntag(LoadFixedArrayBaseLength(elements));
Branch(UintPtrLessThan(intptr_index, capacity), &if_in_bounds, &if_grow);
@ -593,8 +593,7 @@ void KeyedStoreGenericAssembler::LookupPropertyOnPrototypeChain(
BIND(&next_proto);
// Bailout if it can be an integer indexed exotic case.
GotoIf(Word32Equal(instance_type, Int32Constant(JS_TYPED_ARRAY_TYPE)),
bailout);
GotoIf(InstanceTypeEqual(instance_type, JS_TYPED_ARRAY_TYPE), bailout);
Node* proto = LoadMapPrototype(holder_map);
GotoIf(WordEqual(proto, NullConstant()), &ok_to_write);
var_holder.Bind(proto);

View File

@ -1321,8 +1321,7 @@ Node* InterpreterAssembler::TaggedToWord32OrBigIntWithFeedback(
// only reach this path on the first pass when the feedback is kNone.
CSA_ASSERT(this, SmiEqual(var_type_feedback->value(),
SmiConstant(BinaryOperationFeedback::kNone)));
GotoIf(Word32Equal(instance_type, Int32Constant(ODDBALL_TYPE)),
&is_oddball);
GotoIf(InstanceTypeEqual(instance_type, ODDBALL_TYPE), &is_oddball);
// Not an oddball either -> convert to Numeric.
var_value.Bind(

View File

@ -1207,8 +1207,8 @@ class UnaryNumericOpAssembler : public InterpreterAssembler {
GotoIf(IsHeapNumberMap(map), &if_heapnumber);
Node* instance_type = LoadMapInstanceType(map);
GotoIf(IsBigIntInstanceType(instance_type), &if_bigint);
Branch(Word32Equal(instance_type, Int32Constant(ODDBALL_TYPE)),
&if_oddball, &if_other);
Branch(InstanceTypeEqual(instance_type, ODDBALL_TYPE), &if_oddball,
&if_other);
BIND(&if_smi);
{