Skip to content
Permalink
Browse files

[csa] Fix incorrect usages of SelectTaggedConstant() and drop it.

... in favor of SelectConstant().

Bug: chromium:829679
Change-Id: Ic7cc887254b4f6b29339b06c5782d71f77d3c9a5
Reviewed-on: https://chromium-review.googlesource.com/999601
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52446}
  • Loading branch information...
isheludko authored and Commit Bot committed Apr 6, 2018
1 parent 9136841 commit f018cebf38b8d2b9ca3d73e01c871334b49ef6d2
@@ -771,11 +771,15 @@ TF_BUILTIN(ObjectPrototypeToString, ObjectBuiltinsAssembler) {
// as the exception is observable.
Node* receiver_is_array =
CallRuntime(Runtime::kArrayIsArray, context, receiver);
Node* builtin_tag = SelectTaggedConstant<Object>(
IsTrue(receiver_is_array), LoadRoot(Heap::kArray_stringRootIndex),
SelectTaggedConstant<Object>(IsCallableMap(receiver_map),
LoadRoot(Heap::kFunction_stringRootIndex),
LoadRoot(Heap::kObject_stringRootIndex)));
TNode<String> builtin_tag = Select<String>(
IsTrue(receiver_is_array),
[=] { return CAST(LoadRoot(Heap::kArray_stringRootIndex)); },
[=] {
return Select<String>(
IsCallableMap(receiver_map),
[=] { return CAST(LoadRoot(Heap::kFunction_stringRootIndex)); },
[=] { return CAST(LoadRoot(Heap::kObject_stringRootIndex)); });
});

// Lookup the @@toStringTag property on the {receiver}.
VARIABLE(var_tag, MachineRepresentation::kTagged,
@@ -1943,7 +1943,7 @@ TNode<Smi> StringBuiltinsAssembler::ToSmiBetweenZeroAnd(
{
TNode<Smi> const zero = SmiConstant(0);
var_result =
SelectTaggedConstant(SmiLessThan(value_smi, zero), zero, limit);
SelectConstant<Smi>(SmiLessThan(value_smi, zero), zero, limit);
Goto(&out);
}
}
@@ -1956,8 +1956,8 @@ TNode<Smi> StringBuiltinsAssembler::ToSmiBetweenZeroAnd(
TNode<Float64T> const float_zero = Float64Constant(0.);
TNode<Smi> const smi_zero = SmiConstant(0);
TNode<Float64T> const value_float = LoadHeapNumberValue(value_int_hn);
var_result = SelectTaggedConstant(Float64LessThan(value_float, float_zero),
smi_zero, limit);
var_result = SelectConstant<Smi>(Float64LessThan(value_float, float_zero),
smi_zero, limit);
Goto(&out);
}

@@ -561,11 +561,11 @@ TNode<Float64T> CodeStubAssembler::SmiToFloat64(SloppyTNode<Smi> value) {
}

TNode<Smi> CodeStubAssembler::SmiMax(SloppyTNode<Smi> a, SloppyTNode<Smi> b) {
return SelectTaggedConstant(SmiLessThan(a, b), b, a);
return SelectConstant<Smi>(SmiLessThan(a, b), b, a);
}

TNode<Smi> CodeStubAssembler::SmiMin(SloppyTNode<Smi> a, SloppyTNode<Smi> b) {
return SelectTaggedConstant(SmiLessThan(a, b), a, b);
return SelectConstant<Smi>(SmiLessThan(a, b), a, b);
}

TNode<Object> CodeStubAssembler::NumberMax(SloppyTNode<Object> a,
@@ -1397,19 +1397,21 @@ TNode<BoolT> CodeStubAssembler::TaggedDoesntHaveInstanceType(
TNode<HeapObject> CodeStubAssembler::LoadFastProperties(
SloppyTNode<JSObject> object) {
CSA_SLOW_ASSERT(this, Word32Not(IsDictionaryMap(LoadMap(object))));
Node* properties = LoadObjectField(object, JSObject::kPropertiesOrHashOffset);
return SelectTaggedConstant<HeapObject>(
TaggedIsSmi(properties), EmptyFixedArrayConstant(), properties);
TNode<Object> properties =
LoadObjectField(object, JSObject::kPropertiesOrHashOffset);
return Select<HeapObject>(TaggedIsSmi(properties),
[=] { return EmptyFixedArrayConstant(); },
[=] { return CAST(properties); });
}

TNode<HeapObject> CodeStubAssembler::LoadSlowProperties(
SloppyTNode<JSObject> object) {
CSA_SLOW_ASSERT(this, IsDictionaryMap(LoadMap(object)));
TNode<Object> properties =
LoadObjectField(object, JSObject::kPropertiesOrHashOffset);
return SelectTaggedConstant<HeapObject>(TaggedIsSmi(properties),
EmptyPropertyDictionaryConstant(),
CAST(properties));
return Select<HeapObject>(TaggedIsSmi(properties),
[=] { return EmptyPropertyDictionaryConstant(); },
[=] { return CAST(properties); });
}

TNode<FixedArrayBase> CodeStubAssembler::LoadElements(
@@ -279,7 +279,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
}

#define SMI_COMPARISON_OP(SmiOpName, IntPtrOpName) \
Node* SmiOpName(Node* a, Node* b) { \
TNode<BoolT> SmiOpName(Node* a, Node* b) { \
return IntPtrOpName(BitcastTaggedToWord(a), BitcastTaggedToWord(b)); \
}
SMI_COMPARISON_OP(SmiEqual, WordEqual)
@@ -376,13 +376,6 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
TNode<IntPtrT> SelectIntPtrConstant(SloppyTNode<BoolT> condition,
int true_value, int false_value);
TNode<Oddball> SelectBooleanConstant(SloppyTNode<BoolT> condition);
template <class A>
TNode<A> SelectTaggedConstant(SloppyTNode<BoolT> condition,
TNode<A> true_value,
SloppyTNode<A> false_value) {
static_assert(std::is_base_of<Object, A>::value, "not a tagged type");
return SelectConstant<A>(condition, true_value, false_value);
}
TNode<Smi> SelectSmiConstant(SloppyTNode<BoolT> condition, Smi* true_value,
Smi* false_value);
TNode<Smi> SelectSmiConstant(SloppyTNode<BoolT> condition, int true_value,

0 comments on commit f018ceb

Please sign in to comment.
You can’t perform that action at this time.