Commit 50f58ea6 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[cleanup] Unifying instance type checks in CSA

Bug: v8:6921
Change-Id: I7602cd68aec6e91e6e59ed78a5e27196e2d28835
Reviewed-on: https://chromium-review.googlesource.com/718101Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48542}
parent ab0266e2
...@@ -1686,12 +1686,11 @@ TF_BUILTIN(ArrayIsArray, CodeStubAssembler) { ...@@ -1686,12 +1686,11 @@ TF_BUILTIN(ArrayIsArray, CodeStubAssembler) {
GotoIf(TaggedIsSmi(object), &return_false); GotoIf(TaggedIsSmi(object), &return_false);
TNode<Word32T> instance_type = LoadInstanceType(CAST(object)); TNode<Word32T> instance_type = LoadInstanceType(CAST(object));
GotoIf(Word32Equal(instance_type, Int32Constant(JS_ARRAY_TYPE)), GotoIf(InstanceTypeEqual(instance_type, JS_ARRAY_TYPE), &return_true);
&return_true);
// TODO(verwaest): Handle proxies in-place. // TODO(verwaest): Handle proxies in-place.
Branch(Word32Equal(instance_type, Int32Constant(JS_PROXY_TYPE)), Branch(InstanceTypeEqual(instance_type, JS_PROXY_TYPE), &call_runtime,
&call_runtime, &return_false); &return_false);
BIND(&return_true); BIND(&return_true);
Return(BooleanConstant(true)); Return(BooleanConstant(true));
...@@ -2291,8 +2290,8 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) { ...@@ -2291,8 +2290,8 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
GotoIf(WordEqual(array, UndefinedConstant()), &allocate_iterator_result); GotoIf(WordEqual(array, UndefinedConstant()), &allocate_iterator_result);
Node* array_type = LoadInstanceType(array); Node* array_type = LoadInstanceType(array);
Branch(Word32Equal(array_type, Int32Constant(JS_TYPED_ARRAY_TYPE)), Branch(InstanceTypeEqual(array_type, JS_TYPED_ARRAY_TYPE), &if_istypedarray,
&if_istypedarray, &if_isgeneric); &if_isgeneric);
BIND(&if_isgeneric); BIND(&if_isgeneric);
{ {
...@@ -2302,8 +2301,8 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) { ...@@ -2302,8 +2301,8 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
{ {
VARIABLE(var_length, MachineRepresentation::kTagged); VARIABLE(var_length, MachineRepresentation::kTagged);
Label if_isarray(this), if_isnotarray(this), done(this); Label if_isarray(this), if_isnotarray(this), done(this);
Branch(Word32Equal(array_type, Int32Constant(JS_ARRAY_TYPE)), Branch(InstanceTypeEqual(array_type, JS_ARRAY_TYPE), &if_isarray,
&if_isarray, &if_isnotarray); &if_isnotarray);
BIND(&if_isarray); BIND(&if_isarray);
{ {
......
...@@ -29,8 +29,8 @@ void DateBuiltinsAssembler::Generate_DatePrototype_GetField(Node* context, ...@@ -29,8 +29,8 @@ void DateBuiltinsAssembler::Generate_DatePrototype_GetField(Node* context,
GotoIf(TaggedIsSmi(receiver), &receiver_not_date); GotoIf(TaggedIsSmi(receiver), &receiver_not_date);
Node* receiver_instance_type = LoadInstanceType(receiver); Node* receiver_instance_type = LoadInstanceType(receiver);
GotoIf(Word32NotEqual(receiver_instance_type, Int32Constant(JS_DATE_TYPE)), GotoIfNot(InstanceTypeEqual(receiver_instance_type, JS_DATE_TYPE),
&receiver_not_date); &receiver_not_date);
// Load the specified date field, falling back to the runtime as necessary. // Load the specified date field, falling back to the runtime as necessary.
if (field_index == JSDate::kDateValue) { if (field_index == JSDate::kDateValue) {
......
...@@ -31,8 +31,7 @@ void GeneratorBuiltinsAssembler::GeneratorPrototypeResume( ...@@ -31,8 +31,7 @@ void GeneratorBuiltinsAssembler::GeneratorPrototypeResume(
Label if_receiverisincompatible(this, Label::kDeferred); Label if_receiverisincompatible(this, Label::kDeferred);
GotoIf(TaggedIsSmi(receiver), &if_receiverisincompatible); GotoIf(TaggedIsSmi(receiver), &if_receiverisincompatible);
Node* receiver_instance_type = LoadInstanceType(receiver); Node* receiver_instance_type = LoadInstanceType(receiver);
GotoIfNot(Word32Equal(receiver_instance_type, GotoIfNot(InstanceTypeEqual(receiver_instance_type, JS_GENERATOR_OBJECT_TYPE),
Int32Constant(JS_GENERATOR_OBJECT_TYPE)),
&if_receiverisincompatible); &if_receiverisincompatible);
// Check if the {receiver} is running or already closed. // Check if the {receiver} is running or already closed.
......
...@@ -46,9 +46,8 @@ void SharedArrayBufferBuiltinsAssembler::ValidateSharedTypedArray( ...@@ -46,9 +46,8 @@ void SharedArrayBufferBuiltinsAssembler::ValidateSharedTypedArray(
GotoIf(TaggedIsSmi(tagged), &invalid); GotoIf(TaggedIsSmi(tagged), &invalid);
// Fail if the array's instance type is not JSTypedArray. // Fail if the array's instance type is not JSTypedArray.
GotoIf(Word32NotEqual(LoadInstanceType(tagged), GotoIfNot(InstanceTypeEqual(LoadInstanceType(tagged), JS_TYPED_ARRAY_TYPE),
Int32Constant(JS_TYPED_ARRAY_TYPE)), &invalid);
&invalid);
// Fail if the array's JSArrayBuffer is not shared. // Fail if the array's JSArrayBuffer is not shared.
Node* array_buffer = LoadObjectField(tagged, JSTypedArray::kBufferOffset); Node* array_buffer = LoadObjectField(tagged, JSTypedArray::kBufferOffset);
......
...@@ -2206,9 +2206,9 @@ TF_BUILTIN(StringIteratorPrototypeNext, StringBuiltinsAssembler) { ...@@ -2206,9 +2206,9 @@ TF_BUILTIN(StringIteratorPrototypeNext, StringBuiltinsAssembler) {
Node* iterator = Parameter(Descriptor::kReceiver); Node* iterator = Parameter(Descriptor::kReceiver);
GotoIf(TaggedIsSmi(iterator), &throw_bad_receiver); GotoIf(TaggedIsSmi(iterator), &throw_bad_receiver);
GotoIfNot(Word32Equal(LoadInstanceType(iterator), GotoIfNot(
Int32Constant(JS_STRING_ITERATOR_TYPE)), InstanceTypeEqual(LoadInstanceType(iterator), JS_STRING_ITERATOR_TYPE),
&throw_bad_receiver); &throw_bad_receiver);
Node* string = LoadObjectField(iterator, JSStringIterator::kStringOffset); Node* string = LoadObjectField(iterator, JSStringIterator::kStringOffset);
Node* position = Node* position =
......
...@@ -1204,7 +1204,7 @@ TNode<Int32T> CodeStubAssembler::LoadInstanceType( ...@@ -1204,7 +1204,7 @@ TNode<Int32T> CodeStubAssembler::LoadInstanceType(
Node* CodeStubAssembler::HasInstanceType(Node* object, Node* CodeStubAssembler::HasInstanceType(Node* object,
InstanceType instance_type) { InstanceType instance_type) {
return Word32Equal(LoadInstanceType(object), Int32Constant(instance_type)); return InstanceTypeEqual(LoadInstanceType(object), instance_type);
} }
Node* CodeStubAssembler::DoesntHaveInstanceType(Node* object, Node* CodeStubAssembler::DoesntHaveInstanceType(Node* object,
...@@ -1235,10 +1235,8 @@ TNode<Int32T> CodeStubAssembler::LoadHashForJSObject( ...@@ -1235,10 +1235,8 @@ TNode<Int32T> CodeStubAssembler::LoadHashForJSObject(
Node* type = LoadInstanceType(properties_or_hash); Node* type = LoadInstanceType(properties_or_hash);
Label if_property_array(this), if_property_dictionary(this), done(this); Label if_property_array(this), if_property_dictionary(this), done(this);
GotoIf(Word32Equal(type, Int32Constant(PROPERTY_ARRAY_TYPE)), GotoIf(InstanceTypeEqual(type, PROPERTY_ARRAY_TYPE), &if_property_array);
&if_property_array); GotoIf(InstanceTypeEqual(type, HASH_TABLE_TYPE), &if_property_dictionary);
GotoIf(Word32Equal(type, Int32Constant(HASH_TABLE_TYPE)),
&if_property_dictionary);
var_hash.Bind(Int32Constant(PropertyArray::kNoHashSentinel)); var_hash.Bind(Int32Constant(PropertyArray::kNoHashSentinel));
Goto(&done); Goto(&done);
...@@ -1417,7 +1415,7 @@ TNode<Object> CodeStubAssembler::LoadMapConstructor(SloppyTNode<Map> map) { ...@@ -1417,7 +1415,7 @@ TNode<Object> CodeStubAssembler::LoadMapConstructor(SloppyTNode<Map> map) {
{ {
GotoIf(TaggedIsSmi(result), &done); GotoIf(TaggedIsSmi(result), &done);
Node* is_map_type = Node* is_map_type =
Word32Equal(LoadInstanceType(CAST(result)), Int32Constant(MAP_TYPE)); InstanceTypeEqual(LoadInstanceType(CAST(result)), MAP_TYPE);
GotoIfNot(is_map_type, &done); GotoIfNot(is_map_type, &done);
result = result =
LoadObjectField(CAST(result), Map::kConstructorOrBackPointerOffset); LoadObjectField(CAST(result), Map::kConstructorOrBackPointerOffset);
...@@ -3452,7 +3450,7 @@ Node* CodeStubAssembler::ToThisValue(Node* context, Node* value, ...@@ -3452,7 +3450,7 @@ Node* CodeStubAssembler::ToThisValue(Node* context, Node* value,
// Check if {value} is a JSValue. // Check if {value} is a JSValue.
Label if_valueisvalue(this, Label::kDeferred), if_valueisnotvalue(this); Label if_valueisvalue(this, Label::kDeferred), if_valueisnotvalue(this);
Branch(Word32Equal(value_instance_type, Int32Constant(JS_VALUE_TYPE)), Branch(InstanceTypeEqual(value_instance_type, JS_VALUE_TYPE),
&if_valueisvalue, &if_valueisnotvalue); &if_valueisvalue, &if_valueisnotvalue);
BIND(&if_valueisvalue); BIND(&if_valueisvalue);
...@@ -3728,7 +3726,7 @@ Node* CodeStubAssembler::IsNullOrJSReceiver(Node* object) { ...@@ -3728,7 +3726,7 @@ Node* CodeStubAssembler::IsNullOrJSReceiver(Node* object) {
} }
Node* CodeStubAssembler::IsJSGlobalProxyInstanceType(Node* instance_type) { Node* CodeStubAssembler::IsJSGlobalProxyInstanceType(Node* instance_type) {
return Word32Equal(instance_type, Int32Constant(JS_GLOBAL_PROXY_TYPE)); return InstanceTypeEqual(instance_type, JS_GLOBAL_PROXY_TYPE);
} }
Node* CodeStubAssembler::IsJSObjectInstanceType(Node* instance_type) { Node* CodeStubAssembler::IsJSObjectInstanceType(Node* instance_type) {
...@@ -3747,21 +3745,17 @@ Node* CodeStubAssembler::IsJSObject(Node* object) { ...@@ -3747,21 +3745,17 @@ Node* CodeStubAssembler::IsJSObject(Node* object) {
} }
Node* CodeStubAssembler::IsJSProxy(Node* object) { Node* CodeStubAssembler::IsJSProxy(Node* object) {
Node* object_map = LoadMap(object); return HasInstanceType(object, JS_PROXY_TYPE);
Node* object_instance_type = LoadMapInstanceType(object_map);
return InstanceTypeEqual(object_instance_type, JS_PROXY_TYPE);
} }
Node* CodeStubAssembler::IsJSGlobalProxy(Node* object) { Node* CodeStubAssembler::IsJSGlobalProxy(Node* object) {
return Word32Equal(LoadInstanceType(object), return HasInstanceType(object, JS_GLOBAL_PROXY_TYPE);
Int32Constant(JS_GLOBAL_PROXY_TYPE));
} }
Node* CodeStubAssembler::IsMap(Node* map) { return IsMetaMap(LoadMap(map)); } Node* CodeStubAssembler::IsMap(Node* map) { return IsMetaMap(LoadMap(map)); }
Node* CodeStubAssembler::IsJSValueInstanceType(Node* instance_type) { Node* CodeStubAssembler::IsJSValueInstanceType(Node* instance_type) {
return Word32Equal(instance_type, Int32Constant(JS_VALUE_TYPE)); return InstanceTypeEqual(instance_type, JS_VALUE_TYPE);
} }
Node* CodeStubAssembler::IsJSValue(Node* object) { Node* CodeStubAssembler::IsJSValue(Node* object) {
...@@ -3773,7 +3767,7 @@ Node* CodeStubAssembler::IsJSValueMap(Node* map) { ...@@ -3773,7 +3767,7 @@ Node* CodeStubAssembler::IsJSValueMap(Node* map) {
} }
Node* CodeStubAssembler::IsJSArrayInstanceType(Node* instance_type) { Node* CodeStubAssembler::IsJSArrayInstanceType(Node* instance_type) {
return Word32Equal(instance_type, Int32Constant(JS_ARRAY_TYPE)); return InstanceTypeEqual(instance_type, JS_ARRAY_TYPE);
} }
Node* CodeStubAssembler::IsJSArray(Node* object) { Node* CodeStubAssembler::IsJSArray(Node* object) {
...@@ -3877,7 +3871,7 @@ Node* CodeStubAssembler::IsString(Node* object) { ...@@ -3877,7 +3871,7 @@ Node* CodeStubAssembler::IsString(Node* object) {
} }
Node* CodeStubAssembler::IsSymbolInstanceType(Node* instance_type) { Node* CodeStubAssembler::IsSymbolInstanceType(Node* instance_type) {
return Word32Equal(instance_type, Int32Constant(SYMBOL_TYPE)); return InstanceTypeEqual(instance_type, SYMBOL_TYPE);
} }
Node* CodeStubAssembler::IsSymbol(Node* object) { Node* CodeStubAssembler::IsSymbol(Node* object) {
...@@ -3885,7 +3879,7 @@ Node* CodeStubAssembler::IsSymbol(Node* object) { ...@@ -3885,7 +3879,7 @@ Node* CodeStubAssembler::IsSymbol(Node* object) {
} }
Node* CodeStubAssembler::IsBigIntInstanceType(Node* instance_type) { Node* CodeStubAssembler::IsBigIntInstanceType(Node* instance_type) {
return Word32Equal(instance_type, Int32Constant(BIGINT_TYPE)); return InstanceTypeEqual(instance_type, BIGINT_TYPE);
} }
Node* CodeStubAssembler::IsBigInt(Node* object) { Node* CodeStubAssembler::IsBigInt(Node* object) {
...@@ -3931,7 +3925,7 @@ Node* CodeStubAssembler::IsUnseededNumberDictionary(Node* object) { ...@@ -3931,7 +3925,7 @@ Node* CodeStubAssembler::IsUnseededNumberDictionary(Node* object) {
} }
Node* CodeStubAssembler::IsJSFunctionInstanceType(Node* instance_type) { Node* CodeStubAssembler::IsJSFunctionInstanceType(Node* instance_type) {
return Word32Equal(instance_type, Int32Constant(JS_FUNCTION_TYPE)); return InstanceTypeEqual(instance_type, JS_FUNCTION_TYPE);
} }
Node* CodeStubAssembler::IsJSFunction(Node* object) { Node* CodeStubAssembler::IsJSFunction(Node* object) {
...@@ -4861,12 +4855,12 @@ Node* CodeStubAssembler::ToName(Node* context, Node* value) { ...@@ -4861,12 +4855,12 @@ Node* CodeStubAssembler::ToName(Node* context, Node* value) {
BIND(&not_name); BIND(&not_name);
{ {
GotoIf(Word32Equal(value_instance_type, Int32Constant(HEAP_NUMBER_TYPE)), GotoIf(InstanceTypeEqual(value_instance_type, HEAP_NUMBER_TYPE),
&is_number); &is_number);
Label not_oddball(this); Label not_oddball(this);
GotoIf(Word32NotEqual(value_instance_type, Int32Constant(ODDBALL_TYPE)), GotoIfNot(InstanceTypeEqual(value_instance_type, ODDBALL_TYPE),
&not_oddball); &not_oddball);
var_result.Bind(LoadObjectField(value, Oddball::kToStringOffset)); var_result.Bind(LoadObjectField(value, Oddball::kToStringOffset));
Goto(&end); Goto(&end);
...@@ -4906,7 +4900,7 @@ Node* CodeStubAssembler::NonNumberToNumberOrNumeric(Node* context, Node* input, ...@@ -4906,7 +4900,7 @@ Node* CodeStubAssembler::NonNumberToNumberOrNumeric(Node* context, Node* input,
if_inputisother(this, Label::kDeferred); if_inputisother(this, Label::kDeferred);
GotoIf(IsStringInstanceType(input_instance_type), &if_inputisstring); GotoIf(IsStringInstanceType(input_instance_type), &if_inputisstring);
GotoIf(IsBigIntInstanceType(input_instance_type), &if_inputisbigint); GotoIf(IsBigIntInstanceType(input_instance_type), &if_inputisbigint);
GotoIf(Word32Equal(input_instance_type, Int32Constant(ODDBALL_TYPE)), GotoIf(InstanceTypeEqual(input_instance_type, ODDBALL_TYPE),
&if_inputisoddball); &if_inputisoddball);
Branch(IsJSReceiverInstanceType(input_instance_type), &if_inputisreceiver, Branch(IsJSReceiverInstanceType(input_instance_type), &if_inputisreceiver,
&if_inputisother); &if_inputisother);
...@@ -5155,8 +5149,7 @@ TNode<String> CodeStubAssembler::ToString(SloppyTNode<Context> context, ...@@ -5155,8 +5149,7 @@ TNode<String> CodeStubAssembler::ToString(SloppyTNode<Context> context,
BIND(&not_heap_number); BIND(&not_heap_number);
{ {
GotoIf(Word32NotEqual(input_instance_type, Int32Constant(ODDBALL_TYPE)), GotoIfNot(InstanceTypeEqual(input_instance_type, ODDBALL_TYPE), &runtime);
&runtime);
result.Bind(LoadObjectField(CAST(input), Oddball::kToStringOffset)); result.Bind(LoadObjectField(CAST(input), Oddball::kToStringOffset));
Goto(&done); Goto(&done);
} }
...@@ -5432,11 +5425,10 @@ void CodeStubAssembler::TryToName(Node* key, Label* if_keyisindex, ...@@ -5432,11 +5425,10 @@ void CodeStubAssembler::TryToName(Node* key, Label* if_keyisindex,
// then it must be an uncacheable index. Handle this case in the runtime. // then it must be an uncacheable index. Handle this case in the runtime.
GotoIf(IsClearWord32(hash, Name::kIsNotArrayIndexMask), if_bailout); GotoIf(IsClearWord32(hash, Name::kIsNotArrayIndexMask), if_bailout);
// Check if we have a ThinString. // Check if we have a ThinString.
GotoIf(Word32Equal(key_instance_type, Int32Constant(THIN_STRING_TYPE)), GotoIf(InstanceTypeEqual(key_instance_type, THIN_STRING_TYPE),
&if_thinstring);
GotoIf(InstanceTypeEqual(key_instance_type, THIN_ONE_BYTE_STRING_TYPE),
&if_thinstring); &if_thinstring);
GotoIf(
Word32Equal(key_instance_type, Int32Constant(THIN_ONE_BYTE_STRING_TYPE)),
&if_thinstring);
// Finally, check if |key| is internalized. // Finally, check if |key| is internalized.
STATIC_ASSERT(kNotInternalizedTag != 0); STATIC_ASSERT(kNotInternalizedTag != 0);
GotoIf(IsSetWord32(key_instance_type, kIsNotInternalizedMask), GotoIf(IsSetWord32(key_instance_type, kIsNotInternalizedMask),
...@@ -6014,7 +6006,7 @@ void CodeStubAssembler::TryLookupProperty( ...@@ -6014,7 +6006,7 @@ void CodeStubAssembler::TryLookupProperty(
BIND(&if_objectisspecial); BIND(&if_objectisspecial);
{ {
// Handle global object here and bailout for other special objects. // Handle global object here and bailout for other special objects.
GotoIfNot(Word32Equal(instance_type, Int32Constant(JS_GLOBAL_OBJECT_TYPE)), GotoIfNot(InstanceTypeEqual(instance_type, JS_GLOBAL_OBJECT_TYPE),
if_bailout); if_bailout);
// Handle interceptors and access checks in runtime. // Handle interceptors and access checks in runtime.
...@@ -6230,8 +6222,7 @@ Node* CodeStubAssembler::CallGetterIfAccessor(Node* value, Node* details, ...@@ -6230,8 +6222,7 @@ Node* CodeStubAssembler::CallGetterIfAccessor(Node* value, Node* details,
Node* getter_map = LoadMap(getter); Node* getter_map = LoadMap(getter);
Node* instance_type = LoadMapInstanceType(getter_map); Node* instance_type = LoadMapInstanceType(getter_map);
// FunctionTemplateInfo getters are not supported yet. // FunctionTemplateInfo getters are not supported yet.
GotoIf(Word32Equal(instance_type, GotoIf(InstanceTypeEqual(instance_type, FUNCTION_TEMPLATE_INFO_TYPE),
Int32Constant(FUNCTION_TEMPLATE_INFO_TYPE)),
if_bailout); if_bailout);
// Return undefined if the {getter} is not callable. // Return undefined if the {getter} is not callable.
...@@ -6545,8 +6536,7 @@ void CodeStubAssembler::TryPrototypeChainLookup( ...@@ -6545,8 +6536,7 @@ void CodeStubAssembler::TryPrototypeChainLookup(
BIND(&if_objectisreceiver); BIND(&if_objectisreceiver);
if (if_proxy) { if (if_proxy) {
GotoIf(Word32Equal(instance_type, Int32Constant(JS_PROXY_TYPE)), GotoIf(InstanceTypeEqual(instance_type, JS_PROXY_TYPE), if_proxy);
if_proxy);
} }
} }
...@@ -6580,9 +6570,8 @@ void CodeStubAssembler::TryPrototypeChainLookup( ...@@ -6580,9 +6570,8 @@ void CodeStubAssembler::TryPrototypeChainLookup(
BIND(&next_proto); BIND(&next_proto);
// Bailout if it can be an integer indexed exotic case. // Bailout if it can be an integer indexed exotic case.
GotoIf( GotoIf(InstanceTypeEqual(holder_instance_type, JS_TYPED_ARRAY_TYPE),
Word32Equal(holder_instance_type, Int32Constant(JS_TYPED_ARRAY_TYPE)), if_bailout);
if_bailout);
Node* proto = LoadMapPrototype(holder_map); Node* proto = LoadMapPrototype(holder_map);
...@@ -6716,9 +6705,8 @@ Node* CodeStubAssembler::OrdinaryHasInstance(Node* context, Node* callable, ...@@ -6716,9 +6705,8 @@ Node* CodeStubAssembler::OrdinaryHasInstance(Node* context, Node* callable,
// Goto runtime if {callable} is not a JSFunction. // Goto runtime if {callable} is not a JSFunction.
Node* callable_instance_type = LoadMapInstanceType(callable_map); Node* callable_instance_type = LoadMapInstanceType(callable_map);
GotoIfNot( GotoIfNot(InstanceTypeEqual(callable_instance_type, JS_FUNCTION_TYPE),
Word32Equal(callable_instance_type, Int32Constant(JS_FUNCTION_TYPE)), &return_runtime);
&return_runtime);
// Goto runtime if {callable} is not a constructor or has // Goto runtime if {callable} is not a constructor or has
// a non-instance "prototype". // a non-instance "prototype".
...@@ -6744,9 +6732,8 @@ Node* CodeStubAssembler::OrdinaryHasInstance(Node* context, Node* callable, ...@@ -6744,9 +6732,8 @@ Node* CodeStubAssembler::OrdinaryHasInstance(Node* context, Node* callable,
// created so far and hence we should return false. // created so far and hence we should return false.
Node* callable_prototype_instance_type = Node* callable_prototype_instance_type =
LoadInstanceType(callable_prototype); LoadInstanceType(callable_prototype);
GotoIfNot( GotoIfNot(InstanceTypeEqual(callable_prototype_instance_type, MAP_TYPE),
Word32Equal(callable_prototype_instance_type, Int32Constant(MAP_TYPE)), &callable_prototype_valid);
&callable_prototype_valid);
var_callable_prototype.Bind( var_callable_prototype.Bind(
LoadObjectField(callable_prototype, Map::kPrototypeOffset)); LoadObjectField(callable_prototype, Map::kPrototypeOffset));
Goto(&callable_prototype_valid); Goto(&callable_prototype_valid);
...@@ -8071,17 +8058,14 @@ Node* CodeStubAssembler::RelationalComparison(RelationalComparisonMode mode, ...@@ -8071,17 +8058,14 @@ Node* CodeStubAssembler::RelationalComparison(RelationalComparisonMode mode,
// and {rhs} is either a HeapNumber or Oddball. // and {rhs} is either a HeapNumber or Oddball.
Label collect_any_feedback(this), collect_oddball_feedback(this), Label collect_any_feedback(this), collect_oddball_feedback(this),
collect_feedback_done(this); collect_feedback_done(this);
GotoIfNot( GotoIfNot(InstanceTypeEqual(lhs_instance_type, ODDBALL_TYPE),
Word32Equal(lhs_instance_type, Int32Constant(ODDBALL_TYPE)), &collect_any_feedback);
&collect_any_feedback);
Node* rhs_instance_type = LoadMapInstanceType(rhs_map); Node* rhs_instance_type = LoadMapInstanceType(rhs_map);
GotoIf(Word32Equal(rhs_instance_type, GotoIf(InstanceTypeEqual(rhs_instance_type, HEAP_NUMBER_TYPE),
Int32Constant(HEAP_NUMBER_TYPE)),
&collect_oddball_feedback); &collect_oddball_feedback);
Branch( Branch(InstanceTypeEqual(rhs_instance_type, ODDBALL_TYPE),
Word32Equal(rhs_instance_type, Int32Constant(ODDBALL_TYPE)), &collect_oddball_feedback, &collect_any_feedback);
&collect_oddball_feedback, &collect_any_feedback);
BIND(&collect_oddball_feedback); BIND(&collect_oddball_feedback);
{ {
...@@ -9379,7 +9363,7 @@ Node* CodeStubAssembler::Typeof(Node* value) { ...@@ -9379,7 +9363,7 @@ Node* CodeStubAssembler::Typeof(Node* value) {
Node* instance_type = LoadMapInstanceType(map); Node* instance_type = LoadMapInstanceType(map);
GotoIf(Word32Equal(instance_type, Int32Constant(ODDBALL_TYPE)), &if_oddball); GotoIf(InstanceTypeEqual(instance_type, ODDBALL_TYPE), &if_oddball);
Node* callable_or_undetectable_mask = Word32And( Node* callable_or_undetectable_mask = Word32And(
LoadMapBitField(map), LoadMapBitField(map),
...@@ -9398,7 +9382,7 @@ Node* CodeStubAssembler::Typeof(Node* value) { ...@@ -9398,7 +9382,7 @@ Node* CodeStubAssembler::Typeof(Node* value) {
GotoIf(IsBigIntInstanceType(instance_type), &return_bigint); GotoIf(IsBigIntInstanceType(instance_type), &return_bigint);
CSA_ASSERT(this, Word32Equal(instance_type, Int32Constant(SYMBOL_TYPE))); CSA_ASSERT(this, InstanceTypeEqual(instance_type, SYMBOL_TYPE));
result_var.Bind(HeapConstant(isolate()->factory()->symbol_string())); result_var.Bind(HeapConstant(isolate()->factory()->symbol_string()));
Goto(&return_result); Goto(&return_result);
...@@ -9792,8 +9776,8 @@ Node* CodeStubAssembler::CreateArrayIterator(Node* array, Node* array_map, ...@@ -9792,8 +9776,8 @@ Node* CodeStubAssembler::CreateArrayIterator(Node* array, Node* array_map,
Label if_istypedarray(this), if_isgeneric(this); Label if_istypedarray(this), if_isgeneric(this);
Branch(Word32Equal(array_type, Int32Constant(JS_TYPED_ARRAY_TYPE)), Branch(InstanceTypeEqual(array_type, JS_TYPED_ARRAY_TYPE), &if_istypedarray,
&if_istypedarray, &if_isgeneric); &if_isgeneric);
BIND(&if_isgeneric); BIND(&if_isgeneric);
{ {
...@@ -9826,8 +9810,8 @@ Node* CodeStubAssembler::CreateArrayIterator(Node* array, Node* array_map, ...@@ -9826,8 +9810,8 @@ Node* CodeStubAssembler::CreateArrayIterator(Node* array, Node* array_map,
} }
} else { } else {
Label if_istypedarray(this), if_isgeneric(this); Label if_istypedarray(this), if_isgeneric(this);
Branch(Word32Equal(array_type, Int32Constant(JS_TYPED_ARRAY_TYPE)), Branch(InstanceTypeEqual(array_type, JS_TYPED_ARRAY_TYPE), &if_istypedarray,
&if_istypedarray, &if_isgeneric); &if_isgeneric);
BIND(&if_isgeneric); BIND(&if_isgeneric);
{ {
......
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